first commit

This commit is contained in:
pakerpale
2020-06-10 06:21:34 +09:00
commit 20c9739ba9
1913 changed files with 266257 additions and 0 deletions

14
.gitignore vendored Executable file
View File

@@ -0,0 +1,14 @@
application/cache/*
!application/cache/index.html
application/logs/*
!application/logs/index.html
#application/config/development/database.php
composer.lock
vendor/
logs/
!logs/index.html
storage/logs/
!storage/logs/index.html
#storage/cache/
#!storage/cache/index.html
system/

2
README.md Executable file
View File

@@ -0,0 +1,2 @@
# Crossmap Website
CodeIgniter Application.

6
application/.htaccess Executable file
View File

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

140
application/config/autoload.php Executable file
View File

@@ -0,0 +1,140 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('user_agent' => 'ua');
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in the system/libraries folder or in your
| application/libraries folder within their own subdirectory. 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');
/*
| -------------------------------------------------------------------
| 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('page_model', 'post_model', 'category_model');

501
application/config/config.php Executable file
View File

@@ -0,0 +1,501 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will try guess the protocol, domain
| and path to your installation. However, you should always configure this
| explicitly and never rely on auto-guessing, especially in production
| environments.
|
*/
$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| 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'] = 4;
/*
|--------------------------------------------------------------------------
| 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'] = dirname(FCPATH). DIRECTORY_SEPARATOR. 'storage'. DIRECTORY_SEPARATOR. 'logs'. DIRECTORY_SEPARATOR;
/*
|--------------------------------------------------------------------------
| 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
|--------------------------------------------------------------------------
|
| Set this to TRUE if you want to use different cache files depending on the
| URL query string. Please be aware this might result in numerous cache files.
|
*/
$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'] = 'UXboFaugTOjjMdjPVQULrVmXPIsJDhyk';
/*
|--------------------------------------------------------------------------
| 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 dependant.
|
| 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.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'hoosk_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;
$config['sess_table_name'] = 'hoosk_sessions';
/*
|--------------------------------------------------------------------------
| 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'] = "hoosk";
$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 occurences 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)
|
*/
$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'] = '';

108
application/config/constants.php Executable file
View File

@@ -0,0 +1,108 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
define('FILE_READ_MODE', 0644);
define('FILE_WRITE_MODE', 0666);
define('DIR_READ_MODE', 0755);
define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
define('FOPEN_WRITE_CREATE', 'ab');
define('FOPEN_READ_WRITE_CREATE', 'a+b');
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
| Display Debug backtrace
|--------------------------------------------------------------------------
|
| If set to TRUE, a backtrace will be displayed along with php errors. If
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
*/
define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| 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
|
*/
define('EXIT_SUCCESS', 0); // no errors
define('EXIT_ERROR', 1); // generic error
define('EXIT_CONFIG', 3); // configuration error
define('EXIT_UNKNOWN_FILE', 4); // file not found
define('EXIT_UNKNOWN_CLASS', 5); // unknown class
define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
define('EXIT_USER_INPUT', 7); // invalid user input
define('EXIT_DATABASE', 8); // database error
define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
/*
|--------------------------------------------------------------------------
| Crossmap Custom Constants
|--------------------------------------------------------------------------
|
| Crossmap configuration default constants
|
*/
define ('BASE_URL', $_SERVER['REQUEST_SCHEME']. '://'. $_SERVER['HTTP_HOST']);
define ('EMAIL_URL', $_SERVER['SERVER_NAME']);
define ('ADMIN_THEME', BASE_URL.'/theme/admin');
define ('NEWS_SECTION_CATEGORY', ['church' => 10005, 'society' => 10010, 'mission' => 10011, 'culture' => 10012, 'theology' => 10013, 'opinions' => 30011]);
/*
|--------------------------------------------------------------------------
| Crossmap Social Login API Keys
|--------------------------------------------------------------------------
|
| Crossmap SNS integration default constants
|
*/

85
application/config/database.php Executable file
View File

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

View File

@@ -0,0 +1,501 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will try guess the protocol, domain
| and path to your installation. However, you should always configure this
| explicitly and never rely on auto-guessing, especially in production
| environments.
|
*/
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = dirname(BASEPATH). '/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| 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'] = 4;
/*
|--------------------------------------------------------------------------
| 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'] = dirname(FCPATH). DIRECTORY_SEPARATOR. 'storage'. DIRECTORY_SEPARATOR. 'logs'. DIRECTORY_SEPARATOR;
/*
|--------------------------------------------------------------------------
| 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'] = dirname(BASEPATH). '/storage/cache/';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Set this to TRUE if you want to use different cache files depending on the
| URL query string. Please be aware this might result in numerous cache files.
|
*/
$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'] = 'UXboFaugTOjjMdjPVQULrVmXPIsJDhyk';
/*
|--------------------------------------------------------------------------
| 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 dependant.
|
| 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.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'cm_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;
$config['sess_table_name'] = 'cm_sessions';
/*
|--------------------------------------------------------------------------
| 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'] = "cmap";
$config['cookie_domain'] = ".". EMAIL_URL;
$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 occurences 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'] = 'Asia/Seoul';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';

View File

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

View File

@@ -0,0 +1,33 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Kakao API Key
|--------------------------------------------------------------------------
|
|
*/
$config['kakao_app_key'] = '2ed0ba61aca3a597436f0b1be611ef52';
$config['kakao_app_secret'] = 'sbV7XDvwIvPfVHtc4G0wPnxaf1q3I0uZ';
$config['kakao_base_uri'] = 'https://kauth.kakao.com';
$config['kakao_api_base_uri'] = 'https://kapi.kakao.com';
$config['kakao_redirect_uri'] = BASE_URL . '/oauth/kakao';
$config['facebook_app_key'] = '1417551725050030';
$config['facebook_app_secret'] = 'c2d2d16a0bb9ed6becf4a6bb757fbbc6';
$config['facebook_redirect_uri'] = BASE_URL . '/oauth/facebook';
$config['twitter_app_key'] = 'V2Wddt9SnLBjHqRf57G7a2QwK';
$config['twitter_app_secret'] = 'GZ6q0ZprDMWRMmIrACiKIIA8zCgxEMZRiwPEtwoTBIh01ko21H';
$config['twitter_redirect_uri'] = BASE_URL . '/oauth/twitter';
$config['pinterest_app_key'] = '5039705321411492089';
$config['pinterest_app_secret'] = 'd75c1d00c8c002e66ba377acbf295f8faebc1ca8970adb3c4366e1f96fc7284d';
$config['pinterest_redirect_uri'] = BASE_URL . '/oauth/pinterest';
$config['naver_app_key'] = 'cNiinVHYsygxVKF4FOtw';
$config['naver_app_state'] = '9709a20b3f643732f0bf3ee356214630';
$config['naver_app_secret'] = 'd75c1d00c8c002e66ba377acbf295f8faebc1ca8970adb3c4366e1f96fc7284d';
$config['naver_redirect_uri'] = BASE_URL . '/oauth/naver';
$config['naver_redirect_uri'] = BASE_URL . '/web/share/naver_callback_proc';

24
application/config/doctypes.php Executable file
View File

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

View File

@@ -0,0 +1,102 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
'/Б/' => 'B',
'/б/' => 'b',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Д/' => 'D',
'/д/' => 'd',
'/Ð|Ď|Đ|Δ/' => 'Dj',
'/ð|ď|đ|δ/' => 'dj',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
'/Ф/' => 'F',
'/ф/' => 'f',
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ|Κ|К/' => 'K',
'/ķ|κ|к/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
'/М/' => 'M',
'/м/' => 'm',
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
'/П/' => 'P',
'/п/' => 'p',
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
'/ŕ|ŗ|ř|ρ|р/' => 'r',
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|т/' => 't',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => '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'
);

13
application/config/hooks.php Executable file
View File

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

11
application/config/index.html Executable file
View File

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

View File

@@ -0,0 +1,501 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will try guess the protocol, domain
| and path to your installation. However, you should always configure this
| explicitly and never rely on auto-guessing, especially in production
| environments.
|
*/
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = dirname(BASEPATH). '/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| 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'] = 4;
/*
|--------------------------------------------------------------------------
| 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'] = dirname(FCPATH). DIRECTORY_SEPARATOR. 'storage'. DIRECTORY_SEPARATOR. 'logs'. DIRECTORY_SEPARATOR;
/*
|--------------------------------------------------------------------------
| 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'] = dirname(BASEPATH). '/storage/cache/';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Set this to TRUE if you want to use different cache files depending on the
| URL query string. Please be aware this might result in numerous cache files.
|
*/
$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'] = 'UXboFaugTOjjMdjPVQULrVmXPIsJDhyk';
/*
|--------------------------------------------------------------------------
| 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 dependant.
|
| 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.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'cm_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;
$config['sess_table_name'] = 'cm_sessions';
/*
|--------------------------------------------------------------------------
| 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'] = "cmap";
$config['cookie_domain'] = ".". EMAIL_URL;
$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 occurences 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'] = 'Asia/Seoul';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';

View File

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

View File

@@ -0,0 +1,33 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Kakao API Key
|--------------------------------------------------------------------------
|
|
*/
$config['kakao_app_key'] = '2ed0ba61aca3a597436f0b1be611ef52';
$config['kakao_app_secret'] = 'sbV7XDvwIvPfVHtc4G0wPnxaf1q3I0uZ';
$config['kakao_base_uri'] = 'https://kauth.kakao.com';
$config['kakao_api_base_uri'] = 'https://kapi.kakao.com';
$config['kakao_redirect_uri'] = BASE_URL . '/oauth/kakao';
$config['facebook_app_key'] = '1417551725050030';
$config['facebook_app_secret'] = 'c2d2d16a0bb9ed6becf4a6bb757fbbc6';
$config['facebook_redirect_uri'] = BASE_URL . '/oauth/facebook';
$config['twitter_app_key'] = 'V2Wddt9SnLBjHqRf57G7a2QwK';
$config['twitter_app_secret'] = 'GZ6q0ZprDMWRMmIrACiKIIA8zCgxEMZRiwPEtwoTBIh01ko21H';
$config['twitter_redirect_uri'] = BASE_URL . '/oauth/twitter';
$config['pinterest_app_key'] = '5039705321411492089';
$config['pinterest_app_secret'] = 'd75c1d00c8c002e66ba377acbf295f8faebc1ca8970adb3c4366e1f96fc7284d';
$config['pinterest_redirect_uri'] = BASE_URL . '/oauth/pinterest';
$config['naver_app_key'] = 'cNiinVHYsygxVKF4FOtw';
$config['naver_app_state'] = '9709a20b3f643732f0bf3ee356214630';
$config['naver_app_secret'] = 'd75c1d00c8c002e66ba377acbf295f8faebc1ca8970adb3c4366e1f96fc7284d';
$config['naver_redirect_uri'] = BASE_URL . '/oauth/naver';
$config['naver_redirect_uri'] = BASE_URL . '/web/share/naver_callback_proc';

View File

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

View File

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

156
application/config/mimes.php Executable file
View File

@@ -0,0 +1,156 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
'ai' => array('application/pdf', 'application/postscript'),
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => array('application/x-javascript', 'text/plain'),
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => array('audio/x-aiff', 'audio/aiff'),
'aiff' => array('audio/x-aiff', 'audio/aiff'),
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'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' => 'video/3gp',
'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'
);

View File

@@ -0,0 +1,14 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/* Global Pagination */
$config['full_tag_open'] = '<div class="form-actions"><ul class="pagination">';
$config['full_tag_close'] = '</ul></div>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a>';
$config['cur_tag_close'] = '</a></li>';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$config['prev_tag_open'] = '<li>';
$config['prev_tag_close'] = '</li>';

View File

@@ -0,0 +1,501 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will try guess the protocol, domain
| and path to your installation. However, you should always configure this
| explicitly and never rely on auto-guessing, especially in production
| environments.
|
*/
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = dirname(BASEPATH). '/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| 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'] = 4;
/*
|--------------------------------------------------------------------------
| 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'] = dirname(FCPATH). DIRECTORY_SEPARATOR. 'storage'. DIRECTORY_SEPARATOR. 'logs'. DIRECTORY_SEPARATOR;
/*
|--------------------------------------------------------------------------
| 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'] = dirname(BASEPATH). '/storage/cache/';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Set this to TRUE if you want to use different cache files depending on the
| URL query string. Please be aware this might result in numerous cache files.
|
*/
$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'] = 'UXboFaugTOjjMdjPVQULrVmXPIsJDhyk';
/*
|--------------------------------------------------------------------------
| 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 dependant.
|
| 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.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'cm_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;
$config['sess_table_name'] = 'cm_sessions';
/*
|--------------------------------------------------------------------------
| 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'] = "cmap";
$config['cookie_domain'] = ".". EMAIL_URL;
$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 occurences 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'] = 'Asia/Seoul';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';

View File

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

View File

@@ -0,0 +1,33 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Kakao API Key
|--------------------------------------------------------------------------
|
|
*/
$config['kakao_app_key'] = '2ed0ba61aca3a597436f0b1be611ef52';
$config['kakao_app_secret'] = 'sbV7XDvwIvPfVHtc4G0wPnxaf1q3I0uZ';
$config['kakao_base_uri'] = 'https://kauth.kakao.com';
$config['kakao_api_base_uri'] = 'https://kapi.kakao.com';
$config['kakao_redirect_uri'] = BASE_URL . '/oauth/kakao';
$config['facebook_app_key'] = '1417551725050030';
$config['facebook_app_secret'] = 'c2d2d16a0bb9ed6becf4a6bb757fbbc6';
$config['facebook_redirect_uri'] = BASE_URL . '/oauth/facebook';
$config['twitter_app_key'] = 'V2Wddt9SnLBjHqRf57G7a2QwK';
$config['twitter_app_secret'] = 'GZ6q0ZprDMWRMmIrACiKIIA8zCgxEMZRiwPEtwoTBIh01ko21H';
$config['twitter_redirect_uri'] = BASE_URL . '/oauth/twitter';
$config['pinterest_app_key'] = '5039705321411492089';
$config['pinterest_app_secret'] = 'd75c1d00c8c002e66ba377acbf295f8faebc1ca8970adb3c4366e1f96fc7284d';
$config['pinterest_redirect_uri'] = BASE_URL . '/oauth/pinterest';
$config['naver_app_key'] = 'cNiinVHYsygxVKF4FOtw';
$config['naver_app_state'] = '9709a20b3f643732f0bf3ee356214630';
$config['naver_app_secret'] = 'd75c1d00c8c002e66ba377acbf295f8faebc1ca8970adb3c4366e1f96fc7284d';
$config['naver_redirect_uri'] = BASE_URL . '/oauth/naver';
$config['naver_redirect_uri'] = BASE_URL . '/web/share/naver_callback_proc';

14
application/config/profiler.php Executable file
View File

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

168
application/config/routes.php Executable file
View File

@@ -0,0 +1,168 @@
<?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:
|
| http://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['install/complete'] = "admin/admin/complete";
$route['attachments'] = "admin/admin/upload";
$route['admin'] = "admin/admin";
$route['admin/login'] = "admin/admin/login";
$route['admin/login/check'] = "admin/admin/loginCheck";
$route['admin/logout'] = "admin/admin/logout";
$route['admin/check/session'] = "admin/admin/checkSession";
$route['admin/ajax/login'] = "admin/admin/ajaxLogin";
$route['admin/users'] = "admin/users";
$route['admin/users/new'] = "admin/users/addUser";
$route['admin/users/roles'] = "admin/users/roles";
$route['admin/users/new/add'] = "admin/users/confirm";
$route['admin/users/delete/(:any)'] = "admin/users/delete";
$route['admin/users/edit/(:any)'] = "admin/users/editUser";
$route['admin/users/edited/(:any)'] = "admin/users/edited";
$route['admin/user/forgot'] = 'admin/users/forgot'; //
$route['admin/users/(:any)'] = "admin/users";
$route['admin/reset/(:any)'] = 'admin/users/getPassword'; //
$route['admin/pages'] = "admin/pages";
$route['admin/pages/new'] = "admin/pages/addPage";
$route['admin/pages/new/add'] = "admin/pages/confirm";
$route['admin/pages/delete/(:any)'] = "admin/pages/delete";
$route['admin/pages/edit/(:any)'] = "admin/pages/editPage";
$route['admin/pages/edited/(:any)'] = "admin/pages/edited";
$route['admin/pages/jumbo/(:any)'] = "admin/pages/jumbo";
$route['admin/pages/jumbotron/(:any)'] = "admin/pages/jumboAdd";
$route['admin/pages/(:any)'] = "admin/pages";
$route['admin/navigation'] = "admin/navigation";
$route['admin/navigation/new'] = "admin/navigation/newNav";
$route['admin/navigation/edit/(:any)'] = "admin/navigation/editNav";
$route['admin/navigation/delete/(:any)'] = "admin/navigation/deleteNav";
$route['admin/navadd/(:any)'] = "admin/navigation/navAdd";
$route['admin/navigation/insert'] = "admin/navigation/insert";
$route['admin/navigation/update/(:any)'] = "admin/navigation/update";
$route['admin/navigation/(:any)'] = "admin/navigation";
$route['admin/settings'] = "admin/settings";
$route['admin/settings/submit'] = "admin/settings/uploadLogo";
$route['admin/settings/update'] = "admin/settings/updateSettings";
$route['admin/settings/social'] = "admin/settings/social";
$route['admin/settings/default'] = "admin/settings/index";
$route['admin/settings/roles'] = "admin/settings/roles";
$route['admin/settings/roles/(:num)'] = "admin/settings/roles";
$route['admin/settings/roles/new'] = "admin/settings/newRole";
$route['admin/settings/roles/new/add'] = "admin/settings/addRole";
$route['admin/settings/roles/edit/(:num)'] = "admin/settings/editRole";
$route['admin/settings/roles/edited/(:num)'] = "admin/settings/editedRole";
$route['admin/settings/roles/delete/(:num)'] = "admin/settings/deleteRole";
$route['admin/social/update'] = "admin/settings/updateSocial";
$route['admin/posts'] = "admin/posts";
$route['admin/posts/new'] = "admin/posts/addPost";
$route['admin/posts/new/add'] = "admin/posts/confirm";
$route['admin/posts/delete/(:any)'] = "admin/posts/delete";
$route['admin/posts/edit/(:any)'] = "admin/posts/editPost";
$route['admin/posts/preview/(:any)'] = "admin/posts/previewPost";
$route['admin/posts/edited/(:any)'] = "admin/posts/edited";
$route['admin/posts/schedule/(:any)'] = "admin/posts/schedule";
$route['admin/posts/categories'] = "admin/categories";
$route['admin/posts/categories/new'] = "admin/categories/addCategory";
$route['admin/posts/categories/new/add'] = "admin/categories/confirm";
$route['admin/posts/categories/delete/(:any)'] = "admin/categories/delete";
$route['admin/posts/categories/edit/(:any)'] = "admin/categories/editCategory";
$route['admin/posts/categories/edited/(:any)'] = "admin/categories/edited";
$route['admin/posts/categories/(:any)'] = "admin/categories";
$route['admin/posts/(:any)'] = "admin/posts";
$route['admin/ajax/post-search'] = "admin/posts/postSearch";
$route['admin/ajax/category-search'] = "admin/categories/categorySearch";
$route['admin/ajax/page-search'] = "admin/pages/pageSearch";
$route['admin/ajax/role-search'] = "admin/settings/roleSearch";
$route['admin/ajax/user-search'] = "admin/users/userSearch";
$route['admin/comments'] = "admin/comments";
$route['admin/comments/delete/(:any)'] = "admin/comments/delete";
$route['admin/comments/edit/(:any)'] = "admin/comments/editComments";
$route['admin/comments/edited/(:any)'] = "admin/comments/edited";
$route['admin/comments/(:any)'] = "admin/comments";
$route['admin/pray'] = "admin/pray";
$route['admin/pray/delete/(:any)'] = "admin/pray/delete";
$route['admin/pray/edit/(:any)'] = "admin/pray/editPray";
$route['admin/pray/edited/(:any)'] = "admin/pray/edited";
$route['admin/pray/(:any)'] = "admin/pray";
$route['admin/data/(:any)'] = "admin/data";
$route['admin/data/(:any)/(:any)'] = "admin/data";
$route['admin/data/(:any)/(:any)/(:any)'] = "admin/data/post";
$route['news/(:any)'] = "News";
$route['news/(:any)/(:any)'] = "News";
$route['pray/(:any)'] = "pray";
$route['pray/(:any)/(:any)'] = "pray";
$route['grace/(:any)'] = "Grace";
$route['grace/(:any)/(:any)'] = "Grace";
$route['webtoon/(:any)'] = "Webtoon";
$route['webtoon/(:any)/(:any)'] = "Webtoon";
$route['life'] = "Channel";
$route['life/(:any)'] = "Channel";
$route['life/(:any)/(:any)'] = "Channel";
$route['channel/(:any)'] = "Channel";
$route['channel/(:any)/(:any)'] = "Channel";
$route['oauth/(:any)'] = "user/oauth";
$route['/web/share/(:any)'] = "user/oauth/$1";
$route['comment/(:any)'] = "Comment";
$route['comment/(:any)/(:any)'] = "Comment";
$route['default_controller'] = "Home";
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

65
application/config/smileys.php Executable file
View File

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

89
application/config/template.php Executable file
View File

@@ -0,0 +1,89 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Parser Enabled
|--------------------------------------------------------------------------
|
| Should the Parser library be used for the entire page?
|
| Can be overridden with $this->template->enable_parser(TRUE/FALSE);
|
| Default: TRUE
|
*/
$config['parser_enabled'] = TRUE;
/*
|--------------------------------------------------------------------------
| Parser Enabled for Body
|--------------------------------------------------------------------------
|
| If the parser is enabled, do you want it to parse the body or not?
|
| Can be overridden with $this->template->enable_parser(TRUE/FALSE);
|
| Default: FALSE
|
*/
$config['parser_body_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Title Separator
|--------------------------------------------------------------------------
|
| What string should be used to separate title segments sent via $this->template->title('Foo', 'Bar');
|
| Default: ' | '
|
*/
$config['title_separator'] = ' | ';
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Which layout file should be used? When combined with theme it will be a layout file in that theme
|
| Change to 'main' to get /application/views/main.php
|
| Default: FALSE
|
*/
$config['layout'] = FALSE;
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Which theme to use by default?
|
| Can be overriden with $this->template->set_theme('foo');
|
| Default: ''
|
*/
$config['theme'] = THEME;
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Where should we expect to see themes?
|
| Default: array(APPPATH.'themes/' => '../themes/')
|
*/
$config['theme_locations'] = array(
APPPATH.'theme/'
);

View File

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

View File

@@ -0,0 +1,137 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Channel extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$totSegments = $this->uri->total_segments();
if ($totSegments == 2) {
$pageURL = $this->uri->segment($totSegments);
$this->load->model('cmap_model');
$this->data['viewType'] = 'list';
$this->data['channelurl'] = '/channel/' . $pageURL . '/';
$this->data['page'] = $this->page_model->getOne($pageURL);
$this->data['deliveryCount'] = count($this->page_model->getPageDelivery($this->data['page']->pageID));
$this->data['postsCount'] = $this->post_model->getCountPostsByPageId($this->data['page']->pageID);
$this->data['posts'] = $this->post_model->getPostsByPageId($this->data['page']->pageID, 15)->get()->result();
if ($this->data['page']->pageTemplate != "") {
$this->load->view('templates/channel/' . $this->data['page']->pageTemplate, $this->data);
} else {
$this->error();
}
} elseif (is_numeric($this->uri->segment($totSegments))) {
$pageURL = $this->uri->segment($totSegments - 1);
$articleURL = $this->uri->segment($totSegments);
$this->data['viewType'] = 'article';
$this->data['page'] = $this->page_model->getOne($pageURL);
$this->data['post'] = $this->post_model->getPost($articleURL);
if ($this->data['post']->postID != "") {
$this->data['postsCount'] = $this->post_model->getCountPostsByPageId($this->data['page']->pageID);
$this->data['video'] = $this->post_model->getPostVideo($this->data['post']->postID);
$this->data['tag'] = $this->post_model->getPostTag($this->data['post']->postID);
$this->load->view('templates/channel/channel', $this->data);
} else {
$this->error();
}
}
}
public function category()
{
if (!$this->maintenanceMode) {
$catSlug = $this->uri->segment(2);
$this->data['page'] = $this->cmap_page_model->getCategory($catSlug);
if ($this->data['page']['categoryID'] != "") {
$this->data['header'] = $this->load->view('templates/header', $this->data, true);
$this->data['footer'] = $this->load->view('templates/footer', '', true);
$this->load->view('templates/category', $this->data);
} else {
$this->error();
}
} else {
$this->maintenance();
}
}
public function prayer()
{ }
public function channel()
{
if (!$this->maintenanceMode) {
$totSegments = $this->uri->total_segments();
if ($totSegments == 2) {
$pageURL = $this->uri->segment($totSegments);
$this->load->model('cmap_model');
$this->data['viewType'] = 'list';
$this->data['channelurl'] = '/channel/' . $pageURL . '/';
$this->data['page'] = $this->cmap_page_model->getPage($pageURL);
$this->data['deliveryCount'] = count($this->cmap_page_model->getPageDelivery($this->data['page']['pageID']));
$this->data['posts'] = $this->cmap_model->getPostByPageId($this->data['page']['pageID']);
if ($this->data['page']['pageTemplate'] != "") {
$this->data['header'] = $this->load->view('templates/header', $this->data, true);
$this->data['footer'] = $this->load->view('templates/footer', '', true);
$this->load->view('templates/channel/' . $this->data['page']['pageTemplate'], $this->data);
} else {
$this->error();
}
} elseif (is_numeric($this->uri->segment($totSegments))) {
$pageURL = $this->uri->segment($totSegments - 1);
$articleURL = $this->uri->segment($totSegments);
$this->data['viewType'] = 'article';
$this->data['page'] = $this->cmap_page_model->getPage($pageURL);
$this->data['post'] = $this->cmap_page_model->getArticle($articleURL);
if ($this->data['post']['postID'] != "") {
$this->data['header'] = $this->load->view('templates/header', $this->data, true);
$this->data['footer'] = $this->load->view('templates/footer', '', true);
$this->load->view('templates/channel/' . $this->data['page']['pageTemplate'], $this->data);
} else {
$this->error();
}
} else {
$this->error();
}
} else {
$this->maintenance();
}
}
public function article()
{
if (!$this->maintenanceMode) {
$this->load->model('cmap_model');
$articleURL = $this->uri->segment(2);
$this->data['page'] = $this->cmap_page_model->getArticle($articleURL);
if ($this->data['page']['postID'] != "") {
$this->data['column'] = $this->cmap_page_model->getColumn();
$this->data['focus'] = $this->cmap_model->getPosts(30, 0, 0, 10000, [$this->data['page']['postID']]);
$this->data['page']['parentTitle'] = '';
if ($this->data['page']['parentID'] != 0 && $this->data['page']['parentID'] % 10000 !== 0) {
$parentCategory = $this->cmap_model->getCategory($this->data['page']['parentID']);
if (count($parentCategory)) {
$this->data['page']['parentTitle'] = $parentCategory[0]['categoryTitle'];
}
}
$this->data['reporter'] = $this->cmap_page_model->getReporterByPostId($this->data['page']['postID']);
$this->data['ranking'] = $this->cmap_page_model->getRankingByPostId($this->data['page']['postID']);
$this->data['header'] = $this->load->view('templates/header', $this->data, true);
$this->data['footer'] = $this->load->view('templates/footer', '', true);
$this->load->view('templates/article', $this->data);
} else {
$this->error();
}
} else {
$this->maintenance();
}
}
}

View File

@@ -0,0 +1,37 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Cmtv extends MY_Controller
{
public function __construct()
{
echo '<script>history.back()</script>';
die('준비중입니다.');
parent::__construct();
$this->load->model('post_model', 'post');
}
public function index()
{
$totSegments = $this->uri->total_segments();
if (!is_numeric($this->uri->segment($totSegments))) {
$pageURL = $this->uri->segment($totSegments);
} elseif (is_numeric($this->uri->segment($totSegments))) {
$pageURL = $this->uri->segment($totSegments - 1);
}
if ($pageURL == "") {
$pageURL = "home";
}
$this->data['page'] = $this->page_model->getOne($pageURL);
$this->data['postGroup'] = [];
$recentUpdatedPosts = $this->db->where('categoryID', 30022)->get('cm_page_attributes')->result();
foreach ($recentUpdatedPosts as $p) {
array_push($this->data['postGroup'], $this->post->getPagePostsByPageId($p->pageID, 4));
}
$this->data['header'] = $this->load->view('templates/others/header', $this->data, true);
$this->data['footer'] = $this->load->view('templates/others/footer', '', true);
$this->load->view('templates/others/prayer', $this->data);
}
}

View File

@@ -0,0 +1,121 @@
<?php
class Comment extends MY_Controller
{
private $policy;
public function __construct()
{
parent::__construct();
$this->policy = [
'anyone' => true
];
}
public function index()
{
if ($this->authorization()) {
$this->load->model('comment_model');
$this->{$this->uri->segment(2)}();
} else {
$this->response(array('code' => 405, 'error' => '로그인 하세요'));
}
}
private function authorization()
{
$resource = $this->uri->segment(2);
$comment = $this->input->post('comment');
if ($resource == 'new' || $resource == 'reply') {
return (mb_strlen($comment, 'UTF-8') <= 10 && $this->policy['anyone']) || getSessionUser()->is;
} else if ($resource == 'delete') {
return getSessionUser()->is;
}
return true;
}
private function replies()
{
$commentId = $this->uri->segment(3);
$replies = $this->comment_model->getRepliesByCommentId($commentId)
->join('cm_user', 'cm_comment.userID=cm_user.userID', 'left')
->select('*, 0 like, 0 bad, 0 replies')->get()->result();
$this->comment_model->getRepliesAndRankings($replies);
$this->response(array('code' => 200, 'replies' => $replies));
}
private function new()
{
$data = [
'postID' => $this->input->post('postId'),
'userID' => getSessionUser()->is ? getSessionUser()->userID : 0,
'comment' => $this->input->post('comment'),
'datePosted' => date('Y-m-d H:i:s')
];
if ($insertId = $this->comment_model->save($data)) {
$this->response(array('code' => 200, 'commentId' => $insertId, 'datePosted' => $data['datePosted'], 'nickname' => getSessionUser()->is ? getSessionUser()->userName : ''));
} else {
$this->response(array('code' => 500, 'error' => '서버오류가 발생했습니다'));
}
}
private function reply()
{
$data = [
'postID' => $this->input->post('postId'),
'userID' => getSessionUser()->is ? getSessionUser()->userID : 0,
'parentID' => $this->input->post('parentId'),
'comment' => $this->input->post('comment'),
'datePosted' => date('Y-m-d H:i:s')
];
if ($insertId = $this->comment_model->save($data)) {
$this->response(array('code' => 200, 'commentId' => $insertId, 'datePosted' => $data['datePosted'], 'nickname' => getSessionUser()->is ? getSessionUser()->userName : ''));
} else {
$this->response(array('code' => 500, 'error' => '서버오류가 발생했습니다'));
}
}
private function rating()
{
$data = [
'userID' => getSessionUser()->is ? getSessionUser()->userID : 0,
'commentID' => $this->input->post('commentId'),
'title' => $this->input->post('title')
];
if ($this->comment_model->rating($data)) {
$this->response(array('code' => 200, 'ranking' => $this->comment_model->getCountRatingByCommentIdAndTitle($data['commentID'], $data['title'])));
} else {
lq();
$this->response(array('code' => 500, 'error' => '서버오류가 발생했습니다'));
}
}
private function delete()
{
if (getSessionUser()->userID == $this->comment_model->getOne($this->input->post('commentId'))->userID) {
if ($this->comment_model->delete($this->input->post('commentId'))) {
$this->response(array('code' => 200));
} else {
$this->response(array('code' => 500, 'error' => '서버오류가 발생했습니다'));
}
} else {
$this->response(array('code' => 405, 'error' => '잘못된 요청입니다.'));
}
}
private function update()
{
if (getSessionUser()->userID == $this->comment_model->getOne($this->input->post('commentId'))->userID) {
if ($this->comment_model->update([
'commentID' => $this->input->post('commentID'),
'comment' => $this->input->post('comment')
])) {
$this->response(array('code' => 200));
} else {
$this->response(array('code' => 500, 'error' => '서버오류가 발생했습니다'));
}
} else {
$this->response(array('code' => 405, 'error' => '잘못된 요청입니다.'));
}
}
}

258
application/controllers/Grace.php Executable file
View File

@@ -0,0 +1,258 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Grace extends MY_Controller
{
private $sections;
public function __construct()
{
parent::__construct();
$this->load->model('post_model', 'post');
$this->load->model('comment_model', 'comment');
}
public function index()
{
if ($this->isMobile()) {
$this->mobile();
} else {
$this->desktop();
}
}
private function desktop()
{
$section = $this->uri->segment(2);
$article = $this->uri->segment(3);
$this->data['sectionCategory'] = NEWS_SECTION_CATEGORY;
if (is_numeric($article)) {
$this->article($article);
$this->load->view('templates/grace/grace-article', $this->data);
} elseif ($section) {
$this->section();
$this->load->view('templates/grace/grace-section', $this->data);
} else {
$this->main();
$this->load->view('templates/grace/grace-home', $this->data);
}
}
private function mobile()
{
$section = $this->uri->segment(2);
$article = $this->uri->segment(3);
if (is_numeric($article)) {
$this->load->view('mobile/grace/grace-article', $this->data);
} else if ($article) {
$this->load->view('mobile/grace/grace-editor', $this->data);
} elseif ($section) {
$this->load->view('mobile/grace/grace-section', $this->data);
} else {
$this->load->view('mobile/grace/grace-home', $this->data);
}
}
private function main()
{
$this->data['featured'] = $this->post->getPagePostsByCategoryId(getChildrenByParentId(30000), 5)
->join('cm_user u', 'p.userID=u.userID', 'left')->where('img !=', '')
->order_by('p.dateUpdated', 'desc')->group_by('pp.pageID')
->get()->result();
$this->getLink($this->data['featured']);
$this->setSections();
foreach ($this->sections as $k => $s) {
if($k == 'search') continue;
$this->data[$k] = $this->sections[$k][2]()
->join('cm_user u', 'p.userID=u.userID', 'left')
->join('cm_page_attributes pa', 'pp.pageID=pa.pageID', 'left')
->join('cm_page_content pcn', 'pp.pageID=pcn.pageID', 'left')
->select('p.*')
->select('if(pa.pageIcon is null, if(pcn.img is null, if(u.profile_img is null, p.postImage, u.profile_img), pcn.img), pa.pageIcon) pageIcon')
->select('0 likes, 0 views, 0 comments')
->select("if(u.nickname = '' or u.nickname is null, u.userName, u.nickName) as author")
->group_by('p.postID')
->get()->result();
$this->getLink($this->data[$k]);
}
foreach ($this->data as $k => $v) {
getPostsImageUrl($this->data[$k]);
}
}
private function setSections()
{
// 은혜충전(구 라이프)의 해당 카테고리의 최신 글 테그
// 은혜충전(구 라이프)의 해당 카테고리의 업데이트 순과 좋아요순
// 페이징처리
$this->sections = [
'storyqt' => [[30005, 30008], function () {
return $this->post->getCountPostsByPageIdAndCategoryId($this->sections['storyqt'][0][0], $this->sections['storyqt'][0][1]);
}, function () {
return $this->post->getPostsByPageIdAndCategoryId($this->sections['storyqt'][0][0], $this->sections['storyqt'][0][1], 20);
}],
'wordcard' => [[30003, 30005], function () {
return $this->post->getCountPostsByPageId($this->sections['wordcard'][0]);
}, function () {
return $this->post->getPostsByPageId($this->sections['wordcard'][0], 20);
}],
'english' => [[30005, 30008], function () {
return $this->post->getCountPostsByPageIdAndCategoryId($this->sections['english'][0][0], $this->sections['english'][0][1]);
}, function () {
return $this->post->getPostsByPageIdAndCategoryId($this->sections['english'][0][0], $this->sections['english'][0][1], 20);
}],
'videoqt' => [null, function () {
return $this->post->getPostQuery()->join('cm_post_video v', 'p.postID=v.postID', 'inner')->count_all_results();
}, function () {
return $this->post->getPostQuery()->join('cm_post_video v', 'p.postID=v.postID', 'inner')->limit(20);
}],
'cpost' => [[30006, 30008], function () {
return $this->post->getCountPostsByPageId($this->sections['cpost'][0]);
}, function () {
return $this->post_model->getPostsByPageId($this->sections['cpost'][0], 20);
}],
'poem' => [[30043], function () {
return $this->post->getCountPostsByPageId($this->sections['poem'][0]);
}, function () {
return $this->post_model->getPostsByPageId($this->sections['poem'][0], 20);
}],
'popular' => [[30043], function () {
return $this->post->getCountPostsByPageId($this->sections['poem'][0]);
}, function () {
return $this->post_model->getPostsByPageId($this->sections['poem'][0], 20);
}],
'tagFeatured' => [[30043], function () {
return $this->post->getCountPostsByPageId($this->sections['poem'][0]);
}, function () {
return $this->post_model->getPostQuery()->join('cm_post_tag t', 'p.postID=t.postID', 'left');
}],
'search' => [[30043], function () {
$this->load->library('search');
return $this->search->searchByPostTitle($this->input->get('keyword'), 20, [], true)->count_all_results();
}, function () {
$this->load->library('search');
return $this->search->searchByPostTitle($this->input->get('keyword'), 20, [], true)
->join('cm_post_page pp', 'p.postID=pp.postID', 'left')->limit(20);
}]
];
}
private function section()
{
$this->setSections();
$this->load->library('pagination');
$this->data['totalRows'] = $this->sections[$this->uri->segment(2)][1]();
$this->pagination->initialize([
'base_url' => BASE_URL . '/grace/' . $this->uri->segment(2),
'total_rows' => $this->data['totalRows'],
'per_page' => 20,
'full_tag_open' => '',
'full_tag_close' => '',
'num_tag_open' => '',
'num_tag_close' => '',
'cur_tag_open' => '<a class="current">',
'cur_tag_close' => '</a>',
'next_tag_open' => '',
'next_tag_close' => '',
'prev_tag_open' => '',
'prev_tag_close' => '',
'next_link' => '',
'prev_link' => '',
'last_link' => '<img src="' . THEME_FOLDER . '/img/mypage_arrow_right.gif">',
'first_link' => '<img src="' . THEME_FOLDER . '/img/mypage_arrow_left.gif">',
'prefix' => 'page-',
'suffix' => $this->input->get('keyword') ? '?keyword='. $this->input->get('keyword') :''
]);
$countQuery = $this->db->last_query();
$this->data['posts'] = $this->sections[$this->uri->segment(2)][2]()->offset(
$this->uri->segment(3) ? str_replace('page-', '', $this->uri->segment(3)) : 0
)->join('cm_user u', 'p.userID=u.userID', 'left')
->join('cm_page_attributes pa', 'pp.pageID=pa.pageID', 'left')
->join('cm_page_content pcn', 'pp.pageID=pcn.pageID', 'left')
->select('p.*, if(pa.pageIcon is null, if(pcn.img is null, if(u.profile_img is null, p.postImage, u.profile_img), pcn.img), pa.pageIcon) pageIcon, 0 likes, 0 views, 0 comments, u.userName')->get()->result();
$sqlSegments = explode('WHERE', explode('FROM', $countQuery)[1]);
$tags = $this->db->query('select t.tag from ' . $sqlSegments[0] . ($this->uri->segment(2) == 'search' ? ' ':' inner join cm_post_tag t on p.postID=t.postID ') . (isset($sqlSegments[1]) ? 'where ' . $sqlSegments[1] : '') . ' order by p.dateUpdated desc')->result();
// $this->sections[$this->uri->segment(2)][2]()->join('cm_post_tag t', 'p.postID=t.postID', 'inner');
$this->data['tags'] = [];
foreach ($tags as $t) {
$this->data['tags'] = array_merge($this->data['tags'], explode(strpos($t->tag, ',')? ',': ' ', $t->tag));
}
if(count($this->data['posts'])) {
array_map(function ($c) {
foreach ($this->data['posts'] as $k => $v) {
if ($v->postID == $c->postID) {
$this->data['posts'][$k]->comments = $c->cnt;
}
}
}, $this->comment->getCountByPostId(array_column($this->data['posts'], 'postID'))->get()->result());
array_map(function ($c) {
foreach ($this->data['posts'] as $k => $v) {
if ($v->postID == $c->postID) {
if ($c->title == 'L') {
$this->data['posts'][$k]->likes = $c->rating;
} else {
$this->data['posts'][$k]->views = $c->rating;
}
}
}
}, $this->post->getPostsRankingByPostId(array_column($this->data['posts'], 'postID'))->get()->result());
}
$this->data['tags'] = array_unique($this->data['tags']);
$this->getLink($this->data['posts']);
}
private function article($article)
{
$this->load->model('comment_model');
$section = $this->uri->segment(2);
$this->data['comments'] = $this->comment_model->getByPostId($article)
->where('parentID', 0)
->join('cm_user', 'cm_comment.userID=cm_user.userID', 'left')
->select('*, 0 like, 0 bad, 0 replies')->get()->result();
$this->comment_model->getRepliesAndRankings($this->data['comments']);
$this->data['post'] = $this->post->getPostQuery()->join('cm_user u', 'p.userID=u.userID', 'left')
->join('cm_page_attributes pa', 'pp.pageID=pa.pageID', 'left')
->join('cm_page_content pcn', 'pp.pageID=pcn.pageID', 'left')
->where('p.postID', $this->uri->segment(3))->get()->row();
$this->data['video'] = $this->post->getPostVideo($this->data['post']->postID);
$this->setSections();
foreach ($this->sections as $k => $s) {
if($k == 'search') continue;
$this->data[$k] = $this->sections[$k][2]()
->join('cm_user u', 'p.userID=u.userID', 'left')
->join('cm_page_attributes pa', 'pp.pageID=pa.pageID', 'left')
->join('cm_page_content pcn', 'pp.pageID=pcn.pageID', 'left')
->select('p.*')
->select('if(pa.pageIcon is null, if(pcn.img is null, if(u.profile_img is null, p.postImage, u.profile_img), pcn.img), pa.pageIcon) pageIcon')
->select('0 likes, 0 views, 0 comments')
->select("if(u.nickname = '' or u.nickname is null, u.userName, u.nickName) as author")
->group_by('p.postID')
->get()->result();
$this->getLink($this->data[$k]);
}
$this->load->library('search');
$this->data['related'] = $this->search->searchByPostTitle($this->data['post']->postTitle, 12, [$this->data['post']->postID], true)
->join('cm_user u', 'cm_post.userID=u.userID', 'left')
->select("*,if(u.nickname = '' or u.nickname is null, u.userName, u.nickName) as author")->get()->result();
$this->getLink($this->data['related']);
foreach ($this->data as $k => $v) {
getPostsImageUrl($this->data[$k]);
}
}
private function getLink(&$rows)
{
array_walk($rows, function (&$r) {
$r->articleURL = '/grace/' . ($this->uri->segment(2) ? $this->uri->segment(2) : 'cpost') . '/' . $r->postID;
});
}
}

View File

@@ -0,0 +1,73 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Home extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->model('post_model');
$this->load->library('Cacher');
$this->main();
}
private function main()
{
if ($this->isMobile()) {
$this->mobile();
} else {
$this->data['header'] = $this->load->view('templates/others/header', $this->data, true);
$this->data['footer'] = $this->load->view('templates/others/footer', '', true);
$this->desktop();
}
}
private function desktop()
{
$this->data['webtoons'] = $this->post_model->getPostsByCategoryId(getChildrenByParentId(20000), 6)->get()->result();
$this->data['storyqt'] = $this->post_model->getPostsByPageIdAndCategoryId(30005, 30008, 6)->get()->result();
$this->data['engMedi'] = $this->post_model->getPostsByPageIdAndCategoryId(30007, 30010, 6)->get()->result();
$this->data['mchart'] = array_slice($this->cacher->melon(), 0, 7);
$this->data['articles'] = getNewsArticleURL($this->post_model->getPostsByCategoryId(getChildrenByParentId(10000), 20)->get()->result());
$this->data['dailyqt'] = $this->post_model->getPostsByPageId(30048, 2)->get()->result();
$this->data['dailyword'] = $this->post_model->getPostsByCategoryId(37000, 1)->get()->row();
$this->data['talkshow'] = $this->post_model->getPostsByPageId(30045, 7)->get()->result();
$this->data['testimony'] = $this->post_model->getPostsByPageId(30044, 7)->get()->result();
$this->data['sermon'] = $this->post_model->getPostsByPageId(30042, 7)->get()->result();
$this->data['worship'] = $this->post_model->getPostsByPageId(30043, 7)->get()->result();
$this->data['letter'] = $this->post_model->getPostsByPageId([30003, 30005], 27)->get()->result(); // 3, 5
$this->data['pray'] = $this->post_model->getPostsByPageId(30009, 27)->get()->result(); // 9
$this->data['book'] = $this->post_model->getPostsByPageId([30017, 30026], 27)->get()->result(); // 17, 26
$this->data['meditate'] = $this->post_model->getPostsByPageId([30006, 30008], 27)->get()->result(); // 8, 6
// ['webtoons','storyqt','engMedi','mchart','articles','dailyqt','dailyword','talkshow','testimony','sermon','worship','letter','pray', 'book', 'meditate']
foreach($this->data as $k=>$v) {
getPostsImageUrl($this->data[$k]);
}
$this->load->view('templates/others/home', $this->data);
}
private function mobile()
{
$this->data['storyqt'] = $this->post_model->getPostsByPageIdAndCategoryId(30005, 30008, 6)->get()->result();
$this->data['featureToons'] = $this->post_model->getPostsRankingByRankTypeAndCategoryId('R', 20008, 4)
->join('cm_page_content co', 'pp.pageID=co.pageID', 'left')->get()->result();
getResultWithAuthor($this->data['featureToons']);
$this->data['talkshow'] = $this->post_model->getPostsByPageId(30045, 5)->get()->result();
$this->data['testimony'] = $this->post_model->getPostsByPageId(30044, 5)->get()->result();
$this->data['sermon'] = $this->post_model->getPostsByPageId(30042, 5)->get()->result();
$this->data['worship'] = $this->post_model->getPostsByPageId(30043, 5)->get()->result();
$this->data['articles'] = getNewsArticleURL($this->post_model->getPostsByCategoryId(getChildrenByParentId(10000), 8)->get()->result());
$this->data['columns'] = getNewsArticleURL($this->post_model->getPostsByCategoryId(getChildrenByParentId(30011), 4)->get()->result());
$this->load->view('mobile/home', $this->data);
}
}

View File

@@ -0,0 +1,15 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Kids extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{ }
}

View File

@@ -0,0 +1,28 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Mypage extends MY_Controller
{
public function __construct()
{
parent::__construct();
if(!getSessionUser()->is) {
header('location:/');
}
}
public function index() {
$this->bookmark();
}
public function bookmark() {
$this->load->view('templates/mypage/mypage-bookmark');
}
public function qna() {
$this->load->view('templates/mypage/mypage-qna');
}
}

233
application/controllers/News.php Executable file
View File

@@ -0,0 +1,233 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class News extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
if ($this->isMobile()) {
$this->mobile();
} else {
$this->desktop();
}
}
private function desktop()
{
$section = $this->uri->segment(2);
$article = $this->uri->segment(3);
$this->data['sectionCategory'] = NEWS_SECTION_CATEGORY;
if (is_numeric($article)) {
$this->article($article);
$this->load->view('templates/news/news-article', $this->data);
} elseif ($section) {
$this->section();
$this->load->view('templates/news/news-section', $this->data);
} else {
$this->main();
$this->load->view('templates/news/news-home', $this->data);
}
}
private function mobile()
{
$section = $this->uri->segment(2);
$article = $this->uri->segment(3);
$this->data['sectionCategory'] = NEWS_SECTION_CATEGORY;
if (is_numeric($article)) {
$this->article($article);
$this->load->view('mobile/news/news-article', $this->data);
} elseif ($section) {
list($section, $children) = $this->getSectionSegments();
$this->data['posts'] = $this->getSectionPosts($children, 26);
getNewsArticleURL($this->data['posts'], $section);
$this->load->library('search');
$this->data['relatedNews'] = $this->search->searchByPostTitle($this->data['posts'][0]->postTitle, 2, [$this->data['posts'][0]->postSeq]);
getNewsArticleURL($this->data['relatedNews'], $section);
$this->data['hotNews'] = getNewsArticleURL($this->post_model->getPostsRankingByRankTypeAndCategoryId('V', $children, 27)->get()->result());
$this->data['photoNews'] = $this->post_model->getPostsRankingByRankTypeAndCategoryId('V', 30024, 3)->get()->result();
$this->load->view('mobile/news/news-section', $this->data);
} else {
$this->main();
$this->load->view('mobile/news/news-home', $this->data);
}
}
public function main()
{
$this->data['posts'] = [];
$this->data['sortByPosted'] = [];
$this->load->model('category_model');
$this->load->model('post_model');
$sectionCategories = $this->category_model->getAll(array_values(NEWS_SECTION_CATEGORY));
foreach (NEWS_SECTION_CATEGORY as $sn => $sc) {
$children = getChildrenByParentId($sc);
$this->data['posts'][$sn] = $this->post_model->getPostsByCategoryId($children, 7)->get()->result();
$contentSection = ($sn == 'opinions' ? 'channel' : 'news');
$sectionCategory = ['title' => '', 'id' => 0];
foreach ($sectionCategories as $s) {
if ($s->categoryID == $sc) {
$sectionCategory['title'] = $s->categoryTitle;
$sectionCategory['id'] = $s->categoryID;
}
}
foreach ($this->data['posts'][$sn] as $post) {
$post->sectionCategory = $sectionCategory;
$post->articleURL = '/' . $contentSection . '/' . ($sn == 'opinions' ? $post->pageID : $sn) . '/' . $post->postSeq;
!count($this->data['sortByPosted']) ? (function () use ($post) {
array_push($this->data['sortByPosted'], $post);
})() : (function () use ($post) {
array_push($this->data['sortByPosted'], $post);
if (strtotime($post->datePosted) > strtotime($this->data['sortByPosted'][0]->datePosted)) {
$l = array_shift($this->data['sortByPosted']);
array_push($this->data['sortByPosted'], $l);
}
})();
}
}
$this->data['hotNews'] = getNewsArticleURL($this->post_model->getPostsRankingByRankTypeAndCategoryId(
'V',
getChildrenByParentId(10000),
27
)->get()->result());
$this->data['photoNews'] = $this->post_model->getPostsRankingByRankTypeAndCategoryId('V', 30024, 3)->get()->result();
$this->data['prayNews'] = $this->post_model->getPostsByPageId(30009, 4)->get()->result();
foreach ($this->data as $k => $v) {
getPostsImageUrl($this->data[$k]);
}
}
public function section()
{
list($section, $children) = $this->getSectionSegments();
$this->pagination->initialize([
'base_url' => BASE_URL . '/news/' . $section,
'total_rows' => $this->post_model->getCountPostsByCategoryId($children),
'per_page' => 10,
'full_tag_open' => '',
'full_tag_close' => '',
'num_tag_open' => '',
'num_tag_close' => '',
'cur_tag_open' => '<a class="current">',
'cur_tag_close' => '</a>',
'next_tag_open' => '',
'next_tag_close' => '',
'prev_tag_open' => '',
'prev_tag_close' => '',
'next_link' => '',
'prev_link' => '',
'last_link' => '<img src="' . THEME_FOLDER . '/img/mypage_arrow_right.gif">',
'first_link' => '<img src="' . THEME_FOLDER . '/img/mypage_arrow_left.gif">',
'prefix' => 'page-'
]);
$this->data['posts'] = $this->getSectionPosts($children, 17);
getNewsArticleURL($this->data['posts'], $section);
$this->data['sortByPosted'] = [];
array_push($this->data['sortByPosted'], $this->data['posts'][0]);
$this->data['sortByPosted'] = array_merge($this->data['sortByPosted'], array_slice($this->data['posts'], 3, 6));
$this->data['posts1'] = array_slice($this->data['posts'], 1, 3);
$this->data['posts2'] = array_slice($this->data['posts'], 9);
$this->data['posts'] = array_merge($this->data['posts1'], $this->data['posts2']);
unset($this->data['posts1'], $this->data['posts2']);
$this->data['hotNews'] = getNewsArticleURL($this->post_model->getPostsRankingByRankTypeAndCategoryId('V', $children, 27)->get()->result());
$this->data['photoNews'] = $this->post_model->getPostsRankingByRankTypeAndCategoryId('V', 30024, 3)->get()->result();
$this->data['prayNews'] = $this->post_model->getPostsByPageId(30009, 4)->get()->result();
foreach ($this->data as $k => $v) {
getPostsImageUrl($this->data[$k]);
}
}
private function getSectionSegments()
{
$this->load->model('post_model');
$section = $this->uri->segment(2);
$this->load->library('pagination');
$children = getChildrenByParentId(NEWS_SECTION_CATEGORY[$section]);
array_push($children, NEWS_SECTION_CATEGORY[$section]);
return [$section, $children];
}
private function getSectionPosts($children, $rowCount)
{
return $this->post_model->getPostsByCategoryId($children, $rowCount, ($this->uri->segment(3) ? substr($this->uri->segment(3), 5) : 0))->get()->result();
}
public function article($article)
{
$this->load->model('comment_model');
$section = $this->uri->segment(2);
$this->data['comments'] = $this->comment_model->getByPostId($article)
->where('parentID', 0)
->join('cm_user', 'cm_comment.userID=cm_user.userID', 'left')
->select('*, 0 like, 0 bad, 0 replies')->get()->result();
$this->comment_model->getRepliesAndRankings($this->data['comments']);
$this->data['page'] = $this->post_model->getPost($article);
$this->data['column'] = $this->getColumn();
// $this->data['focus'] = $this->post_model->getPostsByPageId(30, 0, 0, 10000, [$this->data['page']['postID']]);
$this->data['page']->parentTitle = '';
if ($this->data['page']->parentID != 0 && $this->data['page']->parentID % 10000 !== 0) {
$parentCategory = $this->category_model->getOne($this->data['page']->parentID);
if ($parentCategory) {
$this->data['page']->parentTitle = $parentCategory->categoryTitle;
}
}
$this->data['reporter'] = $this->getReporterByUserId($this->data['page']->userID);
$this->data['ranking'] = $this->getRankingByPostId($this->data['page']->postSeq);
$this->data['hotNews'] = getNewsArticleURL($this->post_model->getPostsRankingByRankTypeAndCategoryId('V', getChildrenByParentId(NEWS_SECTION_CATEGORY[$section]), 27)->get()->result());
$this->data['photoNews'] = $this->post_model
->getPostsRankingByRankTypeAndCategoryId('V', 30024, 3)->get()->result();
$this->data['prayNews'] = $this->post_model->getPostsByPageId(30009, 4)->get()->result();
$this->load->library('search');
$this->data['relatedNews'] = $this->search->searchByPostTitle($this->data['page']->postTitle, 5, [$this->data['page']->postSeq]);
getNewsArticleURL($this->data['relatedNews'], $section);
foreach ($this->data as $k => $v) {
getPostsImageUrl($this->data[$k]);
}
}
private function getColumn($limit = 2, $offset = 0)
{
return $this->db->limit($limit)->join('cm_user u', 'u.userID = p.userID', 'left')
->join('cm_user_group g', 'u.groupID = g.groupID', 'left')->where('g.groupID', 7)
->order_by('datePosted', 'desc')->get('cm_post p')->result();
}
private function getReporterByUserId($userID)
{
return $this->db->from('cm_user u')
->join('cm_user_press up', 'u.userID=up.userID', 'left')
->join('cm_press p', 'up.pressID=p.pressID', 'left')
->where('u.userID', $userID)
->select('u.*, p.press_name, p.logo_img, p.homepage')
->get()->row();
}
public function getRankingByPostId($postId)
{
$ranking = ['V' => 0, 'R' => 0, 'L' => 0];
$rows = $this->db->where('postID', $postId)
->get('cm_post_ranking')->result();
foreach ($rows as $row) {
foreach ($ranking as $k => $r) {
if ($row->title == $k) {
$ranking[$k] = $row->rating;
}
}
}
return $ranking;
}
}

169
application/controllers/Pray.php Executable file
View File

@@ -0,0 +1,169 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Pray extends MY_Controller
{
private $sections;
public function __construct()
{
parent::__construct();
$this->load->model('pray_model');
}
public function index()
{
if ($this->isMobile()) {
$this->mobile();
} else {
$this->desktop();
}
}
private function desktop()
{
$section = $this->uri->segment(2);
$article = $this->uri->segment(3);
$this->data['sectionCategory'] = NEWS_SECTION_CATEGORY;
if (is_numeric($article)) {
$this->article($article);
$this->load->view('templates/pray/pray-article', $this->data);
} elseif ($section) {
if ($this->section()) {
$this->load->view('templates/pray/pray-' . $section, $this->data);
} else {
$this->{$section}();
}
} else {
$this->main();
$this->load->view('templates/pray/pray-home', $this->data);
}
}
private function mobile()
{
$section = $this->uri->segment(2);
$article = $this->uri->segment(3);
if (is_numeric($article)) {
$this->load->view('mobile/pray/pray-article', $this->data);
} else if ($article) {
$this->load->view('mobile/pray/pray-editor', $this->data);
} elseif ($section) {
$this->load->view('mobile/pray/pray-section', $this->data);
} else {
$this->load->view('mobile/pray/pray-home', $this->data);
}
}
private function main()
{
$this->setSections();
$this->data['prayon'] = $this->pray_model->getPaging(15, 0)
->get()->result();
$this->data['posts'] = $this->post_model->getPostsByCategoryId(
array_column($this->category_model->getCategoriesBySlug([
'vclip', 'together', 'story', 'art'
])->get()->result(), 'categoryID'),
5
)->get()->result();
$this->data['featured'] = $this->data['posts'][0];
foreach ($this->data as $k => $v) {
getPostsImageUrl($this->data[$k]);
}
}
private function getCategoryIdBySlug($slug)
{
return $this->category_model->getCategoriesBySlug($slug)->get()->row()->categoryID;
}
private function getPostsByCategorySlug($slug)
{
return $this->post_model->getPostsByCategoryId($this->getCategoryIdBySlug($slug), 20);
}
private function section()
{
$this->setSections();
foreach ($this->data as $k => $v) {
getPostsImageUrl($this->data[$k]);
}
if (isset($this->sections[$this->uri->segment(2)])) {
$this->data['posts'] = &$this->data[$this->uri->segment(2)];
return true;
}
}
private function article($article)
{
$this->load->model('comment_model');
$this->data['comments'] = $this->comment_model->getByPostId($article)
->where('parentID', 0)
->join('cm_user', 'cm_comment.userID=cm_user.userID', 'left')
->select('*, 0 like, 0 bad, 0 replies')->get()->result();
$this->comment_model->getRepliesAndRankings($this->data['comments']);
$this->data['post'] = $this->post_model->getPost($article);
foreach ($this->data as $k => $v) {
getPostsImageUrl($this->data[$k]);
}
}
private function setSections()
{
$this->sections = [
'prayon' => ['', function () {
$this->data['prayon'] = array_reverse($this->pray_model->getPaging(15, 0)->select('py.*, 0 bookmark, 0 like, 0 bad, 0 bookmarks')
->get()->result());
$this->pray_model->getBookmarksAndRankings($this->data['prayon']);
}],
'vclip' => ['vclip', function () {
$this->data['vclip'] = $this->getPostsByCategorySlug($this->sections['vclip'][0])
->join('cm_post_video v', 'p.postID=v.postID', 'left')
->join('cm_user u', 'p.userID=u.userID', 'left')
->select("if(u.nickname = '' or u.nickname is null, u.userName, u.nickName) as author")
->get()->result();
}],
'together' => ['together', function () {
$this->data['pages'] = [];
$this->data['together'] = $this->post_model->getPagePostsByCategoryId($this->getCategoryIdBySlug($this->sections['together'][0]), 29)
->join('cm_user u', 'p.userID=u.userID', 'left')
->select("*,if(u.nickname = '' or u.nickname is null, u.userName, u.nickName) as author, p.postID postSeq")
->get()->result();
}],
'story' => ['story', function () {
$this->data['story'] = $this->getPostsByCategorySlug($this->sections['story'][0])
->join('cm_user u', 'p.userID=u.userID', 'left')
->select("if(u.nickname = '' or u.nickname is null, u.userName, u.nickName) as author")
->get()->result();
}],
'art' => ['art', function () {
$this->data['art'] = $this->getPostsByCategorySlug($this->sections['art'][0])
->join('cm_user u', 'p.userID=u.userID', 'left')
->select("if(u.nickname = '' or u.nickname is null, u.userName, u.nickName) as author")->get()->result();
}]
];
foreach ($this->sections as $k => $s) {
$s[0] || $this->uri->segment(2) == $k ? $s[1]() : '';
}
}
public function rating()
{
$data = [
'prayID' => $this->input->post('prayId'),
'userID' => getSessionUser()->is ? getSessionUser()->userID : 0,
'title' => $this->input->post('title'),
'dateUpdated' => date('Y-m-d H:i:s')
];
if ($insertId = $this->pray_model->bookmark($data)) {
$this->response(array('code' => 200, 'rating' => 0));
// $this->response(array('code' => 200, 'rating' => $this->pray_model->getPrayRankingCountByTitle($data['prayID'], $data['title'])));
} else {
$this->response(array('code' => 500, 'error' => '서버오류가 발생했습니다'));
}
}
}

View File

@@ -0,0 +1,15 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Resource extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index() {
}
}

View File

@@ -0,0 +1,53 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
use GO\Scheduler;
use Aws\S3\S3Client;
class Schedule extends CI_Controller
{
public function __construct()
{
parent::__construct();
// if (!$this->input->is_cli_request()) {
// echo 'Not allowed';
// exit();
// }
}
public function index()
{
// Create a new scheduler
$scheduler = new Scheduler();
// ... configure the scheduled jobs (see below) ...
// Let the scheduler execute jobs which are due.
$scheduler->run();
}
public function aws() {
$this->load->database();
$query = $this->db->limit(1)->get('cm_post')->order_by('datePosted', 'desc')->result();
$s3 = new S3Client([
'version' => 'latest',
'region' => 'ap-northeast-2',
'credentials' => [
'key' => "AKIA2WGASVZ56VOBTZJE",
'secret' => "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",
]
]);
$result = $s3->putObject([
'Bucket' => 'elasticbeanstalk-ap-northeast-2-734843285115',
'Key' => $file_name,
'SourceFile' => BASEPATH ,
'ACL' => 'public-read'
]);
var_dump($result);
}
}

114
application/controllers/Share.php Executable file
View File

@@ -0,0 +1,114 @@
<?php
class Share extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
// if (!$this->maintenanceMode) {
// $totSegments = $this->uri->total_segments();
// if (!is_numeric($this->uri->segment($totSegments))) {
// $pageURL = $this->uri->segment($totSegments);
// } elseif (is_numeric($this->uri->segment($totSegments))) {
// $pageURL = $this->uri->segment($totSegments - 1);
// }
// if ($pageURL == "") {
// $pageURL = "home";
// }
// $this->data['page'] = $this->cmap_page_model->getPage($pageURL);
// $this->data['posts'] = getPagePostsByCategoryId(getChildrenByParentId(30000), 15);
// $this->data['reads'] = $this->cmap_page_model->getPagePostByParentCategoryId(30000, 32, 0, 'V');
// $this->data['likes'] = $this->cmap_page_model->getPagePostByParentCategoryId(30000, 32, 0, 'L');
// if ($this->data['page']['pageTemplate'] != "") {
// $this->data['header'] = $this->load->view('templates/header', $this->data, true);
// $this->data['footer'] = $this->load->view('templates/footer', '', true);
// $this->load->view('templates/' . $this->data['page']['pageTemplate'], $this->data);
// } else {
// $this->error();
// }
// } else {
// $this->maintenance();
// }
}
public function save_comment()
{
$this->load->model('comment_model');
$this->comment_model->save([
'postID' => $this->input->post('postId'),
'userID' => $this->session->userdata('userID'),
'comment' => $this->input->post('comment'),
'datePosted' => date('Y-m-d H:i:s')
]);
}
public function reply_comment()
{
$this->load->model('comment_model');
$this->comment_model->save([
'postID' => $this->input->post('postId'),
'userID' => $this->session->userdata('userID'),
'parentID' => $this->input->post('parentId'),
'comment' => $this->input->post('comment'),
'datePosted' => date('Y-m-d H:i:s')
]);
}
public function rating_comment()
{
if (getSessionUser()->is) {
$this->load->model('comment_model');
$this->comment_model->rating([
'userID' => getSessionUser()->userID,
'commentID' => $this->input->post('commentID'),
'title' => $this->input->post('like') ? 1 : 2
]);
}else {
$this->response(array('code' => 405, 'error' => '로그인 하세요'));
}
}
public function delete_comment()
{
$this->load->model('comment_model');
if (getSessionUser()->userID == $this->comment_model->getOne($this->input->post('commentID'))->userID) {
$this->comment_model->delete();
$this->response(array('code' => 200));
} else {
$this->response(array('code' => 405, 'error' => '잘못된 요청입니다.'));
}
}
public function update_comment()
{
$this->load->model('comment_model');
if (getSessionUser()->userID == $this->comment_model->getOne($this->input->post('commentID'))->userID) {
$this->comment_model->update([
'commentID' => $this->input->post('commentID'),
'comment' => $this->input->post('comment')
]);
$this->response(array('code' => 200));
} else {
$this->response(array('code' => 405, 'error' => '잘못된 요청입니다.'));
}
}
public function pray()
{
$this->load->model('pray_model');
$prayer = $this->input->post('prayer');
if($insertId = $this->pray_model->save([
'pray' => $prayer,
'userID' => getSessionUser()->is ? getSessionUser()->userID : 0,
'dateUpdated' => date('Y-m-d H:i:s')
])) {
$this->response(array('code' => 200, 'commentId' => $insertId));
}
}
}

135
application/controllers/User.php Executable file
View File

@@ -0,0 +1,135 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class User extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('user_model');
}
public function login()
{
$this->load->view('templates/others/login');
}
public function register($submit = '')
{
if ($submit) {
$this->load->model('user');
} else $this->load->view('templates/register/register');
}
public function mobile_auth()
{
$this->load->view('templates/others/mobile_auth');
}
public function mobile_auth_encode()
{
$this->load->library('mobileCertification');
$this->mobilecertification->mobile_auth_encode();
}
public function find($what)
{
$this->load->view('templates/others/find-' . $what);
}
public function auth($name = '')
{
$this->load->library('auth');
$this->auth->setIsRequest(true)->auth($name);
if ($this->auth->getResponse()) {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode($this->auth->getResponse()));
}
}
public function logout()
{
$this->load->library('session');
$data = array(
'userID' => '',
'userName' => '',
'is' => false,
);
$this->session->unset_userdata($data);
$this->session->sess_destroy();
header('location:'. $_SERVER['HTTP_REFERER']);
}
public function check_username($username)
{
log_message('info', 'checking username ====');
log_message('info', $username);
if (count($this->user_model->findByUserName($username)) == 0) {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode(array('code' => 200)));
} else {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode(array('code' => 404)));
}
}
public function check_email()
{
log_message('info', 'checking email ====');
log_message('info', $this->input->post('email'));
if (count($this->user_model->findByEmail($this->input->post('email'))) == 0) {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode(array('code' => 200)));
} else {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode(array('code' => 404)));
}
}
public function submit()
{
$params = [];
foreach (['userName', 'password', 'gender', 'birthday', 'birth_cal', 'email', 'mobile', 'church'] as $k) {
$params[$k] = $this->input->post($k);
}
$params['password'] = md5($params['password']);
if ($this->user_model->save([$params])) {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode(array('code' => 200)));
} else {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode(array('code' => 404)));
}
}
public function oauth($sns = '')
{
$this->load->library('auth');
$sns = $sns ? $sns : $this->uri->segment(2);
$this->auth->auth($sns);
}
public function check_session() {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode(array('code' => (getSessionUser()->is? 200: 400))));
}
}

View File

@@ -0,0 +1,142 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Webtoon extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('post_model');
}
public function index()
{
if ($this->isMobile()) {
$this->mobile();
} else {
$this->desktop();
}
}
public function desktop()
{
$episodeURL = $this->uri->segment(2);
$seriesURL = $this->uri->segment(3);
if (is_numeric($episodeURL)) {
$this->data['page'] = $this->post_model->getPost($episodeURL);
if ($this->data['page']->postID != "") {
$this->data['page']->postContentHTML = $this->getJsonToPostContent($this->data['page']->postContent);
$this->data['hotToons'] = $this->getPostsRankingByRankTypeAndCategoryId('V', getChildrenByParentId(20000), 5);
getResultWithAuthor($this->data['hotToons']);
$this->data['episodes'] = $this->post_model
->getPagePostsByPageId($this->data['page']->pageID, 100)
->order_by('p.postID', 'asc')->get()->result();
$this->load->view('templates/webtoon/webtoon-article', $this->data);
} else {
$this->error();
}
} elseif ($seriesURL) {
$this->load->model('page_model');
$this->data['seriesURL'] = $seriesURL;
$this->data['series'] = $this->post_model->getPostsRatingByPageId($seriesURL, 100)->order_by('dateUpdated', 'desc')->get()->result();
$this->data['page'] = $this->page_model->getOne($seriesURL);
if (count($this->data['series'])) {
$this->list();
$this->load->view('templates/webtoon/webtoon-list', $this->data);
} else {
$this->error();
}
} elseif ($this->uri->segment(2) == 'series') {
$this->series();
$this->load->view('templates/webtoon/webtoon-series', $this->data);
} else {
$this->main();
foreach ($this->data as $k => $v) {
getPostsImageUrl($this->data[$k]);
}
$this->load->view('templates/webtoon/webtoon-home', $this->data);
}
}
private function getPostsRankingByRankTypeAndCategoryId($rankType, $categoryId, $limit)
{
return $this->post_model->getPostsRankingByRankTypeAndCategoryId($rankType, $categoryId, $limit)
->join('cm_page_content co', 'pp.pageID=co.pageID', 'left')->get()->result();
}
private function getPostsByCategoryId($categories, $limit, $offset = 0)
{
return $this->post_model->getPostsByCategoryId($categories, $limit, $offset)
->join('cm_page_content co', 'pp.pageID=co.pageID', 'left')->get()->result();
}
public function main()
{
$this->data['featureToons'] = $this->getPostsRankingByRankTypeAndCategoryId('R', 20008, 8);
getResultWithAuthor($this->data['featureToons']);
foreach (['hotToons' => [20009, 8], 'funToons' => [20010, 3], 'touchedToons' => [20011, 3]] as $categoryName => list($categoryID, $rowCount)) {
$this->data[$categoryName] = [
'updates' => $this->getPostsByCategoryId($categoryID, $rowCount),
'reads' => $this->getPostsRankingByRankTypeAndCategoryId('V', $categoryID, $rowCount),
'recomm' => $this->getPostsRankingByRankTypeAndCategoryId('R', $categoryID, $rowCount)
];
foreach($this->data[$categoryName] as $k=>$v) {
getPostsImageUrl($this->data[$categoryName][$k]);
}
getResultWithAuthor($this->data[$categoryName]['updates']);
getResultWithAuthor($this->data[$categoryName]['reads']);
getResultWithAuthor($this->data[$categoryName]['recomm']);
shuffle($this->data[$categoryName]['reads']);
shuffle($this->data[$categoryName]['recomm']);
}
$this->data['ratingToons'] = $this->getPostsRankingByRankTypeAndCategoryId('V', getChildrenByParentId(20000), 8);
getResultWithAuthor($this->data['ratingToons']);
$this->data['recommendChannel'] = $this->post_model->getPagePostsByPageId(getChildrenByParentId(30000), 8)->get()->result();
}
public function series()
{
$recentToons = $this->post_model->getPagePostsByCategoryId(getChildrenByParentId(20000), 6)->join('cm_page_attributes pa', 'pp.pageID = pa.pageID', 'left')->get()->result();
getResultWithAuthor($recentToons);
$this->data['daynames'] = ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'];
$this->data['todayToons'] = $recentToons;
foreach (['recomToons' => [20013, 6], 'faithToons' => [20014, 3], 'wordToons' => [20015, 3]] as $title => list($categoryID, $rowCount)) {
$this->data[$title] = [
'updates' => $this->getPostsByCategoryId($categoryID, $rowCount),
'reads' => $this->getPostsRankingByRankTypeAndCategoryId('V', $categoryID, $rowCount),
'recomm' => $this->getPostsRankingByRankTypeAndCategoryId('R', $categoryID, $rowCount),
];
getResultWithAuthor($this->data[$title]['updates']);
getResultWithAuthor($this->data[$title]['reads']);
getResultWithAuthor($this->data[$title]['recomm']);
shuffle($this->data[$title]['recomm']);
}
$this->data['hotToons'] = $this->getPostsRankingByRankTypeAndCategoryId('V', getChildrenByParentId(20000), 9);
$this->data['recommLife'] = $this->getPostsRankingByRankTypeAndCategoryId('R', getChildrenByParentId(30000), 3);
getResultWithAuthor($this->data['hotToons']);
}
public function list()
{
$this->data['hotToons'] = $this->getPostsRankingByRankTypeAndCategoryId('V', getChildrenByParentId(20000), 9);
$this->data['recommLife'] = $this->getPostsRankingByRankTypeAndCategoryId('R', getChildrenByParentId(30000), 3);
getResultWithAuthor($this->data['hotToons']);
}
private function getJsonToPostContent($content)
{
$html = '';
$c = json_decode($content);
foreach ($c as $url) {
$html .= '<img src="http://crossmap.co.kr' . $url . '">';
}
return $html;
}
}

View File

@@ -0,0 +1,15 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Worship extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{ }
}

View File

@@ -0,0 +1,184 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Admin extends CI_Controller
{
public function __construct()
{
parent::__construct();
define("HOOSK_ADMIN", 1);
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'form'));
$this->load->library('session');
$this->load->model('Hoosk_model');
define('LANG', $this->Hoosk_model->getLang());
$this->lang->load('admin', LANG);
define('SITE_NAME', $this->Hoosk_model->getSiteName());
define('THEME', $this->Hoosk_model->getTheme());
define('THEME_FOLDER', BASE_URL . '/theme/' . THEME);
}
public function index()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->data['current'] = $this->uri->segment(2);
$this->data['recenltyUpdated'] = $this->Hoosk_model->getUpdatedPages();
if (RSS_FEED) {
$this->load->library('rssparser');
$this->rssparser->set_feed_url('http://hoosk.org/feed/rss');
$this->rssparser->set_cache_life(30);
$this->data['hooskFeed'] = $this->rssparser->getFeed(3);
}
$this->data['maintenaceActive'] = $this->Hoosk_model->checkMaintenance();
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/home', $this->data);
}
public function upload()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$attachment = $this->input->post('attachment');
$uploadedFile = $_FILES['attachment']['tmp_name']['file'];
$path = $_SERVER["DOCUMENT_ROOT"] . '/images';
$url = BASE_URL . '/images';
// create an image name
$fileName = $attachment['name'];
// upload the image
move_uploaded_file($uploadedFile, $path . '/' . $fileName);
$this->output->set_output(
json_encode(array('file' => array(
'url' => $url . '/' . $fileName,
'filename' => $fileName
))),
200,
array('Content-Type' => 'application/json')
);
}
public function login()
{
$this->data['header'] = $this->load->view('admin/headerlog', '', true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/login', $this->data);
}
public function loginCheck()
{
$username = $this->input->post('username');
$password = md5($this->input->post('password') . SALT);
$result = $this->Hoosk_model->login($username, $password);
if ($result) {
redirect(BASE_URL . '/admin', 'refresh');
} else {
$this->data['error'] = "1";
$this->login();
}
}
public function ajaxLogin()
{
$username = $this->input->post('username');
$password = md5($this->input->post('password') . SALT);
$result = $this->Hoosk_model->login($username, $password);
if ($result) {
echo 1;
} else {
echo 0;
}
}
public function logout()
{
$data = array(
'userID' => '',
'userName' => '',
'logged_in' => false,
);
$this->session->unset_userdata($data);
$this->session->sess_destroy();
$this->login();
}
public function settings()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->helper('directory');
$this->data['themesdir'] = directory_map($_SERVER["DOCUMENT_ROOT"] . '/theme/', 1);
$this->data['langdir'] = directory_map(APPPATH . '/language/', 1);
$this->data['settings'] = $this->Hoosk_model->getSettings();
$this->data['current'] = $this->uri->segment(2);
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/settings', $this->data);
}
public function updateSettings()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$path_upload = $_SERVER["DOCUMENT_ROOT"] . '/uploads/';
$path_images = $_SERVER["DOCUMENT_ROOT"] . '/images/';
if ($this->input->post('siteLogo') != "") {
rename($path_upload . $this->input->post('siteLogo'), $path_images . $this->input->post('siteLogo'));
}
if ($this->input->post('siteFavicon') != "") {
rename($path_upload . $this->input->post('siteFavicon'), $path_images . $this->input->post('siteFavicon'));
}
$this->Hoosk_model->updateSettings();
redirect(BASE_URL . '/admin', 'refresh');
}
public function uploadLogo()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$this->load->library('upload', $config);
foreach ($_FILES as $key => $value) {
if (!$this->upload->do_upload($key)) {
$error = array('error' => $this->upload->display_errors());
echo 0;
} else {
echo '"' . $this->upload->data('file_name') . '"';
}
}
}
public function social()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->data['social'] = $this->Hoosk_model->getSocial();
$this->data['current'] = $this->uri->segment(2);
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/social', $this->data);
}
public function updateSocial()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->Hoosk_model->updateSocial();
redirect(BASE_URL . '/admin', 'refresh');
}
public function checkSession()
{
if (!$this->session->userdata('logged_in')) {
echo 0;
} else {
echo 1;
}
}
public function complete()
{
unlink(FCPATH . "install/hoosk.sql");
unlink(FCPATH . "install/index.php");
redirect(BASE_URL . '/admin', 'refresh');
}
}

View File

@@ -0,0 +1,118 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Categories extends CI_Controller
{
function __construct()
{
parent::__construct();
define("HOOSK_ADMIN", 1);
$this->load->model('Cmap_model');
$this->load->helper(array('admincontrol', 'url', 'file', 'form'));
$this->load->library('session');
define('LANG', $this->Cmap_model->getLang());
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
define('SITE_NAME', $this->Cmap_model->getSiteName());
define('THEME', $this->Cmap_model->getTheme());
define('THEME_FOLDER', BASE_URL . '/theme/' . THEME);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
}
public function index()
{
$this->load->library('pagination');
$result_per_page = 15; // the number of result per page
$config['base_url'] = BASE_URL . '/admin/posts/categories/';
$config['total_rows'] = $this->Cmap_model->countCategories();
$config['uri_segment'] = 4;
$config['per_page'] = $result_per_page;
$config['last_link'] = false;
$config['first_link'] = false;
$this->pagination->initialize($config);
//Get categorys from database
$this->data['categories'] = $this->Cmap_model->getCategoriesAll($result_per_page, $this->uri->segment(4));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/post_categories', $this->data);
}
public function addCategory()
{
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/post_category_new', $this->data);
}
public function confirm()
{
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
$this->form_validation->set_rules('categorySlug', 'category slug', 'trim|alpha_dash|required|is_unique[cm_category.categorySlug]');
$this->form_validation->set_rules('categoryTitle', 'category title', 'trim|required');
if ($this->form_validation->run() == FALSE) {
//Validation failed
$this->addCategory();
} else {
//Validation passed
//Add the category
$this->Cmap_model->createCategory();
//Return to category list
redirect(BASE_URL . '/admin/posts/categories', 'refresh');
}
}
public function editCategory()
{
//Get category details from database
$this->data['category'] = $this->Cmap_model->getCategory($this->uri->segment(5));
$this->data['categories'] = $this->Cmap_model->getCategories();
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/post_category_edit', $this->data);
}
public function edited()
{
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
$this->form_validation->set_rules('categorySlug', 'category slug', 'trim|alpha_dash|required|is_unique[cm_category.categorySlug.categoryID.' . $this->uri->segment(5) . ']');
$this->form_validation->set_rules('categoryTitle', 'category title', 'trim|required');
if ($this->form_validation->run() == FALSE) {
//Validation failed
$this->editCategory();
} else {
//Validation passed
//Update the category
$this->Cmap_model->updateCategory($this->uri->segment(5));
//Return to category list
redirect(BASE_URL . '/admin/posts/categories', 'refresh');
}
}
public function categorySearch()
{
$this->Cmap_model->categorySearch($this->input->post('term'));
}
function delete()
{
if ($this->input->post('deleteid')) :
$this->Cmap_model->removeCategory($this->input->post('deleteid'));
redirect(BASE_URL . '/admin/posts/categories');
else :
$this->data['form'] = $this->Cmap_model->getCategory($this->uri->segment(5));
$this->load->view('admin/post_category_delete.php', $this->data);
endif;
}
}

View File

@@ -0,0 +1,54 @@
<?php
class Comments extends MY_Controller {
public function __construct()
{
define("HOOSK_ADMIN", 1);
parent::__construct();
$this->load->model('comment_model');
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'file', 'form'));
$this->load->library('session');
define('LANG', $this->data['settings']->siteLang);
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->helper('general');
}
public function index()
{
$this->load->library('pagination');
$result_per_page = 15; // the number of result per page
$config['base_url'] = BASE_URL . '/admin/comments/';
$config['total_rows'] = $this->comment_model->getCountPaging();
$config['per_page'] = $result_per_page;
$config['last_link'] = false;
$config['first_link'] = false;
$config['suffix'] = '?term=' . getSearchTerm();
$this->pagination->initialize($config);
//Get posts from database
$this->data['comments'] = $this->comment_model->getPaging($result_per_page, $this->uri->segment(3))
->get()->result();
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/comments', $this->data);
}
public function delete()
{
if ($this->input->post('deleteid')) :
$this->comment_model->delete($this->input->post('deleteid'));
redirect(BASE_URL . '/admin/comments');
else :
$this->data['form'] = [(array)$this->comment_model->getOne($this->uri->segment(4))];
$this->load->view('admin/comment_delete.php', $this->data);
endif;
}
}

View File

@@ -0,0 +1,55 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Data extends CI_Controller {
function __construct()
{
parent::__construct();
define("HOOSK_ADMIN",1);
$this->load->model('Cmap_model');
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'file', 'form'));
$this->load->library('session');
define ('LANG', $this->Cmap_model->getLang());
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
define ('SITE_NAME', $this->Cmap_model->getSiteName());
define('THEME', $this->Cmap_model->getTheme());
define ('THEME_FOLDER', BASE_URL.'/theme/'.THEME);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->library('cacher');
}
public function index()
{
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$source = $this->uri->segment(3);
$section = $this->uri->segment(4);
if($section) {
echo json_encode($this->cacher->{$source}($section));
}else {
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/data_'. $source, $this->data);
}
}
public function post()
{
$source = $this->uri->segment(3);
$section = $this->uri->segment(4);
$articleID = $this->uri->segment(5);
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
if($articleID) {
$this->data['article'] = $this->cacher->{$source}($section)[$articleID-1];
$this->data['article'] = array_merge($this->data['article'], $this->cacher->{$source}($section, $this->data['article']['url'])[0]);
$this->load->view('admin/data_post', $this->data);
}else {
$this->load->view('admin/data_'. $source, $this->data);
}
}
}

View File

@@ -0,0 +1,122 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Navigation extends CI_Controller {
function __construct()
{
parent::__construct();
define("HOOSK_ADMIN",1);
$this->load->model('Hoosk_model');
$this->load->helper(array('admincontrol', 'url', 'form'));
$this->load->library('session');
define ('LANG', $this->Hoosk_model->getLang());
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
define ('SITE_NAME', $this->Hoosk_model->getSiteName());
define('THEME', $this->Hoosk_model->getTheme());
define ('THEME_FOLDER', BASE_URL.'/theme/'.THEME);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
}
public function index()
{
$this->load->library('pagination');
$result_per_page =15; // the number of result per page
$config['base_url'] = BASE_URL. '/admin/navigation/';
$config['total_rows'] = $this->Hoosk_model->countNavigation();
$config['per_page'] = $result_per_page;
$this->pagination->initialize($config);
//Get pages from database
$this->data['nav'] = $this->Hoosk_model->getAllNav($result_per_page, $this->uri->segment(3));
$this->load->helper('form');
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/navigation', $this->data);
}
public function newNav()
{
//Get pages from database
$this->data['pages'] = $this->Hoosk_model->getPagesAll();
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/nav_new', $this->data);
}
public function editNav()
{
//Get pages from database
$this->data['pages'] = $this->Hoosk_model->getPagesAll();
//Get navigation from database
$this->data['nav'] = $this->Hoosk_model->getNav($this->uri->segment(4));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/nav_edit', $this->data);
}
public function navAdd()
{
//Get navigation from database
$this->data['page'] = $this->Hoosk_model->getPageNav($this->uri->segment(3));
//Load the view
$this->load->view('admin/nav_add', $this->data);
}
public function insert()
{
//Load the form validation library
$this->load->library('form_validation');
$this->form_validation->set_rules('navSlug', 'nav slug', 'trim|alpha_dash|required|max_length[10]|is_unique[cm_navigation.navSlug]');
$this->form_validation->set_rules('navTitle', 'navigation title', 'trim|required');
if($this->form_validation->run() == FALSE) {
//Validation failed
$this->newNav();
} else {
//Validation passed
$this->Hoosk_model->insertNav();
//Return to navigation list
redirect(BASE_URL.'/admin/navigation', 'refresh');
}
}
public function update()
{
//Load the form validation library
$this->load->library('form_validation');
$this->form_validation->set_rules('navTitle', 'navigation title', 'trim|required');
if($this->form_validation->run() == FALSE) {
//Validation failed
$this->editNav();
} else {
//Validation passed
$this->Hoosk_model->updateNav($this->uri->segment(4));
//Return to navigation list
redirect(BASE_URL.'/admin/navigation', 'refresh');
}
}
function deleteNav()
{
if($this->input->post('deleteid')):
$this->Hoosk_model->removeNav($this->input->post('deleteid'));
redirect(BASE_URL.'/admin/navigation');
else:
$this->data['form']=$this->Hoosk_model->getNav($this->uri->segment(4));
$this->load->view('admin/nav_delete.php', $this->data );
endif;
}
}

View File

@@ -0,0 +1,147 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Pages extends CI_Controller {
function __construct()
{
parent::__construct();
define("HOOSK_ADMIN",1);
$this->load->model('Cmap_model');
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'file', 'form'));
$this->load->library('session');
define ('LANG', $this->Cmap_model->getLang());
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
define ('SITE_NAME', $this->Cmap_model->getSiteName());
define('THEME', $this->Cmap_model->getTheme());
define ('THEME_FOLDER', BASE_URL.'/theme/'.THEME);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
}
public function index()
{
$this->load->library('pagination');
$result_per_page =15; // the number of result per page
$config['base_url'] = BASE_URL. '/admin/pages/';
$config['total_rows'] = $this->Cmap_model->countPages();
$config['per_page'] = $result_per_page;
$config['last_link'] = false;
$config['first_link'] = false;
$this->pagination->initialize($config);
//Get pages from database
$this->data['pages'] = $this->Cmap_model->getPages($result_per_page, $this->uri->segment(3));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/pages', $this->data);
}
public function addPage()
{
//Load the view
$this->data['templates'] = get_filenames('theme/'.THEME.'/templates');
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/page_new', $this->data);
}
public function confirm()
{
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
$this->form_validation->set_rules('pageURL', 'page URL', 'trim|alpha_dash|required|is_unique[cm_page_attributes.pageURL]');
$this->form_validation->set_rules('pageTitle', 'page title', 'trim|required');
$this->form_validation->set_rules('navTitle', 'navigation title', 'trim|required');
if($this->form_validation->run() == FALSE) {
//Validation failed
$this->addPage();
} else {
//Validation passed
//Add the page
$this->load->library('Sioen');
$this->Cmap_model->createPage();
//Return to page list
redirect(BASE_URL.'/admin/pages', 'refresh');
}
}
public function editPage()
{
//Get page details from database
$this->data['pages'] = $this->Cmap_model->getPage($this->uri->segment(4));
$this->data['categories'] = $this->Cmap_model->getCategories();
//Load the view
$this->data['templates'] = get_filenames('theme/'.THEME.'/templates');
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/page_edit', $this->data);
}
public function edited()
{
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
if ($this->uri->segment(4) != 1){
$this->form_validation->set_rules('pageURL', 'page URL', 'trim|alpha_dash|required|is_unique[cm_page_attributes.pageURL.pageID.'.$this->uri->segment(4).']');
}
$this->form_validation->set_rules('pageTitle', 'page title', 'trim|required');
$this->form_validation->set_rules('navTitle', 'navigation title', 'trim|required');
if($this->form_validation->run() == FALSE) {
//Validation failed
$this->editPage();
} else {
//Validation passed
//Update the page
$this->load->library('Sioen');
$this->Cmap_model->updatePage($this->uri->segment(4));
//Return to page list
redirect(BASE_URL.'/admin/pages', 'refresh');
}
}
public function jumbo()
{
//Get page details from database
$this->data['pages'] = $this->Cmap_model->getPage($this->uri->segment(4));
$this->data['slides'] = $this->Cmap_model->getPageBanners($this->uri->segment(4));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/jumbotron_edit', $this->data);
}
public function jumboAdd()
{
$this->load->library('Sioen');
$this->Cmap_model->updateJumbotron($this->uri->segment(4));
redirect(BASE_URL.'/admin/pages', 'refresh');
}
function delete()
{
if($this->input->post('deleteid')):
$this->Cmap_model->removePage($this->input->post('deleteid'));
redirect('/admin/pages');
else:
$this->data['form']=$this->Cmap_model->getPage($this->uri->segment(4));
$this->load->view('admin/page_delete.php', $this->data );
endif;
}
function pageSearch()
{
$this->Cmap_model->pageSearch($this->input->post('term'));
}
}

View File

@@ -0,0 +1,218 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Posts extends MY_Controller
{
public function __construct()
{
define("HOOSK_ADMIN", 1);
parent::__construct();
$this->load->model('Cmap_model');
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'file', 'form'));
$this->load->library('session');
define('LANG', $this->data['settings']->siteLang);
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->helper('general');
}
public function index()
{
$this->load->library('pagination');
$result_per_page = 15; // the number of result per page
$config['base_url'] = BASE_URL . '/admin/posts/';
$config['total_rows'] = $this->Cmap_model->countPosts();
$config['per_page'] = $result_per_page;
$config['last_link'] = false;
$config['first_link'] = false;
$config['suffix'] = '?term=' . getSearchTerm();
$this->pagination->initialize($config);
//Get posts from database
$this->data['posts'] = $this->post->getPosts($result_per_page, $this->uri->segment(3))
->select("p.*, if(u.userName = '', if(u.nickname='', u.userID, u.nickname), u.userName) userName, '' as categoryTitle, c.categorySlug, '' as pageTitle")->get()->result_array();
$this->category->getTableCategoryTitle($this->data['posts']);
$this->page->getTablePageTitle($this->data['posts']);
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/posts', $this->data);
}
public function addPost()
{
$this->data['categories'] = array_merge([['categoryID' => 0, 'categoryTitle' => 'Select category']], $this->Cmap_model->getCategories());
$this->data['pages'] = array_merge([['pageID' => 0, 'pageTitle' => 'Select page']], $this->Cmap_model->getPagesAll());
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/post_new', $this->data);
}
public function confirm()
{
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
// $this->form_validation->set_rules('postURL', 'post URL', 'trim|alpha_dash|required|is_unique[cm_post.postURL]');
$this->form_validation->set_rules('postTitle', 'post title', 'trim|required');
$this->form_validation->set_rules('postExcerpt', 'post excerpt', 'trim|required');
if ($this->form_validation->run() == false) {
//Validation failed
$this->addPost();
} else {
//Validation passed
if ($this->input->post('postImage')) {
//path to save the image
$path_upload = $_SERVER["DOCUMENT_ROOT"] . '/uploads/';
$path_images = $_SERVER["DOCUMENT_ROOT"] . '/images/' . date('Y/m/d/');
if (!file_exists($path_images) && !mkdir($path_images, 0775, true)) {
die('Failed to create folders...');
}
//moving temporary file to images folder
rename($path_upload . $this->input->post('postImage'), $path_images . $this->input->post('postImage'));
}
if ($this->input->post('postThumb') || $this->input->post('postImageExternal')) {
//path to save the image
$path_upload = $_SERVER["DOCUMENT_ROOT"] . '/uploads/';
$path_images = $_SERVER["DOCUMENT_ROOT"] . '/thumbs/' . date('Y/m/d/');
if (!file_exists($path_images) && !mkdir($path_images, 0775, true)) {
die('Failed to create folders...');
}
//moving temporary file to images folder
if ($this->input->post('postImageExternal')) {
$this->load->helper('string');
$_POST['postThumb'] = random_string() . '.' . pathinfo(parse_url($this->input->post('postImageExternal'))['path'], PATHINFO_EXTENSION);
file_put_contents(
$path_images . $this->input->post('postThumb'),
file_get_contents($this->input->post('postImageExternal'))
);
} else {
rename($path_upload . $this->input->post('postThumb'), $path_images . $this->input->post('postThumb'));
}
}
//Add the post
$this->load->library('Sioen');
$this->post->save();
//Return to post list
redirect(BASE_URL . '/admin/posts', 'refresh');
}
}
public function editPost()
{
$this->data['categories'] = array_merge([['categoryID' => 0, 'categoryTitle' => 'Select category']], $this->Cmap_model->getCategories());
$this->data['pages'] = array_merge([['pageID' => 0, 'pageTitle' => 'Select page']], $this->Cmap_model->getPagesAll());
//Get post details from database
$this->data['posts'] = $this->post->getPost($this->uri->segment(4))->get()->result_array();
$this->data['posts'][0]['postTag'] = json_encode($this->post->getPostTag($this->uri->segment(4))['tag']);
$this->category->getTableCategoryTitle($this->data['posts']);
$this->page->getTablePageTitle($this->data['posts']);
$this->load->model('user_model', 'user');
$this->data['users'] = $this->user->getAdminSiteUsers();
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->data['video'] = 0;
if ($video = $this->post->getPostVideo($this->uri->segment(4))) {
$this->data['video'] = 1;
$this->data['posts'][0]['postContentHTML'] .= $this->load->view('admin/youtube-iframe', $video, true);
}
$this->data['posts'][0]['articleURL'] = getPostLink($this->data['posts'][0], 'church');
$this->load->view('admin/post_edit', $this->data);
}
public function edited()
{
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
// $this->form_validation->set_rules('postURL', 'post URL', 'trim|alpha_dash|required|is_unique[cm_post.postURL.postID.'.$this->uri->segment(4).']');
$this->form_validation->set_rules('postTitle', 'post title', 'trim|required');
if ($this->form_validation->run() == false) {
//Validation failed
$this->editPost();
} else {
//Validation passed
if ($this->input->post('postImage')) {
//path to save the image
$path_upload = $_SERVER["DOCUMENT_ROOT"] . '/uploads/';
$path_images = $_SERVER["DOCUMENT_ROOT"] . '/images/' . date('Y/m/d/');
//moving temporary file to images folder
if (file_exists($path_images) || mkdir($path_images, 0775, true)) {
rename($path_upload . $this->input->post('postImage'), $path_images . $this->input->post('postImage'));
}
}
if ($this->input->post('postThumb')) {
//path to save the image
$path_upload = $_SERVER["DOCUMENT_ROOT"] . '/uploads/';
$path_images = $_SERVER["DOCUMENT_ROOT"] . '/thumbs/' . date('Y/m/d/');
//moving temporary file to images folder
if (file_exists($path_images) || mkdir($path_images, 0775, true)) {
rename($path_upload . $this->input->post('postThumb'), $path_images . $this->input->post('postThumb'));
}
}
//Update the post
$this->load->library('Sioen');
if($this->input->post('published') == '0') {
$this->schedule([
'postID' => $this->uri->segment(4),
'run_at' => date('Y-m-d H:i:s', strtotime($this->input->post('dateReserved'))),
'userID' => $this->session->userdata('userID')
]);
}
$this->post->update($this->uri->segment(4));
//Return to post list
redirect(BASE_URL . '/admin/posts', 'refresh');
}
}
public function delete()
{
if ($this->input->post('deleteid')) :
$this->Cmap_model->removePost($this->input->post('deleteid'));
redirect(BASE_URL . '/admin/posts');
else :
$this->data['form'] = $this->Cmap_model->getPost($this->uri->segment(4));
$this->load->view('admin/post_delete.php', $this->data);
endif;
}
public function postSearch()
{
$this->Cmap_model->postSearch($this->input->post('term'));
}
public function schedule($edit = null)
{
$data = is_null($edit) ? array(
'postID' => $this->input->post('postID'),
'run_at' => $this->input->post('run_at'),
'userID' => $this->session->userdata('userID')
) : $edit;
$this->db->where('postID', $data['postID'])->delete('cm_post_schedule');
$this->db->insert('cm_post_schedule', $data);
if(!$edit) {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode(array('code' => 200)));
}
}
}

View File

@@ -0,0 +1,54 @@
<?php
class Pray extends MY_Controller {
public function __construct()
{
define("HOOSK_ADMIN", 1);
parent::__construct();
$this->load->model('pray_model');
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'file', 'form'));
$this->load->library('session');
define('LANG', $this->data['settings']->siteLang);
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->helper('general');
}
public function index()
{
$this->load->library('pagination');
$result_per_page = 15; // the number of result per page
$config['base_url'] = BASE_URL . '/admin/pray/';
$config['total_rows'] = $this->pray_model->getCountPaging();
$config['per_page'] = $result_per_page;
$config['last_link'] = false;
$config['first_link'] = false;
$config['suffix'] = '?term=' . getSearchTerm();
$this->pagination->initialize($config);
//Get posts from database
$this->data['pray'] = $this->pray_model->getPaging($result_per_page, $this->uri->segment(3))
->get()->result();
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/pray', $this->data);
}
public function delete()
{
if ($this->input->post('deleteid')) :
$this->pray_model->delete($this->input->post('deleteid'));
redirect(BASE_URL . '/admin/pray');
else :
$this->data['form'] = [(array)$this->pray_model->getOne($this->uri->segment(4))];
$this->load->view('admin/pray_delete.php', $this->data);
endif;
}
}

View File

@@ -0,0 +1,211 @@
<?php if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Settings extends CI_Controller
{
public function __construct()
{
parent::__construct();
define("HOOSK_ADMIN", 1);
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'form'));
$this->load->library('session');
$this->load->model('Cmap_model');
define('LANG', $this->Cmap_model->getLang());
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
define('SITE_NAME', $this->Cmap_model->getSiteName());
define('THEME', $this->Cmap_model->getTheme());
define('THEME_FOLDER', BASE_URL.'/theme/'.THEME);
}
public function index()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->helper('directory');
$this->data['themesdir'] = directory_map($_SERVER["DOCUMENT_ROOT"].'/theme/', 1);
$this->data['langdir'] = directory_map(APPPATH.'/language/', 1);
$this->data['settings'] = $this->Cmap_model->getSettings();
$this->data['current'] = $this->uri->segment(2);
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/settings', $this->data);
}
public function upload()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$attachment = $this->input->post('attachment');
$uploadedFile = $_FILES['attachment']['tmp_name']['file'];
$path = $_SERVER["DOCUMENT_ROOT"].'/images';
$url = BASE_URL.'/images';
// create an image name
$fileName = $attachment['name'];
// upload the image
move_uploaded_file($uploadedFile, $path.'/'.$fileName);
$this->output->set_output(
json_encode(array('file' => array(
'url' => $url . '/' . $fileName,
'filename' => $fileName
))),
200,
array('Content-Type' => 'application/json')
);
}
public function updateSettings()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$path_upload = $_SERVER["DOCUMENT_ROOT"] . '/uploads/';
$path_images = $_SERVER["DOCUMENT_ROOT"] . '/images/';
if ($this->input->post('siteLogo') != "") {
rename($path_upload . $this->input->post('siteLogo'), $path_images . $this->input->post('siteLogo'));
}
if ($this->input->post('siteFavicon') != "") {
rename($path_upload . $this->input->post('siteFavicon'), $path_images . $this->input->post('siteFavicon'));
}
$this->Cmap_model->updateSettings();
redirect(BASE_URL.'/admin/settings/default', 'refresh');
}
public function uploadLogo()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$config['upload_path'] = FCPATH. '/uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$this->load->library('upload', $config);
foreach ($_FILES as $key => $value) {
if (! $this->upload->do_upload($key)) {
$error = array('error' => $this->upload->display_errors());
echo 0;
} else {
echo '"'.$this->upload->data('file_name').'"';
}
}
}
public function social()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->data['social'] = $this->Cmap_model->getSocial();
$this->data['current'] = $this->uri->segment(2);
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/social', $this->data);
}
public function updateSocial()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->Cmap_model->updateSocial();
redirect(BASE_URL.'/admin/settings/social', 'refresh');
}
public function roles()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->library('pagination');
$result_per_page =15; // the number of result per page
$config['base_url'] = BASE_URL. '/admin/settings/roles/';
$config['total_rows'] = $this->Cmap_model->countRoles();
$config['per_page'] = $result_per_page;
$this->pagination->initialize($config);
//Get users from database
$this->data['roles'] = $this->Cmap_model->getRoles($result_per_page, $this->uri->segment(4));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/roles', $this->data);
}
public function newRole()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/role_new', $this->data);
}
public function addRole()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
$this->form_validation->set_rules('name', 'role name', 'trim|required|is_unique[cm_setting_roles.name]');
$this->form_validation->set_rules('slug', 'role slug', 'trim|required|is_unique[cm_setting_roles.slug]');
if($this->form_validation->run() == FALSE) {
//Validation failed
$this->newRole();
} else {
//Validation passed
//Add the user
$this->Cmap_model->createRole();
//Return to user list
redirect(BASE_URL.'/admin/settings/roles', 'refresh');
}
}
public function editRole()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Get user details from database
$this->data['users'] = $this->Cmap_model->getRole($this->uri->segment(5));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/role_edit', $this->data);
}
public function editedRole()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
$this->form_validation->set_rules('name', 'email address', 'trim|required|is_unique[cm_setting_roles.name.roleID.'.$this->uri->segment(5).']');
$this->form_validation->set_rules('slug', 'password', 'trim|required');
if($this->form_validation->run() == FALSE) {
//Validation failed
$this->editRole();
} else {
//Validation passed
//Update the user
$this->Cmap_model->updateRole($this->uri->segment(5));
//Return to user list
redirect(BASE_URL.'/admin/settings/roles', 'refresh');
}
}
public function deleteRole()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
if($this->input->post('deleteid')):
$this->Cmap_model->removeRole($this->input->post('deleteid'));
redirect(BASE_URL.'/admin/settings/roles');
else:
$this->data['form']=$this->Cmap_model->getRole($this->uri->segment(5));
$this->load->view('admin/role_delete.php', $this->data );
endif;
}
function roleSearch()
{
$this->Cmap_model->roleSearch($this->input->post('term'));
}
}

View File

@@ -0,0 +1,253 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Users extends CI_Controller
{
function __construct()
{
parent::__construct();
define("HOOSK_ADMIN", 1);
$this->load->model('Cmap_model');
$this->load->helper(array('admincontrol', 'url', 'form'));
$this->load->library('session');
define('LANG', $this->Cmap_model->getLang());
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
define('SITE_NAME', $this->Cmap_model->getSiteName());
define('THEME', $this->Cmap_model->getTheme());
define('THEME_FOLDER', BASE_URL . '/theme/' . THEME);
$this->load->helper('general');
}
public function index()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->library('pagination');
$result_per_page = 15; // the number of result per page
$config['base_url'] = BASE_URL . '/admin/users/';
$config['total_rows'] = $this->Cmap_model->countUsers();
$config['per_page'] = $result_per_page;
$config['suffix'] = '?term='. getSearchTerm();
$config['last_link'] = false;
$config['first_link'] = false;
$this->pagination->initialize($config);
//Get users from database
$this->data['users'] = $this->Cmap_model->getUsers($result_per_page, $this->uri->segment(3));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/users', $this->data);
}
public function addUser()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->data['roles'] = ['0' => 'Roles'];
foreach($this->Cmap_model->getRoles(10000) as $r) {
$this->data['roles'][$r['roleID']] = $r['name'];
}
$this->load->view('admin/user_new', $this->data);
}
public function confirm()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
$this->form_validation->set_rules('username', 'username', 'trim|alpha_dash|required|is_unique[cm_user.userName]');
$this->form_validation->set_rules('email', 'email address', 'trim|required|valid_email|is_unique[cm_user.email]');
$this->form_validation->set_rules('password', 'password', 'trim|required|min_length[4]|max_length[32]');
$this->form_validation->set_rules('con_password', 'confirm password', 'trim|required|matches[password]');
if ($this->form_validation->run() == FALSE) {
//Validation failed
$this->addUser();
} else {
//Validation passed
//Add the user
$this->Cmap_model->createUser();
//Return to user list
redirect(BASE_URL . '/admin/users', 'refresh');
}
}
public function editUser()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Get user details from database
$this->data['users'] = $this->Cmap_model->getUser($this->uri->segment(4));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->data['roles'] = ['0' => 'Roles'];
foreach($this->Cmap_model->getRoles(10000) as $r) {
$this->data['roles'][$r['roleID']] = $r['name'];
}
$this->load->view('admin/user_edit', $this->data);
}
public function edited()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
$this->form_validation->set_rules('email', 'email address', 'trim|required|valid_email|is_unique[cm_user.email.userID.' . $this->uri->segment(4) . ']');
$this->form_validation->set_rules('password', 'password', 'trim|min_length[4]|max_length[32]');
$this->form_validation->set_rules('con_password', 'confirm password', 'trim|matches[password]');
if ($this->form_validation->run() == FALSE) {
//Validation failed
$this->editUser();
} else {
//Validation passed
//Update the user
$this->Cmap_model->updateUser($this->uri->segment(4));
//Return to user list
redirect(BASE_URL . '/admin/users', 'refresh');
}
}
function delete()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
if ($this->input->post('deleteid')) :
$this->Cmap_model->removeUser($this->input->post('deleteid'));
redirect(BASE_URL . '/admin/users');
else :
$this->data['form'] = $this->Cmap_model->getUser($this->uri->segment(4));
$this->load->view('admin/user_delete.php', $this->data);
endif;
}
/************** Forgotten Password Resets **************/
public function forgot()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_email_check');
if ($this->form_validation->run() == FALSE) {
$this->data['header'] = $this->load->view('admin/headerlog', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/email_check', $this->data);
} else {
$email = $this->input->post('email');
$this->load->helper('string');
$rs = random_string('alnum', 12);
$data = array(
'rs' => $rs
);
$this->db->where('email', $email);
$this->db->update('cm_user', $data);
//now we will send an email
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->load->library('email', $config);
$this->email->from('password@' . EMAIL_URL, SITE_NAME);
$this->email->to($email);
$this->email->subject($this->lang->line('email_reset_subject'));
$this->email->message($this->lang->line('email_reset_message') . "\r\n" . BASE_URL . '/admin/reset/' . $rs);
$this->email->send();
$this->data['header'] = $this->load->view('admin/headerlog', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/check', $this->data);
}
}
public function email_check($str)
{
$query = $this->db->get_where('cm_user', array('email' => $str), 1);
if ($query->num_rows() == 1) {
return true;
} else {
$this->form_validation->set_message('email_check', $this->lang->line('email_check'));
return false;
}
}
public function getPassword()
{
$rs = $this->uri->segment(3);
$query = $this->db->get_where('cm_user', array('rs' => $rs), 1);
if ($query->num_rows() == 0) {
$this->data['header'] = $this->load->view('admin/headerlog', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/error', $this->data);
} else {
$this->load->database();
$this->load->helper('url');
$this->load->library('form_validation');
$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[20]|matches[con_password]');
$this->form_validation->set_rules('con_password', 'Password Confirmation', 'trim|required');
if ($this->form_validation->run() == FALSE) {
echo form_open();
$this->data['header'] = $this->load->view('admin/headerlog', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/resetform', $this->data);
} else {
$query = $this->db->get_where('cm_user', array('rs' => $rs), 1);
if ($query->num_rows() == 0) {
show_error('Sorry!!! Invalid Request!');
} else {
$data = array(
'password' => md5($this->input->post('password') . SALT),
'rs' => ''
);
$where = $this->db->where('rs', $rs);
$where->update('cm_user', $data);
$this->data['header'] = $this->load->view('admin/headerlog', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/reset', $this->data);
}
}
}
}
public function roles()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->library('pagination');
$result_per_page = 15; // the number of result per page
$config['base_url'] = BASE_URL . '/admin/users/';
$config['total_rows'] = $this->Cmap_model->countUsers();
$config['per_page'] = $result_per_page;
$config['last_link'] = false;
$config['first_link'] = false;
$this->pagination->initialize($config);
//Get users from database
$this->data['users'] = $this->Cmap_model->getUsers($result_per_page, $this->uri->segment(3));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/roles', $this->data);
}
public function userSearch()
{
$this->Cmap_model->userSearch(getSearchTerm());
}
}

View File

@@ -0,0 +1,715 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Webtoons extends CI_Controller
{
public $tb_name_category = 'wt_categories';
public $tb_name_episode = 'mt_episodes';
public $tb_name_webtoon_list = 'wt_list';
public $tb_name_notice = 'wt_announcement';
public $tb_name_cartoonist = 'wt_cartoonists';
public $tb_name_post = 'cm_post';
public $display_limit = 15; // total # of list
public $list_limit = 10; // total # of pages
public function __construct()
{
parent::__construct();
// $this->load->library('util');
define("HOOSK_ADMIN", 1);
$this->load->language('webtoon');
$this->load->model('Hoosk_model');
$this->load->model('wtoon_model');
$this->load->helper(array('admincontrol', 'url', 'form'));
$this->load->library('session');
define('LANG', $this->Hoosk_model->getLang());
$this->lang->load('admin', LANG);
//Define what page we are on for nav
$this->data['current'] = $this->uri->segment(2);
define('SITE_NAME', $this->Hoosk_model->getSiteName());
define('THEME', $this->Hoosk_model->getTheme());
define('THEME_FOLDER', BASE_URL.'/theme/'.THEME);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
}
/*
@desc : list all maptoons
*/
public function index()
{
$this->load->library('pagination');
$result_per_page = $this->display_limit; // the number of result per page
$config['base_url'] = BASE_URL. '/admin/webtoons/';
$config['total_rows'] = $this->wtoon_model->countWebtoon();
$config['per_page'] = $result_per_page;
$this->pagination->initialize($config);
//Get webtoons from database
$this->data['webtoons'] = $this->wtoon_model->getWebtoons($arr='', $result_per_page, $this->uri->segment(3));
$this->data['posts'] = $this->Hoosk_model->getPosts($result_per_page, $this->uri->segment(3));
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
// $query_string = ['status'=>1, 'wt_cartoonists_idx'=>1];
$query_string = [];
$arr_cartoonist = $this->wtoon_model->get_cartoonist_list();
$this->data['cartoonists'] = $arr_cartoonist;
$this->load->view('/admin/webtoon/webtoon', $this->data);
}
/*
@desc : register webtoon
*/
public function webtoon_proc()
{
$idx = $this->input->post('idx');
$mode = $this->input->post('mode');
$wt_cartoonists_idx = $this->input->post('wt_cartoonists_idx'); //
$name = $this->input->post('name'); //
$status = $this->input->post('status');
$date_sun = ($this->input->post('date_sun')=='') ? 0 : $this->input->post('date_sun');
$date_mon = ($this->input->post('date_mon')=='') ? 0 : $this->input->post('date_mon');
$date_tue = ($this->input->post('date_tue')=='') ? 0 : $this->input->post('date_tue');
$date_wed = ($this->input->post('date_wed')=='') ? 0 : $this->input->post('date_wed');
$date_thu = ($this->input->post('date_thu')=='') ? 0 : $this->input->post('date_thu');
$date_fri = ($this->input->post('date_fri')=='') ? 0 : $this->input->post('date_fri');
$date_sat = ($this->input->post('date_sat')=='') ? 0 : $this->input->post('date_sat');
$description = $this->input->post('description');
if ($name=='') {
// $this->util->js_alert_back('맵툰명을 입력해주십시오');
exit;
}
if ($wt_cartoonists_idx=='') {
// $this->util->js_alert_back('맵툰작가를 선택해주세요');
exit;
}
$this->load->model('m_webtoon');
if ($idx!=0) {
$maptoon_info = $this->wtoon_model->getWebtoons(['idx' => $idx]);
}
//이미지 업로드
if ($_FILES['main_img']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = WEBTOON_DIR_BACK.$mid_url_path;
if (!is_dir($upload_path)) {
umask(0);
mkdir($upload_path, 0777, true);
}
$config['max_size'] = 20*1024;
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['encrypt_name'] = true;
$this->load->library('upload');
$this->upload->initialize($config);
$file_name= date("H").date("i").date("s");
if (! $this->upload->do_upload('main_img')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
}
$arr_upload_data = $this->upload->data();
$img_data = (isset($arr_upload_data['file_name'])==true) ? WEBTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
//remove previous image
if (isset($maptoon_info[0])==true && $img_data!='') {
$main_img = $maptoon_info[0]['main_img'];
if ($main_img!='') {
unlink($_SERVER['DOCUMENT_ROOT'].$main_img);
}
}
} else {
$img_data = (isset($maptoon_info[0]['main_img'])==true) ? $maptoon_info[0]['main_img'] : '';
}
$data = ['main_img' => $img_data,
'name' => $name,
'status' => $status,
'date_sun' => $date_sun,
'date_mon' => $date_mon,
'date_tue' => $date_tue,
'date_wed' => $date_wed,
'date_thu' => $date_thu,
'date_fri' => $date_fri,
'date_sat' => $date_sat,
'description' => $description,
'reg_date' => date("Y-m-d H:i:s"),
'wt_cartoonists_idx' => $wt_cartoonists_idx];
if (is_numeric($idx)==true && $idx>0) { // update data
$ret = $this->wtoon_model->updateWebtoon($idx, $data);
if ($ret==true) {
$result['status'] = 1;
$result['message'] ='수정되었습니다.';
echo json_encode($result);
exit;
} else {
$result['status'] = 0;
$result['message'] = '등록되지 않았습니다. 다시 시도해 주세요';
echo json_encode($result);
exit;
}
} else { // insert data
$ret = $this->wtoon_model->insertWebtoon($data);
if ($ret==true) {
$result['status'] = 1;
$result['message'] = '등록되었습니다.';
echo json_encode($result);
exit;
} else {
$result['status'] = 0;
$result['message'] = '등록되지 않았습니다. 다시 시도해 주세요';
echo json_encode($result);
exit;
}
}
}
/*
@desc : delete webtoon info
*/
public function webtoon_delete()
{
if ($this->input->post('deleteid')):
$this->wtoon_model->removeWebtoon($this->input->post('deleteid'));
redirect(BASE_URL.'/admin/webtoons'); else:
$this->data['form']=$this->wtoon_model->getWebtoon($this->uri->segment(4));
$this->load->view('admin/webtoon/webtoon_delete.php', $this->data);
endif;
}
/*
@desc : list all cartoonists
*/
public function cartoonist()
{
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$idx = $this->input->get('idx');
if (is_numeric($idx)==true && $idx>0) {
$query = $this->db->get_where($this->tb_name_cartoonist, ['idx'=>$idx]);
$row = $query->row_array();
if ($row!=false) {
$row['result'] = 'success';
}
echo json_encode($row);
exit;
} else {
$query = $this->db->get($this->tb_name_cartoonist);
$i = 0;
$this->data['cartoonists']= array();
foreach ($query->result_array() as $row) {
$this->data['cartoonists'][$i] = $row;
$i++;
}
$this->load->view('/admin/webtoon/cartoonist', $this->data);
}
}
/*
@desc : register & modify cartoonist info
*/
public function cartoonist_proc()
{
$name = $this->input->post('name');
$website = $this->input->post('website');
$mode = $this->input->post('mode');
$idx = $this->input->post('idx');
$name = trim($name);
$website = trim($website);
if ($name!='' && $website!='') {
if (isset($idx) && $idx!='0' && $idx!='') {
$data = ['name' => $name,
'website' => $website];
$this->db->where('idx', $idx);
$ret = $this->db->update($this->tb_name_cartoonist, $data);
if ($ret==true) {
$result['status'] = 1;
$result['message'] = "수정성공";
} else {
$result['status'] = 0;
$result['message'] = '수정 실패 관리자에게 문의';
}
} else {
$data = [
'name' => $name,
'website' => $website
];
$ret = $this->db->insert($this->tb_name_cartoonist, $data);
if ($ret==true) {
$result['status'] = 1;
$result['message'] = "등록성공";
} else {
$result['status'] = 0;
$result['message'] = "등록 실패";
}
}
} else {
$result['status'] = 0;
$result['message'] = 'All fields are required';
}
echo json_encode($result);
exit;
}
/*
@desc : delete cartoonist info
*/
public function cartoonist_delete()
{
if ($this->input->post('deleteid')):
$this->wtoon_model->removeCartoonist($this->input->post('deleteid'));
redirect(BASE_URL.'/admin/webtoons/cartoonist'); else:
$this->data['form']=$this->wtoon_model->getCartoonist($this->uri->segment(5));
$this->load->view('admin/webtoon/cartoonist_delete.php', $this->data);
endif;
}
/*
@desc : show list of maptoon announcement
@param: numeric; idx of announcement table
*/
public function announcement()
{
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
//Get Webtoons
$this->data['webtoons'] = $this->wtoon_model->getWebtoons($arr='', 0, 0);
$this->data['announcements']=$this->wtoon_model->getAnnouncements();
$this->load->view('/admin/webtoon/announcement', $this->data);
}
/*
@desc : register announcement
*/
public function announcement_proc()
{
$idx = $this->input->post('idx');
$wt_list_idx = $this->input->post('wt_list_idx');
$idx = $this->input->post('idx');
$contents = $this->input->post('contents');
$s_date = $this->input->post('s_date');
$e_date = $this->input->post('e_date');
if (isset($idx) && $idx!='0' && $idx!='') {
$data = [
'contents' => $contents,
's_date' => $s_date,
'e_date' => $e_date
];
$this->db->where('idx', $idx);
$ret = $this->db->update($this->tb_name_notice, $data);
if ($ret==true) {
$result['status'] = 1;
$result['message'] = '수정되었습니다.';
} else {
$result['status'] = 0;
$result['message'] = '수정 실패 관리자에게 문의';
}
} else {
$data=[
'wt_list_idx' => $wt_list_idx,
'contents' => $contents,
's_date' => $s_date,
'e_date' => $e_date,
'reg_date' => date("Y-m-d H:i:s")
];
$ret = $this->db->insert($this->tb_name_notice, $data);
if ($ret==true) {
$result['status'] = 1;
$result['message'] = '등록되었습니다.';
} else {
$result['status'] = 0;
$result['message'] = '등록 실패 관리자에게 문의';
}
}
echo json_encode($result);
exit;
}
/*
@desc : delete maptoon announcement
*/
public function announcement_delete()
{
if ($this->input->post('deleteid')):
$this->wtoon_model->removeAnnouncement($this->input->post('deleteid'));
redirect(BASE_URL.'/admin/webtoons/announcement'); else:
$this->data['form']=$this->wtoon_model->getAnnouncements($this->uri->segment(5));
$this->load->view('admin/webtoon/announcement_delete.php', $this->data);
endif;
}
/*
@desc : show list of maptoon episodes
*/
public function episode()
{
$this->load->library('pagination');
$result_per_page = $this->display_limit; // the number of result per page
$config['base_url'] = BASE_URL. '/admin/webtoons/episode/';
$config['total_rows'] = $this->wtoon_model->countEpisodes(0);
$config['per_page'] = $result_per_page;
$this->pagination->initialize($config);
$return_data['list'] = $result = array();
$arr_cartoonist = $this->wtoon_model->get_cartoonist_list(); //작가 이름
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$arr_webtoon = $this->wtoon_model->getWebtoons(); //맵툰 이름 리스트
$req_data['limit'] = $result_per_page;
$req_data['offset'] = $this->uri->segment(4);
$episode = $this->wtoon_model->getEpisode($req_data);
$this->data['episode'] = $episode;
$this->data['arr_cartoonist'] = $arr_cartoonist;
$this->data['arr_webtoon'] = $arr_webtoon;
$this->load->view('/admin/webtoon/episode', $this->data);
}
public function addEpisode()
{
$return_data['list'] = $result = array();
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$arr_webtoon = $this->wtoon_model->getWebtoons(); // 맵툰 이름 리스트
$this->data['arr_webtoon'] = $arr_webtoon;
$this->load->view('/admin/webtoon/episode_new', $this->data);
}
public function confirmEpisode()
{
$postID = ($this->wtoon_model->getInsertPostID()[0]['postID'])+1;
$postTitle = $this->input->post('postTitle');
$wt_list_idx = $this->input->post('wt_list_idx');
$unixStamp = time();
$datePosted = $this->input->post('datePosted');
$postContentHTML = $this->input->post('contents');
strtotime($datePosted)>$unixStamp? $published = 0 : $published = 1;
$ep_no = $this->input->post('ep_no');
//이미지 업로드
if ($_FILES['postImage']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = WEBTOON_DIR_BACK.$mid_url_path;
if (!is_dir($upload_path)) {
umask(0);
mkdir($upload_path, 0777, true);
}
$config['max_size'] = 20*1024;
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['encrypt_name'] = true;
$this->load->library('upload');
$this->upload->initialize($config);
$file_name= date("H").date("i").date("s");
if (! $this->upload->do_upload('postImage')) {
$error = array('error' => $this->upload->display_errors());
echo "이미지 업로드 실패";
}
$arr_upload_data = $this->upload->data();
$postImage = (isset($arr_upload_data['file_name'])==true) ? WEBTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
//remove previous image
if (isset($webtoon_info[0])==true && $postImage!='') {
$postImage = $webtoon_info[0]['postImage'];
if ($main_img!='') {
unlink($_SERVER['DOCUMENT_ROOT'].$main_img);
}
}
} else {
$postImage = (isset($webtoon_info[0]['postImage'])==true) ? $webtoon_info[0]['postImage'] : '';
}
$data = [
'postID' => $postID,
'postURL' => $postID,
'postTitle' => htmlspecialchars($postTitle),
'postExcerpt' => "",
'postContentHTML' => htmlspecialchars($postContentHTML),
'postContent' => "",
'postImage' => $postImage,
'categoryID' => 20000,
'published' => $published,
'datePosted' => $datePosted,
'dateUpdated' => date("Y-m-d h:i:s", $unixStamp),
'unixStamp' => $unixStamp
];
$this->wtoon_model->insertWebtoonPost($data);
$data = [
'postID' => $postID,
'wt_list_idx' => $wt_list_idx,
'recommend_count' => 0,
'view_count' => 0,
'grade' => 0,
'grade_total' => 0,
'ep_no' => $ep_no
];
$this->wtoon_model->insertEpisode($data);
//Return to post list
redirect(BASE_URL.'/admin/webtoons/episode', 'refresh');
}
public function add_episode_image()
{
$this->load->view('/admin/webtoon/add_episode_image');
}
public function add_episode_image_upload()
{
if ($_FILES['uploadInputBox']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = WEBTOON_DIR_BACK.$mid_url_path;
if (!is_dir($upload_path)) {
umask(0);
mkdir($upload_path, 0777, true);
}
$config['max_size'] = 20*1024;
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['encrypt_name'] = true;
$this->load->library('upload');
$this->upload->initialize($config);
$file_name= date("H").date("i").date("s");
if (! $this->upload->do_upload('uploadInputBox')) {
$error = array('error' => $this->upload->display_errors());
}
$arr_upload_data = $this->upload->data();
/*echo ('<script language=\"javascript\">
var tempImg = \'<div class="center-align"><img src="'.WEBTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'].'" title="" alt="comic content"></div>\';
opener.tinymce.activeEditor.execCommand("mceInsertContent","false",tempImg);
</script>
');*/
echo WEBTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'];
}
}
public function editEpisode()
{
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$arr_webtoon = $this->wtoon_model->getWebtoons(); // 맵툰 이름 리스트
$this->data['arr_webtoon'] = $arr_webtoon;
$postID=$this->uri->segment(5);
$req_data['postID']= $postID;
$episode = $this->wtoon_model->getEpisode($req_data);
$this->data['episode'] = $episode;
$this->load->view('/admin/webtoon/episode_edit', $this->data);
}
public function editedEpisode()
{
$postID = $this->input->post('postID');
$postTitle = $this->input->post('postTitle');
$wt_list_idx = $this->input->post('wt_list_idx');
$unixStamp = time();
$datePosted = $this->input->post('datePosted');
$postContentHTML = $this->input->post('contents');
strtotime($datePosted)>$unixStamp? $published = 0 : $published = 1;
$ep_no = $this->input->post('ep_no');
$req_data['postID']= $postID;
$webtoon_info = $this->wtoon_model->getEpisode($req_data);
//이미지 업로드
if ($_FILES['postImage']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = WEBTOON_DIR_BACK.$mid_url_path;
if (!is_dir($upload_path)) {
umask(0);
mkdir($upload_path, 0777, true);
}
$config['max_size'] = 20*1024;
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['encrypt_name'] = true;
$this->load->library('upload');
$this->upload->initialize($config);
$file_name= date("H").date("i").date("s");
if (! $this->upload->do_upload('postImage')) {
$error = array('error' => $this->upload->display_errors());
echo "이미지 업로드 실패";
}
$arr_upload_data = $this->upload->data();
$postImage = (isset($arr_upload_data['file_name'])==true) ? WEBTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
//remove previous image
if (isset($webtoon_info[0])==true && $postImage!='') {
$postImage = $webtoon_info[0]['postImage'];
if ($postImage!='') {
unlink($_SERVER['DOCUMENT_ROOT'].$postImage);
}
}
} else {
$postImage = (isset($webtoon_info[0]['postImage'])==true) ? $webtoon_info[0]['postImage'] : '';
}
$data = [
'postID' => $postID,
'postURL' => $postID,
'postTitle' => htmlspecialchars($postTitle),
'postExcerpt' => "",
'postContentHTML' => htmlspecialchars($postContentHTML),
'postContent' => "",
'postImage' => $postImage,
'categoryID' => 20000,
'published' => $published,
'datePosted' => $datePosted,
'dateUpdated' => date("Y-m-d h:i:s", $unixStamp),
];
$this->wtoon_model->updateWebtoonPost($data);
$data = [
'postID' => $postID,
'wt_list_idx' => $wt_list_idx,
'recommend_count' => 0,
'view_count' => 0,
'grade' => 0,
'grade_total' => 0,
'ep_no' => $ep_no
];
$this->wtoon_model->updateEpisode($data);
//Return to post list
redirect(BASE_URL.'/admin/webtoons/episode', 'refresh');
}
/*
@desc : delete maptoon announcement
*/
public function episode_delete()
{
if ($this->input->post('deleteid')):
$this->wtoon_model->removeEpisode($this->input->post('deleteid'));
redirect(BASE_URL.'/admin/webtoons/episode'); else:
$req_data['postID'] = $this->uri->segment(5);
$this->data['form']=$this->wtoon_model->getEpisode($req_data);
$this->load->view('admin/webtoon/episode_delete.php', $this->data);
endif;
}
/*
@desc : list all the maptoon categories
*/
public function category()
{
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$idx = $this->input->get('idx');
$categories = $this->wtoon_model->getCategory();
$this->data['categories']=$categories;
$this->load->view('/admin/webtoon/category', $this->data);
}
public function editCategory()
{
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$categoryID = $this->uri->segment(5);
$data_category = $this->wtoon_model->getCategory($categoryID);
$this->data['categoryTitle'] = $data_category['categoryTitle'];
$data_episodes = $this->wtoon_model->get_episodes_by_category($categoryID);
if ($data_episodes!=false) {
$this->data['list'] = $data_episodes;
} else {
$this->data['list'] = '';
}
$this->data['categoryID'] = $categoryID;
$this->load->view('/admin/webtoon/category_edit', $this->data);
}
/*
get list of maptoon episodes
@return json string
*/
public function get_episodes_by_search_keyword()
{
$keyword = $this->input->get('keyword');
if ($keyword!='') {
$row = $this->wtoon_model->get_episodes_by_search_keyword($keyword);
// $row = array(['idx'=>2, 'main_img'=>'/files/maptoon/2019/03/efe2b7b7f5d738ffc4ff288ef3a5b055.png','title'=>htmlspecialchars('김"집사')],
// ['idx'=>3, 'main_img'=>'/files/maptoon/2019/03/efe2b7b7f5d738ffc4ff288ef3a5b055.png','title'=>'김집사']);
echo json_encode($row);
exit;
}
}
public function register_episode_in_category()
{
$postID = $this->input->post('postID');
$categoryID = $this->input->post('categoryID');
// $len = count($postID);
$ret = $this->wtoon_model->update_episodes_by_category($categoryID, $postID);
redirect(BASE_URL.'/admin/webtoons/category');
}
public function get_next_ep_no()
{
$wt_list_idx = $this->input->post('wt_list_idx');
$res_data = $this->wtoon_model->get_next_ep_no($wt_list_idx);
echo $res_data->ep_no+1;
}
}

View File

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

View File

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

View File

@@ -0,0 +1,100 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
use GO\Scheduler;
class MY_Controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper('general');
$this->load->driver('cache', array('adapter' => 'file'));
$this->setSite(0);
date_default_timezone_set($this->config->item('time_reference'));
define('SITE_NAME', $this->data['settings']->siteTitle);
define('THEME', $this->data['settings']->siteTheme);
define('THEME_FOLDER', BASE_URL . '/theme/' . THEME);
if (defined('HOST_ONLY_MAINTENANCE') || $this->data['settings']->siteMaintenance) {
$this->maintenance();
} else {
$this->schedule();
if (isAdminSite()) {
$this->load->model('post_model', 'post');
$this->load->model('page_model', 'page');
$this->load->model('category_model', 'category');
}
}
}
private function setSite($siteID)
{
r(
function () use ($siteID) {
$this->load->model('settings_model');
$this->data = ['settings' => $this->settings_model->findBySiteID($siteID)];
},
['n' => 'settings', 't' => 60 * 60]
);
}
private function schedule()
{
$this->load->library('parser');
$this->load->library('cacher');
s(function () {
$this->load->model('post_model');
$posts = $this->post_model->getPostsScheduled();
$publishing = [];
$t = time();
foreach ($posts as $p) {
if (strtotime($p->run_at) < $t) {
array_push($publishing, $p->postID);
}
}
if (count($publishing)) {
$this->post_model->publishPosts($publishing);
}
}, 60 * 10, 'publish');
}
protected function isMobile()
{
return defined('MOBILE') || $this->ua->is_mobile();
}
protected function error()
{
$this->data['page']['pageTitle'] = "Oops, Error";
$this->data['page']['pageDescription'] = "Oops, Error";
$this->data['page']['pageKeywords'] = "Oops, Error";
$this->data['page']['pageID'] = "0";
$this->data['page']['pageTemplate'] = "error";
$this->data['header'] = $this->load->view('templates/header', $this->data, true);
$this->data['footer'] = $this->load->view('templates/footer', '', true);
$this->load->view('templates/' . $this->data['page']['pageTemplate'], $this->data);
}
protected function maintenance()
{
// $this->data['page']['pageTitle'] = "Maintenance Mode";
// $this->data['page']['pageDescription'] = "Maintenance Mode";
// $this->data['page']['pageKeywords'] = "Maintenance Mode";
// $this->data['page']['pageID'] = "0";
// $this->data['page']['pageTemplate'] = "maintenance";
// $this->data['header'] = $this->load->view('templates/header', $this->data, true);
// $this->data['footer'] = $this->load->view('templates/footer', '', true);
// $this->load->view('templates/' . $this->data['page']['pageTemplate'], $this->data);
echo $this->load->view('templates/others/underconstruct', null, true);
exit(3);
}
protected function response($body) {
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode($body));
}
}

163
application/core/MY_Loader.php Executable file
View File

@@ -0,0 +1,163 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// EXTENDS/MODIFIES LOADER CLASS TO BRANCH TO /CINCH/THEME DIRECTORY FOR PUBLIC FILES
// SEE AROUND LINE 65
class MY_Loader extends CI_Loader {
public function __construct()
{
parent::__construct();
}
/**
* CUSTOMISED Loader function
*
* This function is used to load views and files.
* Variables are prefixed with _ci_ to avoid symbol collision with
* variables made available to view files
*
* @param array
* @return void
*/
protected function _ci_load($_ci_data)
{
// Set the default data variables
foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val)
{
$$_ci_val = ( ! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val];
}
$file_exists = FALSE;
// Set the path to the requested file
if ($_ci_path != '')
{
$_ci_x = explode('/', $_ci_path);
$_ci_file = end($_ci_x);
}
else
{
$_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
$_ci_file = ($_ci_ext == '') ? $_ci_view.'.php' : $_ci_view;
foreach ($this->_ci_view_paths as $view_file => $cascade)
{
if (file_exists($view_file.$_ci_file))
{
$_ci_path = $view_file.$_ci_file;
$file_exists = TRUE;
break;
}
if ( ! $cascade)
{
break;
}
}
}
if(!defined('HOOSK_ADMIN') || defined('HOOSK_ADMIN_PREVIEW')):
$_ci_path = 'theme/'.THEME.'/'.$_ci_file;
endif;
##########################################################################################
if ( ! $file_exists && ! file_exists($_ci_path))
{
show_error('Unable to load the requested file: '.$_ci_file);
}
// This allows anything loaded using $this->load (views, files, etc.)
// to become accessible from within the Controller and Model functions.
$_ci_CI =& get_instance();
foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var)
{
if ( ! isset($this->$_ci_key))
{
$this->$_ci_key =& $_ci_CI->$_ci_key;
}
}
/*
* Extract and cache variables
*
* You can either set variables using the dedicated $this->load_vars()
* function or via the second parameter of this function. We'll merge
* the two types and cache them so that views that are embedded within
* other views can have access to these variables.
*/
if (is_array($_ci_vars))
{
$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
}
extract($this->_ci_cached_vars);
/*
* Buffer the output
*
* We buffer the output for two reasons:
* 1. Speed. You get a significant speed boost.
* 2. So that the final rendered template can be
* post-processed by the output class. Why do we
* need post processing? For one thing, in order to
* show the elapsed page load time. Unless we
* can intercept the content right before it's sent to
* the browser and then stop the timer it won't be accurate.
*/
ob_start();
// If the PHP installation does not support short tags we'll
// do a little string replacement, changing the short tags
// to standard PHP echo statements.
if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE)
{
echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
}
else
{
include($_ci_path); // include() vs include_once() allows for multiple views with the same name
}
log_message('debug', 'File loaded: '.$_ci_path);
// Return the file data if requested
if ($_ci_return === TRUE)
{
$buffer = ob_get_contents();
@ob_end_clean();
return $buffer;
}
/*
* Flush the buffer... or buff the flusher?
*
* In order to permit views to be nested within
* other views, we need to flush the content back out whenever
* we are beyond the first level of output buffering so that
* it can be seen and included properly by the first included
* template and any subsequent ones. Oy!
*
*/
if (ob_get_level() > $this->_ci_ob_level + 1)
{
ob_end_flush();
}
else
{
$_ci_CI->output->append_output(ob_get_contents());
@ob_end_clean();
}
}
}

16
application/core/MY_Model.php Executable file
View File

@@ -0,0 +1,16 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class MY_Model extends CI_Model
{
public function __construct()
{
parent::__construct();
$this->load->database();
}
}

11
application/core/index.html Executable file
View File

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

View File

@@ -0,0 +1,14 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Admincontrol_helper{
static function is_logged_in($userName)
{
if(($userName=="")):
$redirect= BASE_URL.'/admin/login';
header("Location: $redirect");
exit;
endif;
}
}

View File

@@ -0,0 +1,174 @@
<?php
require_once(__DIR__ . '/hoosk_page_helper.php');
function lq($result = '')
{
echo get_instance()->db->last_query();
print_r($result);
exit;
}
function getPostLink($post, $sn)
{
$post = is_object($post) ? $post : (object) $post;
$contentSection = ($sn == 'opinions' ? 'channel' : 'news');
return BASE_URL . '/' . $contentSection . '/' . ($sn == 'opinions' ? $post->pageID : $sn) . '/' . (empty($post->postSeq) ? $post->postID : $post->postSeq);
}
function getChildrenByParentId($parentId)
{
$sql = "SELECT
categoryID
FROM
(SELECT
categoryID
FROM
cm_category
WHERE
parentID = $parentId) a
UNION SELECT
categoryID
FROM
cm_category
WHERE
parentID IN (SELECT
categoryID
FROM
cm_category
WHERE
parentID = $parentId)";
return array_column(get_instance()->db->query($sql)->result(), 'categoryID');
}
function getNewsArticleURL($data, $sn = null)
{
$articles = [];
if (is_null($sn)) {
$subcategories = [];
foreach (NEWS_SECTION_CATEGORY as $sn => $sc) {
$subcategories[$sn] = getChildrenByParentId($sc);
array_push($subcategories[$sn], $sc);
}
foreach (NEWS_SECTION_CATEGORY as $sn => $sc) {
foreach ($data as $post) {
if (array_search($post->categoryID, $subcategories[$sn]) !== false) {
$post->articleURL = getPostLink($post, $sn);
array_push($articles, $post);
}
}
}
} else if (is_numeric($sn)) {
get_instance()->load->model('category_model');
$subcategories = get_instance()->category_model->getSubcategoriesByCategoryId($sn);
} else {
foreach ($data as $k => $p) {
$data[$k]->articleURL = getPostLink($p, $sn);
}
}
return $articles;
}
function getResultWithAuthor(&$data)
{
$userIds = array_column($data, 'userID');
if (count($userIds)) {
$users = get_instance()->db->where_in('cm_user.userID', $userIds)
->get('cm_user')
->result();
}
foreach ($data as $k => $t) {
$data[$k]->author = '';
foreach ($users as $u) {
if ($t->userID == $u->userID) {
$data[$k]->author = $u->name;
}
}
}
}
function r(callable $fn, $cache)
{
if (is_null($cache) || !$data = get_instance()->cache->get($cache['n'])) {
$data = $fn();
if (!is_null($cache) && !is_null($data)) {
$this->cache->save($cache['n'], $data, $cache['t']);
}
}
return $data;
}
function s($task, $duration, $cache)
{
$cache = 'task-' . $cache;
$lastExecutionTime = get_instance()->cache->get($cache);
if (time() - $lastExecutionTime >= $duration) {
get_instance()->cache->save($cache, time(), 60 * 60);
$task();
}
}
function getSessionUser()
{
$user = (object) ['is' => false];
get_instance()->load->library('session');
if (get_instance()->session->userdata('auth')) {
$user = json_decode(get_instance()->session->userdata('auth'));
$user->is = true;
};
return $user;
}
function getSearchTerm()
{
return get_instance()->input->get('term') ? get_instance()->input->get('term') : get_instance()->input->post('term');
}
function getPostComments($postId)
{
get_instance()->load->mode('comment_model');
$comments = get_instance()->comment_model->getByPostId($postId);
return $comments;
}
function getImageUrl($imagePath)
{
// return 'https://crossmap.co.kr' . $imagePath;
return strpos($imagePath, 'thumbs/') === false && strpos($imagePath, 'images/') === false ? 'https://crossmap.co.kr' . $imagePath : $imagePath;
}
function getThumbUrl($imagePath, $postThumb)
{
return 'https://crossmap.co.kr' . str_replace('files/', 'thumbs/', $imagePath);
return $postThumb ? $postThumb : 'https://crossmap.co.kr' . str_replace('files/', 'thumbs/', $imagePath);
}
function isAdminSite()
{
return defined('HOOSK_ADMIN') && HOOSK_ADMIN == 1;
}
function getPostsImageUrl(&$posts)
{
if (is_array($posts)) {
foreach ($posts as $k => $v) {
if (is_array($v)) {
if(isset($posts[$k]['postImage'])){
strpos($posts[$k]['postImage'], '://') === false ? ($posts[$k]['postImage'] = getImageUrl($posts[$k]['postImage'])) : '';
$posts[$k]['postImage'] = str_replace('http://', 'https://', $posts[$k]['postImage']);
}
} else {
if(isset($posts[$k]->postImage)) {
strpos($posts[$k]->postImage, '://') === false ? ($posts[$k]->postImage = getImageUrl($posts[$k]->postImage)) : '';
$posts[$k]->postImage = str_replace('http://', 'https://', $posts[$k]->postImage);
}
}
}
}
}
function getPrayPostUrl($post) {
return implode('/', ['/pray', $post->categorySlug, $post->postSeq]);
}

View File

@@ -0,0 +1,14 @@
<?php
if(!function_exists('wordlimit')) {
function wordlimit($string, $length = 40, $ellipsis = "...")
{
$string = strip_tags($string, '<div>');
$string = strip_tags($string, '<p>');
$words = explode(' ', $string);
if (count($words) > $length)
return implode(' ', array_slice($words, 0, $length)) . $ellipsis;
else
return $string.$ellipsis;
}
}

View File

@@ -0,0 +1,362 @@
<?php
if (!function_exists('wordlimit')) {
function wordlimit($string, $length = 40, $ellipsis = "...")
{
$string = strip_tags($string, '<div>');
$string = strip_tags($string, '<p>');
$words = explode(' ', $string);
if (count($words) > $length) {
return implode(' ', array_slice($words, 0, $length)) . $ellipsis;
} else {
return $string.$ellipsis;
}
}
}
//Get the navigation bar
function hooskNav($slug, $leadingPath = '', $segmentIdx = 0)
{
$navHtml = '';
$CI =& get_instance();
$CI->db->where('navSlug', $slug);
$query=$CI->db->get('cm_navigation');
foreach ($query->result_array() as $n):
$totSegments = $CI->uri->total_segments();
if (!is_numeric($CI->uri->segment($totSegments))) {
$current = "/".$CI->uri->segment($totSegments-(strpos($CI->uri->segment($totSegments), 'page-') === false ? 0:1));
} elseif (is_numeric($CI->uri->segment($totSegments))) {
$current = "/".$CI->uri->segment($totSegments-1);
}
if ($current == "/") {
$current = BASE_URL;
};
if($segmentIdx) $current = '/'.$CI->uri->segment($segmentIdx);
$current = $leadingPath. $current;
$navHtml .= str_replace('<li><a href="'.$current.'">', '<li class="current"><a href="'.$current.'" class="current">', $n['navHTML']);
endforeach;
return $navHtml;
}
function getLastUriSegment() {
return get_instance()->uri->segment(get_instance()->uri->total_segments());
}
function getFeedPosts()
{
$CI =& get_instance();
$CI->db->order_by("unixStamp", "desc");
$CI->db->where('published', 1);
$query=$CI->db->get('cm_post');
return $query->result_array();
}
//Get the Latest 5 news posts
function getLatestNewsSidebar()
{
$CI =& get_instance();
$CI->db->order_by("unixStamp", "desc");
$CI->db->where('published', 1);
$CI->db->limit(5, 0);
$query=$CI->db->get('cm_post');
$posts = '<ul class="list-group">';
foreach ($query->result_array() as $c):
$posts .= '<li class="list-group-item"><a href="'.BASE_URL.'/article/'.$c['postURL'].'">'.$c['postTitle'].'</a></li>';
endforeach;
$posts .= "</ul>";
echo $posts;
}
//Get the Latest news for the main column
function getLatestNews($limit=10, $offset=0)
{
$CI =& get_instance();
$CI->db->order_by("unixStamp", "desc");
$CI->db->where('published', 1);
$CI->db->limit($limit, $offset);
$query=$CI->db->get('cm_post');
$posts = '';
foreach ($query->result_array() as $c):
$date = new DateTime($c['datePosted']);
$posts .= '<div class="row">';
if ($c['postImage'] != "") {
$posts .= '<div class="col-md-3"><a href="'.BASE_URL.'/article/'.$c['postURL'].'"><img class="img-responsive" src="'.BASE_URL.'/images/'.$c['postImage'].'" alt="'.$c['postTitle'].'"/></a></div>';
$posts .= '<div class="col-md-9"><h3><a href="'.BASE_URL.'/article/'.$c['postURL'].'">'.$c['postTitle'].'</a></h3>';
$posts .= '<p class="meta">'.date_format($date, 'd/m/Y').'</p>';
$posts .= '<p>'.$c['postExcerpt'].'</p>';
$posts .= '<p><a class="btn btn-primary" href="'.BASE_URL.'/article/'.$c['postURL'].'">Read More</a></p>';
} else {
$posts .= '<div class="col-md-12"><h3><a href="'.BASE_URL.'/article/'.$c['postURL'].'">'.$c['postTitle'].'</a></h3>';
$posts .= '<p class="meta">'.date_format($date, 'd/m/Y').'</p>';
$posts .= '<p>'.$c['postExcerpt'].'</p>';
$posts .= '<p><a class="btn btn-primary" href="'.BASE_URL.'/article/'.$c['postURL'].'">Read More</a></p>';
}
$posts .= '</div>';
$posts .= "</div><hr />";
endforeach;
echo $posts;
}
//Get the categories
function getCategories()
{
$CI =& get_instance();
$CI->db->order_by("categoryTitle", "asc");
$query=$CI->db->get('cm_post_category');
$categories = '<ul class="list-group">';
foreach ($query->result_array() as $c):
$CI->db->where('categoryID', $c['categoryID']);
$CI->db->where('published', 1);
$CI->db->from('cm_post');
$query = $CI->db->get();
$totPosts = $query->num_rows();
if ($totPosts > 0) {
$categories .= '<li class="list-group-item"><a href="'.BASE_URL.'/category/'.$c['categorySlug'].'"><span class="badge">'.$totPosts.'</span>'.$c['categoryTitle'].'</a></li>';
}
endforeach;
$categories .= "</ul>";
echo $categories;
}
//Get the total posts
function countPosts($limit=10, $offset=0)
{
$CI =& get_instance();
$CI->db->from('cm_post');
$CI->db->where('published', 1);
$query = $CI->db->get();
$totPosts = $query->num_rows();
$showing = $offset+$limit;
if ($showing > $totPosts) {
$showing = $totPosts;
}
$offset++;
echo "Showing posts ".$offset." - ".$showing." of ".$totPosts;
}
function countCategoryPosts($categoryID, $limit=10, $offset=0)
{
$CI =& get_instance();
$CI->db->from('cm_post');
$CI->db->where('categoryID', $categoryID);
$CI->db->where('published', 1);
$query = $CI->db->get();
$totPosts = $query->num_rows();
$showing = $offset+$limit;
if ($showing > $totPosts) {
$showing = $totPosts;
}
$offset++;
echo "Showing posts ".$offset." - ".$showing." of ".$totPosts;
}
function getPrevBtnCategory($categoryID, $limit=10, $offset=0)
{
$CI =& get_instance();
$totSegments = $CI->uri->total_segments();
$i=1;
$pagURL = "";
while ($i <= $totSegments) {
if (!is_numeric($CI->uri->segment($i))) {
$pagURL .= "/".$CI->uri->segment($i);
}
$i++;
}
$CI->db->from('cm_post');
$CI->db->where('categoryID', $categoryID);
$CI->db->where('published', 1);
$query = $CI->db->get();
$totPosts = $query->num_rows();
$showing = $offset+$limit;
if ($showing > $totPosts) {
$showing = $totPosts;
}
$prevNum = $offset-$limit;
if ($prevNum < 0) {
$prevNum = 0;
}
if ($prevNum < $offset) {
echo '<a href="'.BASE_URL.$pagURL.'/'.$prevNum.'" class="btn btn-success float-left">Previous</a>';
}
}
function getNextBtnCategory($categoryID, $limit=10, $offset=0)
{
$CI =& get_instance();
$totSegments = $CI->uri->total_segments();
$i=1;
$pagURL = "";
while ($i <= $totSegments) {
if (!is_numeric($CI->uri->segment($i))) {
$pagURL .= "/".$CI->uri->segment($i);
}
$i++;
}
$CI->db->from('cm_post');
$CI->db->where('published', 1);
$CI->db->where('categoryID', $categoryID);
$query = $CI->db->get();
$totPosts = $query->num_rows();
$showing = $offset+$limit;
if ($showing > $totPosts) {
$showing = $totPosts;
}
$offset++;
$nextNum = $offset+$limit;
if ($nextNum > $totPosts) {
} elseif ($nextNum <= $totPosts) {
$nextNum--;
echo '<a href="'.BASE_URL.$pagURL.'/'.$nextNum.'" class="btn btn-success float-right">Next</a>';
}
}
function getPrevBtn($limit=10, $offset=0)
{
$CI =& get_instance();
$totSegments = $CI->uri->total_segments();
$i=1;
$pagURL = "";
while ($i <= $totSegments) {
if (!is_numeric($CI->uri->segment($i))) {
$pagURL .= "/".$CI->uri->segment($i);
}
$i++;
}
$CI->db->where('published', 1);
$CI->db->from('cm_post');
$query = $CI->db->get();
$totPosts = $query->num_rows();
$showing = $offset+$limit;
if ($showing > $totPosts) {
$showing = $totPosts;
}
$prevNum = $offset-$limit;
if ($prevNum < 0) {
$prevNum = 0;
}
if ($prevNum < $offset) {
echo '<a href="'.BASE_URL.$pagURL.'/'.$prevNum.'" class="btn btn-success float-left">Previous</a>';
}
}
function getNextBtn($limit=10, $offset=0)
{
$CI =& get_instance();
$totSegments = $CI->uri->total_segments();
$i=1;
$pagURL = "";
while ($i <= $totSegments) {
if (!is_numeric($CI->uri->segment($i))) {
$pagURL .= "/".$CI->uri->segment($i);
}
$i++;
}
$CI->db->where('published', 1);
$CI->db->from('cm_post');
$query = $CI->db->get();
$totPosts = $query->num_rows();
$showing = $offset+$limit;
if ($showing > $totPosts) {
$showing = $totPosts;
}
$offset++;
$nextNum = $offset+$limit;
if ($nextNum > $totPosts) {
} elseif ($nextNum <= $totPosts) {
$nextNum--;
echo '<a href="'.BASE_URL.$pagURL.'/'.$nextNum.'" class="btn btn-success float-right">Next</a>';
}
}
//Get the Latest news for the main column
function getCategoryNews($categoryID, $limit=10, $offset=0)
{
$CI =& get_instance();
$CI->db->order_by("unixStamp", "desc");
$CI->db->limit($limit, $offset);
$CI->db->where('categoryID', $categoryID);
$CI->db->where('published', 1);
$query=$CI->db->get('cm_post');
$posts = '';
foreach ($query->result_array() as $c):
$date = new DateTime($c['datePosted']);
$posts .= '<div class="row">';
if ($c['postImage'] != "") {
$posts .= '<div class="col-md-3"><a href="'.BASE_URL.'/article/'.$c['postURL'].'"><img class="img-responsive" src="'.BASE_URL.'/images/'.$c['postImage'].'" alt="'.$c['postTitle'].'"/></a></div>';
$posts .= '<div class="col-md-9"><h3><a href="'.BASE_URL.'/article/'.$c['postURL'].'">'.$c['postTitle'].'</a></h3>';
$posts .= '<p class="meta">'.date_format($date, 'd/m/Y').'</p>';
$posts .= '<p>'.$c['postExcerpt'].'</p>';
$posts .= '<p><a class="btn btn-primary" href="'.BASE_URL.'/article/'.$c['postURL'].'">Read More</a></p>';
} else {
$posts .= '<div class="col-md-12"><h3><a href="'.BASE_URL.'/article/'.$c['postURL'].'">'.$c['postTitle'].'</a></h3>';
$posts .= '<p class="meta">'.date_format($date, 'd/m/Y').'</p>';
$posts .= '<p>'.$c['postExcerpt'].'</p>';
$posts .= '<p><a class="btn btn-primary" href="'.BASE_URL.'/article/'.$c['postURL'].'">Read More</a></p>';
}
$posts .= '</div>';
$posts .= "</div><hr />";
endforeach;
echo $posts;
}
//Get the carousel
function getCarousel($id)
{
$CI =& get_instance();
$CI->db->order_by("slideOrder", "asc");
$CI->db->where("pageID", $id);
$query=$CI->db->get('cm_banner');
$carousel = '<ol class="carousel-indicators">'."\r\n";
$s = 0;
foreach ($query->result_array() as $c):
if ($s == 0) {
$carousel .= '<li data-target="#carousel" data-slide-to="'.$s.'" class="active"></li>'."\r\n";
} else {
$carousel .= '<li data-target="#carousel" data-slide-to="'.$s.'"></li>'."\r\n";
}
$s++;
endforeach;
$s = 0;
$carousel .= '</ol><div class="carousel-inner" role="listbox">'."\r\n";
foreach ($query->result_array() as $c):
if ($s == 0) {
$carousel .= '<div class="item active">'."\r\n";
if ($c['slideLink'] != "") {
$carousel .= '<a target="_blank" href="'.$c['slideLink'].'">'."\r\n";
}
$carousel .= '<img src="'.BASE_URL."/uploads/".$c['slideImage'].'" alt="'.$c['slideAlt'].'">'."\r\n";
if ($c['slideLink'] != "") {
$carousel .= '</a>'."\r\n";
}
$carousel .= '</div>'."\r\n";
} else {
$carousel .= '<div class="item">'."\r\n";
if ($c['slideLink'] != "") {
$carousel .= '<a target="_blank" href="'.$c['slideLink'].'">'."\r\n";
}
$carousel .= '<img src="'.BASE_URL."/uploads/".$c['slideImage'].'" alt="'.$c['slideAlt'].'">'."\r\n";
if ($c['slideLink'] != "") {
$carousel .= '</a>'."\r\n";
}
$carousel .= '</div>'."\r\n";
}
$s++;
endforeach;
$carousel .= "</div>"."\r\n";
echo $carousel;
}
//Get social
function getSocial()
{
$CI =& get_instance();
$CI->db->where("socialEnabled", 1);
$query=$CI->db->get('cm_social');
$social = '';
foreach ($query->result_array() as $c):
$social .= '<a href="'.$c['socialLink'].'" target="_blank"><span class="socicon socicon-'.$c['socialName'].'"></span></a>';
endforeach;
echo $social;
}

11
application/helpers/index.html Executable file
View File

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

View File

@@ -0,0 +1,57 @@
<?php
function getCho($col, $idx, $f_word)
{
// echo "getCho:" . $idx . "," . $f_word . "<br>";
if($f_word == 'ㄱ')
return " substr({$col},{$idx},1) between '가' and '낗'";
else if($f_word == 'ㄴ')
return " substr({$col},{$idx},1) between '나' and '닣'";
else if($f_word == 'ㄷ')
return " substr({$col},{$idx},1) between '다' and '띻'";
else if($f_word == 'ㄹ')
return " substr({$col},{$idx},1) between '라' and '맇'";
else if($f_word == 'ㅁ')
return " substr({$col},{$idx},1) between '마' and '밓'";
else if($f_word == 'ㅂ')
return " substr({$col},{$idx},1) between '바' and '삫'";
else if($f_word == 'ㅅ')
return " substr({$col},{$idx},1) between '사' and '앃'";
else if($f_word == 'ㅇ')
return " substr({$col},{$idx},1) between '아' and '잏'";
else if($f_word == 'ㅈ')
return " substr({$col},{$idx},1) between '자' and '찧'";
else if($f_word == 'ㅊ')
return " substr({$col},{$idx},1) between '차' and '칳'";
else if($f_word == 'ㅋ')
return " substr({$col},{$idx},1) between '카' and '킿'";
else if($f_word == 'ㅌ')
return " substr({$col},{$idx},1) between '타' and '팋'";
else if($f_word == 'ㅍ')
return " substr({$col},{$idx},1) between '파' and '핗'";
else if($f_word == 'ㅎ')
return " substr({$col},{$idx},1) between '하' and '힣'";
else
return " substr({$col},{$idx},1) = '{$f_word}'";
}
function splitCho($term) {
$i = 0;
$chos = array();
for ($i = 0; $i < mb_strlen($term,"UTF-8"); $i++) {
$char = mb_substr($term, $i, 1, 'UTF-8');
array_push($chos, $char);
}
return $chos;
}
function getSqlCho($colume, $term) {
$sql = "";
$i = 1;
foreach (splitCho($term) as $ch) {
$sql .= ($i == 1 ? "" : " AND ") . getCho($colume, $i++, $ch);
}
return $sql;
}

11
application/hooks/index.html Executable 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>

11
application/index.html Executable file
View File

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

View File

@@ -0,0 +1,308 @@
<?php
//Navigation Bar
$lang['nav_dash'] = "Dashboard";
$lang['nav_pages'] = "Pages";
$lang['nav_pages_new'] = "New Page";
$lang['nav_pages_all'] = "All Pages";
$lang['nav_posts'] = "Posts";
$lang['nav_posts_new'] = "New Post";
$lang['nav_posts_all'] = "All Posts";
$lang['nav_categories_new'] = "New Category";
$lang['nav_categories_all'] = "All Categories";
$lang['nav_users'] = "Users";
$lang['nav_users_new'] = "New User";
$lang['nav_users_all'] = "All Users";
$lang['nav_navigation'] = "Navigation";
$lang['nav_navigation_new'] = "New Navigation Menu";
$lang['nav_navigation_all'] = "All Menus";
$lang['nav_settings'] = "Settings";
$lang['nav_social'] = "Social";
$lang['nav_view_site'] = "View Site";
$lang['nav_logout'] = "Logout";
$lang['nav_profile'] = "Profile";
$lang['nav_webtoons'] = "Webtoons";
$lang['nav_webtoons_category'] = "Category";
$lang['nav_webtoons_all'] = "ALL Webtoons";
$lang['nav_webtoons_episode'] = "Episode";
$lang['nav_webtoons_announcement'] = "Announcement";
$lang['nav_webtoons_cartoonist'] = "Cartoonist";
//Login Page
$lang['login_message'] = "Please provide your details";
$lang['login_username'] = "Username";
$lang['login_password'] = "Password";
$lang['login_signin'] = "Sign In";
$lang['login_reset'] = "Reset Password";
$lang['login_incorrect'] = "The Username of Password entered is incorrect.";
$lang['login_expired'] = "Your session has expired, please use the form below to sign back in!";
//Forgot Password
$lang['forgot_reset'] = "Password Reset";
$lang['forgot_email'] = "Email Address";
$lang['forgot_password'] = "New Password";
$lang['forgot_confirm'] = "Confirm Password";
$lang['forgot_complete'] = "Your password has been reset";
$lang['forgot_btn'] = "Reset";
$lang['forgot_check_email'] = "Please check your email for further instructions";
//Dashboard
$lang['dash_welcome'] = "Welcome <small>to Crossmap Admin</small>";
$lang['dash_unreachable'] = "The news feed cannot be reached.";
$lang['dash_recent'] = "Recently Updated Contents";
$lang['dash_maintenance_message'] = "Your site is currently in maintenance mode, visit the settings page to disable this and allow visitors to view your site.";
$lang['dash_message'] = "Crossmap Website";
$lang['feed_heading'] = "Recent News";
//Settings Page
$lang['settings_header'] = "Settings";
$lang['settings_message'] = "Some basic settings for your site ";
$lang['settings_info'] = "Information";
$lang['settings_name'] = "Site Name*";
$lang['settings_footer'] = "Site Footer Message";
$lang['settings_theme'] = "Current Theme:";
$lang['settings_lang'] = "Current Dash Language:";
$lang['settings_logo'] = "Site Logo";
$lang['settings_favicon'] = "Site Favicon";
$lang['settings_maintenance'] = "Enable Maintenance Mode?";
$lang['settings_maintenance_heading'] = "Maintenance Page Heading:";
$lang['settings_maintenance_meta'] = "Maintenance Page Meta Description";
$lang['settings_maintenance_content'] = "Maintenance Page Content:";
$lang['settings_additional_js'] = "Additional Javascript (such as Google Analytics) this will be loaded into all pages, remember to include script tags where necessary:";
$lang['settings_image_error'] = "Error! The file is not an image.";
//Page - All Pages
$lang['pages_header'] = "All Pages";
$lang['pages_table_page'] = "Page";
$lang['pages_table_updated'] = "Updated";
$lang['pages_table_created'] = "Created";
$lang['pages_table_published'] = "Published";
$lang['pages_delete'] = "Delete page ";
$lang['pages_delete_message'] = "This is permanent and cannot be undone…";
$lang['pages_delete_home'] = "You cannot delete the home page…";
//Page - New Page/Edit Page
$lang['pages_new_header'] = "New Page";
$lang['pages_edit_header'] = "Edit Page";
$lang['pages_new_attributes'] = "Page Attributes";
$lang['pages_new_required'] = "All fields marked with * are required!";
$lang['pages_new_title'] = "Page/Meta Title*";
$lang['pages_new_nav'] = "Navigation Title* (this is displayed on navigation menus)";
$lang['pages_new_keywords'] = "Meta Keywords";
$lang['pages_new_description'] = "Meta Description";
$lang['pages_new_url'] = "Page URL* (no spaces or special characters allowed)";
$lang['pages_new_publish'] = "Publish Page?";
$lang['pages_new_template'] = "Page Template";
//Page - Jumbotron
$lang['pages_jumbo_intro'] = "a \"Jumbotron\" is a large heading area at the top of the page used for a hero message, image slider or both!";
$lang['pages_slider_header'] = "Image Slider";
$lang['pages_slider_btn'] = "Image Slider Options";
$lang['pages_slider_enable'] = "Enable Slider?";
$lang['pages_slider_add'] = "Add Slide";
$lang['pages_slider_title'] = "Slide";
$lang['pages_slider_alt'] = "Image Alt Tag";
$lang['pages_slider_link'] = "Image Link";
$lang['pages_jumbo_header'] = "Jumbotron Content";
$lang['pages_jumbo_header_att'] = "Jumbotron";
$lang['pages_jumbo_enable'] = "Enable Jumbotron?";
$lang['pages_jumbo_edit'] = "Edit Jumbotron";
//Posts - All Posts
$lang['posts_header'] = "All Posts";
$lang['comments_header'] = "All Comments";
$lang['pray_header'] = "All Pray";
$lang['posts_table_post'] = "Post Title";
$lang['posts_table_category'] = "Category";
$lang['posts_table_page'] = "Page";
$lang['posts_table_posted'] = "Date Posted";
$lang['posts_table_updated'] = "Date Updated";
$lang['posts_table_published'] = "Published";
$lang['posts_delete'] = "Delete post ";
$lang['comments_delete'] = "Delete comment ";
$lang['posts_delete_message'] = "This is permanent and cannot be undone…";
$lang['comments_delete_message'] = "This is permanent and cannot be undone…";
//Posts - New Post/Edit Post
$lang['posts_new_header'] = "New Post";
$lang['posts_edit_header'] = "Edit Post";
$lang['posts_new_attributes'] = "Post Attributes";
$lang['posts_new_required'] = "All fields marked with * are required!";
$lang['posts_new_title'] = "Title*";
$lang['posts_new_subtitle'] = "SubTitle";
$lang['posts_new_feature'] = "Feature Image";
$lang['posts_new_thumb'] = "Thumbnail Image";
$lang['posts_new_user'] = "Writer";
$lang['posts_new_excerpt'] = "Excerpt*";
$lang['posts_new_category'] = "Category";
$lang['posts_new_page'] = "Page";
$lang['posts_new_url'] = "Post URL* (no spaces or special characters allowed)";
$lang['posts_new_date'] = "Date";
$lang['posts_new_published'] = "Published?";
$lang['posts_new_tag'] = "Tags";
$lang['posts_reserved_date'] = "Reserved Date";
//Posts - All Categories
$lang['cat_header'] = "All Categories";
$lang['cat_table_category'] = "Category Title";
$lang['cat_delete'] = "Delete category ";
$lang['cat_delete_message'] = "This is permanent and cannot be undone…";
//Posts - New Category/Edit Category
$lang['cat_new_header'] = "New Category";
$lang['cat_edit_header'] = "Edit Category";
$lang['cat_new_required'] = "All fields marked with * are required!";
$lang['cat_new_title'] = "Category Title*";
$lang['cat_new_url'] = "Category URL Slug* (this should contain no special characters or spaces)";
$lang['cat_new_description'] = "Category Description";
//Users - All Users
$lang['user_header'] = "All Users";
$lang['user_username'] = "Username";
$lang['user_email'] = "Email Address";
$lang['user_delete'] = "Delete user ";
$lang['user_delete_message'] = "Make sure this is not your only user account";
//Users - New User/Edit User
$lang['user_new_header'] = "New User";
$lang['user_edit_header'] = "Edit User";
$lang['user_new_username'] = "Username";
$lang['user_new_message'] = "Your username is for logging in and cannot be changed.";
$lang['user_new_email'] = "Email Address";
$lang['user_new_pass'] = "Password";
$lang['user_new_confirm'] = "Confirm Password";
//Navigation - All Menus
$lang['menu_header'] = "All Menus";
$lang['menu_table_title'] = "Menu Title";
$lang['menu_delete'] = "Delete nav ";
$lang['menu_delete_message'] = "This is permanent and cannot be undone…";
$lang['menu_delete_message_header'] = "You cannot delete the header menu…";
//Navigation - New Menu/Edit Menu
$lang['menu_new_nav'] = "Navigation";
$lang['menu_new_pages'] = "Pages";
$lang['menu_new_nav_slug'] = "Nav Slug* (max 10 characters, no spaces allowed)";
$lang['menu_new_nav_title'] = "Nav Title*";
$lang['menu_new_add_page'] = "Add Pages";
$lang['menu_new_select_page'] = "Select a page";
$lang['menu_new_custom_title'] = "Custom link title";
$lang['menu_new_custom_link'] = "Custom link URL(include http://)";
$lang['menu_new_drop_down'] = "Add Drop Down Section";
$lang['menu_new_drop_title'] = "Title";
$lang['menu_new_drop_link'] = "URL Slug (this is added in to the URL, no spaces allowed)";
$lang['menu_new_drop_error'] = "Your drop down slug contains spaces or special characters";
//Social Page
$lang['social_header'] = "Social Settings";
$lang['social_message'] = "Here you can set up the links for your various social accounts.<br/>These links will appear in the specified area of your theme.";
$lang['social_enable'] = "To enable an icon tick the box beside it.";
$lang['social_twitter'] = "Twitter";
$lang['social_facebook'] = "Facebook";
$lang['social_google'] = "Google+";
$lang['social_pinterest'] = "Pinterest";
$lang['social_foursquare'] = "Foursquare";
$lang['social_linkedin'] = "LinkedIn";
$lang['social_myspace'] = "Myspace";
$lang['social_soundcloud'] = "Soundcloud";
$lang['social_spotify'] = "Spotify";
$lang['social_lastfm'] = "LastFM";
$lang['social_youtube'] = "YouTube";
$lang['social_vimeo'] = "Vimeo";
$lang['social_dailymotion'] = "DailyMotion";
$lang['social_vine'] = "Vine";
$lang['social_flickr'] = "Flickr";
$lang['social_instagram'] = "Instagram";
$lang['social_tumblr'] = "Tumblr";
$lang['social_reddit'] = "Reddit";
$lang['social_envato'] = "Envato";
$lang['social_github'] = "Github";
$lang['social_tripadvisor'] = "TripAdvisor";
$lang['social_stackoverflow'] = "Stack Overflow";
$lang['social_persona'] = "Mozilla Persona";
$lang['social_table_title'] = "Social Site";
$lang['social_table_link'] = "Profile Link";
$lang['social_table_enabled'] = "Enabled?";
// COMMON BUTTONS
$lang['btn_save'] = "Save";
$lang['btn_jumbotron'] = "Jumbotron";
$lang['btn_cancel'] = "Cancel";
$lang['btn_delete'] = "Delete";
$lang['btn_next'] = "Next";
$lang['btn_back'] = "Back";
$lang['btn_add'] = "Add";
$lang['option_yes'] = "Yes";
$lang['option_no'] = "No";
// EMAILS
$lang['email_reset_subject']= "Reset your password";
$lang['email_reset_message']= "Please click the link below to reset your password.";
// ERROR MESSAGES
$lang['no_results'] = "No results found.";
$lang['email_check'] = "This email address does not exist.";
$lang['required'] = "The %s field is required.";
$lang['isset'] = "The %s field must have a value.";
$lang['valid_email'] = "The %s field must contain a valid email address.";
$lang['valid_emails'] = "The %s field must contain all valid email addresses.";
$lang['valid_url'] = "The %s field must contain a valid URL.";
$lang['valid_ip'] = "The %s field must contain a valid IP.";
$lang['min_length'] = "The %s field must be at least %s characters in length.";
$lang['max_length'] = "The %s field can not exceed %s characters in length.";
$lang['exact_length'] = "The %s field must be exactly %s characters in length.";
$lang['alpha'] = "The %s field may only contain alphabetical characters.";
$lang['alpha_numeric'] = "The %s field may only contain alpha-numeric characters.";
$lang['alpha_dash'] = "The %s field may only contain alpha-numeric characters, underscores, and dashes.";
$lang['numeric'] = "The %s field must contain only numbers.";
$lang['is_numeric'] = "The %s field must contain only numeric characters.";
$lang['integer'] = "The %s field must contain an integer.";
$lang['regex_match'] = "The %s field is not in the correct format.";
$lang['matches'] = "The %s field does not match the %s field.";
$lang['is_unique'] = "This %s already exists.";
$lang['is_natural'] = "The %s field must contain only positive numbers.";
$lang['is_natural_no_zero'] = "The %s field must contain a number greater than zero.";
$lang['decimal'] = "The %s field must contain a decimal number.";
$lang['less_than'] = "The %s field must contain a number less than %s.";
$lang['greater_than'] = "The %s field must contain a number greater than %s.";
$lang['user_role'] = 'User Role';
$lang['user_name'] = 'User Name';
$lang['user_gender'] = 'User Gender';
$lang['user_mobile'] = 'User Mobile';
include __DIR__. "/admin_roles.php";

View File

@@ -0,0 +1,4 @@
<?php
$lang['nav_roles'] = "All Roles";
$lang['role_header'] = "All Roles";

View File

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

View File

@@ -0,0 +1,110 @@
<?php
//Webtoons - All webtoon
$lang['webtoon_header'] = "All Webtoon";
$lang['webtoon_table_thumbnail'] = "Thumbnail";
$lang['webtoon_table_name'] = "Webtoon Title";
$lang['webtoon_table_writer'] = "cartoonist";
$lang['webtoon_table_status'] = "Status";
$lang['webtoon_table_serial_date'] = "Serial Date";
$lang['webtoon_management'] = "management";
$lang['webtoon_delete'] = "Delete webtoon";
$lang['webtoon_delete_message'] = "This is permanent and cannot be undone…";
//Webtoons - New Webtoon/Edit Webtoon
$lang['webtoons_new_header'] = "New Webtoon";
$lang['webtoons_edit_header'] = "Edit Webtoon";
$lang['webtoons_new_attributes'] = "Webtoon Attributes";
$lang['webtoons_new_required'] = "All fields marked with * are required!";
$lang['webtoons_new_thumbnail'] = "Thumbnail*";
$lang['webtoons_new_cartoonists'] = "Cartoonist*";
$lang['webtoons_new_name'] = "name*";
$lang['webtoons_new_status'] = "Status*";
$lang['webtoons_new_serial_date'] = "Serial Date";
$lang['webtoons_new_description'] = "Meta Description";
//Webtoons - cartoonist
$lang['cartoonist_header'] = "Cartoonist";
$lang['cartoonist_table_number'] = "number";
$lang['cartoonist_table_name'] = "name";
$lang['cartoonist_table_homepage'] = "Hompage & Blog";
$lang['cartoonist_management'] = "management";
$lang['cartoonist_delete'] = "Delete cartoonist";
$lang['cartoonist_delete_message'] = "This is permanent and cannot be undone…";
//Webtoons - new cartoonist
$lang['cartoonists_new_attributes'] = "Cartoonist Attributes";
$lang['cartoonists_new_required'] = "All fields are required!";
$lang['cartoonists_new_name'] = "Name";
$lang['cartoonists_new_website'] = "Homepage & Blog";
//Webtoons - announcement
$lang['announcement_header'] = "Announcement";
$lang['announcement_table_number'] = "Number";
$lang['announcement_table_description'] = "Description";
$lang['announcement_table_reg_date'] = "Registration date";
$lang['announcement_table_period'] = "Announce Period";
$lang['announcement_management'] = "management";
$lang['announcement_delete'] = "Delete announcement";
$lang['announcement_delete_message'] = "This is permanent and cannot be undone…";
//Webtoons - new cartoonist
$lang['announcement_new_attributes'] = "Announcement Attributes";
$lang['announcement_new_required'] = "All fields are required!";
$lang['announcement_new_webtoon'] = "Webtoon";
$lang['announcement_new_description'] = "Description";
$lang['announcement_new_start_date'] = "Start Date";
$lang['announcement_new_end_date'] = "End Date";
//Webtoons - Episode
$lang['episode_header'] = "Episode";
$lang['episode_table_postID'] = "PostID";
$lang['episode_table_thumbnail'] = "Thumbnail";
$lang['episode_table_webtoonTitle'] = "Webtoon Title";
$lang['episode_table_cartoonist'] = "Cartoonist";
$lang['episode_table_postTitle'] = "Title";
$lang['episode_table_view_count'] = "View count";
$lang['episode_published'] = "published";
$lang['episode_posted_date'] = "Posted date";
$lang['episode_management'] = "management";
$lang['episode_delete'] = "Delete episode";
$lang['episode_delete_message'] = "This is permanent and cannot be undone…";
//Webtoons - New Episode/Edit Episode
$lang['episode_new_header'] = "New Episode";
$lang['episode_edit_header'] = "Edit Episode";
$lang['episode_new_attributes'] = "Episode Attributes";
$lang['episode_new_required'] = "All fields marked with * are required!";
$lang['episode_new_webtoon'] = "Webtoon*";
$lang['episode_new_title'] = "Title*";
$lang['episode_new_epNo'] = "Episode Number*";
$lang['episode_new_mainImage'] = "Main Image*";
$lang['episode_new_contents'] = "Contents* (Only Image)";
$lang['episode_new_postedDate'] = "Posted Date*";
//Webtoons - Category
$lang['wCategory_header'] = "WebtoonCategory";
$lang['wCategory_table_number'] = "Number";
$lang['wCategory_table_title'] = "Title";
$lang['wCategory_table_webtoonTitle'] = "Webtoon Title";
$lang['wCategory_table_cartoonist'] = "Cartoonist";
//Webtoons - New Episode/Edit Episode
$lang['episode_new_header'] = "New Episode";
$lang['episode_edit_header'] = "Edit Episode";
$lang['episode_new_attributes'] = "Episode Attributes";
$lang['episode_new_required'] = "All fields marked with * are required!";
$lang['episode_new_webtoon'] = "Webtoon*";
$lang['episode_new_title'] = "Title*";
$lang['episode_new_epNo'] = "Episode Number*";
$lang['episode_new_mainImage'] = "Main Image*";
$lang['episode_new_contents'] = "Contents* (Only Image)";
$lang['episode_new_postedDate'] = "Posted Date*";

11
application/language/index.html Executable 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>

214
application/libraries/Auth.php Executable file
View File

@@ -0,0 +1,214 @@
<?php
use Hybridauth\Provider\Facebook;
use Hybridauth\Provider\Twitter;
use GuzzleHttp\Client;
use DirkGroenen\Pinterest\Pinterest;
class Auth
{
private $CI;
private $response;
private $isRequest;
public function __construct($params = [])
{
$this->CI = get_instance();
}
public function setIsRequest($isRequest)
{
$this->isRequest = $isRequest;
return $this;
}
public function getResponse()
{
return $this->response;
}
public function auth($name = '')
{
$this->CI->config->load('social');
$method = $name ? $name : $this->CI->input->post('auth');
$method = $method ? $method : 'crossmap';
$this->$method();
}
private function crossmap()
{
$this->response = ['code' => 404];
$query = $this->CI->db->from('cm_user')
->where('userName', $this->CI->input->post('userName'))
->where('password', md5($this->CI->input->post('userPasswd')))->get();
if ($query->num_rows() == 1) {
$this->CI->load->library('session');
$user = [
'userName' => $this->CI->input->post('userName'),
'userID' => $query->row()->userID
];
$this->CI->session->set_userdata('auth', json_encode($user));
$this->response = [
'code' => 200
];
}else if($query->num_rows() > 1){
log_message('debug', 'duplicated users');
$this->response = [
'code' => 400
];
}else {
$this->response = [
'code' => 404
];
}
}
private function kakao()
{
if ($this->isRequest) {
redirect($this->CI->config->item('kakao_base_uri')
. '/oauth/authorize?client_id='
. $this->CI->config->item('kakao_app_key')
. '&redirect_uri='
. $this->CI->config->item('kakao_redirect_uri')
. '&response_type=code');
} else {
$code = $this->CI->input->get('code');
$client = new Client();
try {
$response = $client->request('POST', $this->CI->config->item('kakao_base_uri') . '/oauth/token', [
'form_params' => [
'grant_type' => 'authorization_code',
'client_id' => $this->CI->config->item('kakao_app_key'),
'redirect_uri' => $this->CI->config->item('kakao_redirect_uri'),
'code' => $code
]
]);
$response = json_decode($response->getBody());
$response = $client->request('POST', $this->CI->config->item('kakao_api_base_uri') . '/v2/user/me', [
'headers' => [
'Authorization' => 'Bearer ' . $response->access_token
],
'form_params' => ['property_keys' => ['kakao_account.email', 'kakao_account.age_range', 'kakao_account.birthday', 'kakao_account.gender']]
]);
$userProfile = $response->getBody();
log_mesage('info', $userProfile);
$this->connected('kakao', $userProfile);
} catch (GuzzleHttp\Exception\ClientException $e) {
log_message('debug', 'Kakao SNS login :: Oops, we ran into an issue! ClientException');
} catch (GuzzleHttp\Exception\RequestException $e) {
log_message('debug', 'Kakao SNS login :: Oops, we ran into an issue! RequestException');
}
}
}
private function facebook()
{
$config = [
'callback' => $this->CI->config->item('facebook_redirect_uri'),
'keys' => [
'id' => $this->CI->config->item('facebook_app_key'), //Required: your Facebook application id
'secret' => $this->CI->config->item('facebook_app_secret') //Required: your Facebook application secret
]
];
if ($this->isRequest) {
try {
$adapter = new Facebook($config);
$adapter->authenticate();
$isConnected = $adapter->isConnected();
$userProfile = $adapter->getUserProfile();
//Disconnect the adapter
$adapter->disconnect();
log_mesage('info', print_r($userProfile, ture));
$this->connected('facebook', $userProfile);
} catch (\Exception $e) {
echo 'Oops, we ran into an issue! ' . $e->getMessage();
}
}
}
private function twitter()
{
$config = [
'callback' => 'https://local.cmap.co.kr/oauth/twitter',
'keys' => [
'key' => $this->CI->config->item('twitter_app_key'),
'secret' => $this->CI->config->item('twitter_app_secret')
]
];
try {
$adapter = new Twitter($config);
$adapter->authenticate();
$accessToken = $adapter->getAccessToken();
$userProfile = $adapter->getUserProfile();
$adapter->disconnect();
// $apiResponse = $twitter->apiRequest('account/settings.json');
log_mesage('info', print_r($userProfile, ture));
$this->connected('twitter', $userProfile);
} catch (\Exception $e) {
log_message('debug', 'Twitter SNS login :: Oops, we ran into an issue!');
log_message('debug', $e->getMessage());
}
}
private function pinterest()
{
if ($this->isRequest) {
try {
$pinterest = new Pinterest($this->CI->config->item('pinterest_app_key'), $this->CI->config->item('pinterest_app_secret'));
$loginurl = $pinterest->auth->getLoginUrl($this->CI->config->item('pinterest_redirect_uri'), array('read_public'));
redirect($loginurl);
} catch (\Exception $e) {
log_message('debug', 'Pinterest SNS login :: Oops, we ran into an issue!');
log_message('debug', $e->getMessage());
}
} else {
$userProfile = '';
$this->connected('pinterest', $userProfile);
}
}
private function naver()
{
if ($this->isRequest) {
$url = 'https://nid.naver.com/oauth2.0/authorize?response_type=code&client_id='
. $this->CI->config->item('naver_app_key')
. '&redirect_uri='
. $this->CI->config->item('naver_redirect_uri')
. '&state='
. $this->CI->config->item('naver_app_state');
redirect($url);
}
}
private function connected($name, $userProfile)
{
$this->CI->library('session');
$username = $this->register($name, $userProfile);
if ($this->login($username, '')) { }
}
private function register($name, $userProfile)
{
return 'username';
}
public function login($username, $password)
{
$query = $this->db->where("userName", $username)->where("password", $password)->get("cm_user");
if ($query->num_rows() > 0) {
foreach ($query->result() as $rows) {
$data = array(
'userID' => $rows->userID,
'userName' => $rows->userName,
'logged_in' => true,
);
$this->session->set_userdata($data);
return true;
}
} else {
return false;
}
}
}

127
application/libraries/Cacher.php Executable file
View File

@@ -0,0 +1,127 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
use PHPHtmlParser\Dom;
class Cacher
{
private $CI;
public function __construct($params = [])
{
$this->CI = &get_instance();
$this->cache = &$this->CI->cache;
}
public function melon()
{
$hostUrl = 'https://www.melon.com';
$path = '/genre/song_list.htm?gnrCode=GN2100';
return $this->get($hostUrl . $path, '.service_list_song table tbody tr', 'melon', function ($s) {
preg_match_all('/\d+/', $s->find('.wrap a')[0]->getAttribute('href'), $matches);
return [
'img' => $s->find('img')->getAttribute('src'),
'url' => 'https://www.melon.com/album/detail.htm?albumId=' . $matches[0][0],
'title' => $s->find('.wrap_song_info a')->innerHtml,
'album' => $s->find('.wrap_song_info .rank02 a')->innerHtml,
];
});
}
public function chtoday($section, $article = null)
{
if ($article) {
return $this->get($article, 'article', null, function ($a) {
return [
'subtitle' => '',
'article' => $a->find('.article-body')->innerHtml
];
});
} else {
return $this->get('http://www.christiantoday.co.kr/' . $section, '.section-2 article', null, function ($a) {
return [
'img' => $a->find('figure img')->getAttribute('src'),
'url' => 'http://www.christiantoday.co.kr' . parse_url($a->find('a')[0]->getAttribute('href'))['path'],
'title' => $a->find('h4 a')->innerHtml,
'postExcerpt' => $a->find('summary')->innerHtml,
];
});
}
}
public function chdaily($section, $article = null)
{
if ($article) {
return $this->get($article, 'article', null, function ($a) {
return [
'subtitle' => '',
'article' => $a->find('section')->innerHtml
];
});
} else {
return $this->get('http://www.christianitydaily.com/' . $section, '.news-list-section article', null, function ($a) {
return [
'img' => $a->find('figure img')->getAttribute('src'),
'url' => 'http://www.christianitydaily.com' . parse_url($a->find('a')[0]->getAttribute('href'))['path'],
'title' => $a->find('h4 a')->innerHtml,
'postExcerpt' => $a->find('p')->innerHtml,
];
});
}
}
public function chdailykr($section, $article = null)
{
if ($article) {
return $this->get($article, 'article', null, function ($a) {
return [
'subtitle' => count($a->find('.article-sttl')) ? $a->find('.article-sttl')->innerHtml : '',
'article' => $a->find('.article-txt')->innerHtml
];
});
} else {
return $this->get('http://www.christiandaily.co.kr/' . $section, '.bk-listbasic1 li', null, function ($a) {
return [
'img' => $a->find('img')->getAttribute('src'),
'url' => 'http://www.christiandaily.co.kr' . parse_url($a->find('a')[0]->getAttribute('href'))['path'],
'title' => $a->find('h3')->innerHtml,
'postExcerpt' => $a->find('p')->innerHtml,
];
});
}
}
/**
* Get remote HTML, parsing and save it in cache file.
*
* @param string $url
* @param string $selecor
* @param string $cacheName
* @param callable $fn
* @return void
*/
private function get($url, $selecor, $cacheName, $fn)
{
if (is_null($cacheName) || !$data = $this->cache->get($cacheName)) {
$dom = new Dom;
$dom->loadFromUrl($url);
$tags = $dom->find($selecor);
if ($tags) {
$data = [];
foreach ($tags as $t) {
try {
array_push($data, $fn($t));
} catch (Exception $e) {
continue;
}
}
if (!is_null($cacheName) && count($data) > 5) {
$this->cache->save($cacheName, $data, 60 * 60);
}
}
}
return $data;
}
}

View File

@@ -0,0 +1,23 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Form_validation extends CI_Form_validation {
public function is_unique($str, $field)
{
if (substr_count($field, '.')==3)
{
list($table,$field,$id_field,$id_val) = explode('.', $field);
$query = $this->CI->db->limit(1)->where($field,$str)->where($id_field.' != ',$id_val)->get($table);
} else {
list($table, $field)=explode('.', $field);
$query = $this->CI->db->limit(1)->get_where($table, array($field => $str));
}
return $query->num_rows() === 0;
}
}
// END MY Form Validation Class
/* End of file MY_Form_validation.php */
/* Location: ./application/libraries/MY_Form_validation.php */

View File

@@ -0,0 +1,254 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Native Session using Memcached
*
* Another session library extension that uses Native PHP session
* mechanism instead of the original Codeigniter cookie-based way.
* It also takes memcached as the session data storage, which will
* boost the performance of your app.
*
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author Saturn <yangg.hu@gmail.com>
* @license The MIT license
* @link https://github.com/cnsaturn/codeigniter-my-session
*/
// Set session configs...
new Cache_Session_Handler;
session_start();
Class MY_Session Extends CI_Session
{
/**
* Session Constructor
*
* The constructor runs the session routines automatically
* whenever the class is instantiated.
*/
public function __construct($params = array())
{
parent::__construct($params);
}
// --------------------------------------------------------------------
/**
* Fetch the current session data if it exists
*
* @access public
* @return bool
*/
public function sess_read()
{
// Fetch the cookie
$session = $_SESSION;
// Is the session data we unserialized an array with the correct format?
if ( ! is_array($session) OR ! isset($session['session_id']) OR ! isset($session['ip_address']) OR ! isset($session['user_agent']) OR ! isset($session['last_activity']))
{
log_message('debug', 'A session was not found.');
$this->sess_destroy(FALSE);
return FALSE;
}
// Is the session current?
if (($session['last_activity'] + $this->sess_expiration) < $this->now)
{
$this->sess_destroy(FALSE);
return FALSE;
}
// Does the IP Match?
if ($this->sess_match_ip == TRUE AND $session['ip_address'] != $this->CI->input->ip_address())
{
$this->sess_destroy(FALSE);
return FALSE;
}
// Does the User Agent Match?
if ($this->sess_match_useragent == TRUE AND trim($session['user_agent']) != trim(substr($this->CI->input->user_agent(), 0, 120)))
{
$this->sess_destroy(FALSE);
return FALSE;
}
// Session is valid!
$this->userdata = $session;
unset($session);
return TRUE;
}
// --------------------------------------------------------------------
/**
* Write the session data
*
* @access public
* @return void
*/
public function sess_write()
{
// set the custom userdata, the session data we will set in a second
$_SESSION = array();
foreach($this->userdata as $key => $val)
{
$_SESSION[$key] = $val;
}
}
// --------------------------------------------------------------------
/**
* Create a new session
*
* @access public
* @return void
*/
public function sess_create()
{
if(session_id() == '')
{
session_start();
}
$_SESSION['session_id'] = session_id();
$_SESSION['ip_address'] = $this->CI->input->ip_address();
$_SESSION['user_agent'] = substr($this->CI->input->user_agent(), 0, 120);
$_SESSION['last_activity'] = $this->now;
$this->userdata = $_SESSION;
}
// --------------------------------------------------------------------
/**
* Update an existing session
*
* @access public
* @return void
*/
public function sess_update()
{
// We only update the session every five minutes by default
if(($this->userdata['last_activity'] + $this->sess_time_to_update) >= $this->now)
{
return;
}
// Regenerate session id
session_regenerate_id();
// Update the session data in the session data array
$this->userdata['session_id'] = session_id();
$this->userdata['last_activity'] = $this->now;
}
// --------------------------------------------------------------------
/**
* Destroy the current session
*
* @access public
* @return void
*/
public function sess_destroy($destroy = TRUE)
{
session_unset();
session_regenerate_id();
if($destroy)
{
session_destroy();
}
}
// --------------------------------------------------------------------
/**
* Does nothing for native sessions
*
* @access public
* @return void
*/
public function _sess_gc(){}
}
// Customize the PHP Session handler
// @see http://php.net/manual/en/function.session-set-save-handler.php
class Cache_Session_Handler
{
private $_lifetime = 0;
private $_CI;
public function __construct()
{
session_name(config_item('sess_cookie_name'));
session_set_save_handler(
array($this, "open"),
array($this, "close"),
array($this, "read"),
array($this, "write"),
array($this, "destroy"),
array($this, "gc")
);
// Ref the 'CI' super global object
$this->_CI = & get_instance();
if( ! $this->_CI->load->is_loaded('cache'))
{
// Make sure your 2.0+ CI Cache driver library is loaded
// and set as the primary cache solution
$this->_CI->load->driver(
'cache',
array('adapter' => 'memcached', 'backup' => 'file'
));
}
}
public function open()
{
$this->_lifetime = ini_get('session.gc_maxlifetime');
if($this->_lifetime <= config_item('sess_expiration'))
{
$this->_lifetime = config_item('sess_expiration');
}
return TRUE;
}
public function read($id)
{
return $this->_CI->cache->get("sess_{$id}");
}
public function write($id, $data)
{
return $this->_CI->cache->replace("sess_{$id}", $data, $this->_lifetime);
}
public function destroy($id)
{
return $this->_CI->cache->delete("sess_{$id}");
}
public function gc()
{
return TRUE;
}
public function close()
{
return TRUE;
}
public function __destruct()
{
session_write_close();
}
}

View File

@@ -0,0 +1,212 @@
<?php
class MobileCertification
{
private $CI;
public function __construct($params = [])
{
$this->CI = &get_instance();
$this->input = &$this->CI->input;
$this->output = &$this->CI->output;
}
public function mobile_auth_callback()
{
# request
$rec_cert = trim($this->input->get_post('rec_cert', TRUE));
$certNum = trim($this->input->get_post('certNum', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if (strlen($rec_cert) == 0 || strlen($certNum) == 0) {
gf_alert('본인인증에 실패했습니다.', 'self_close');
exit;
}
$iv = $certNum;
//암호화모듈 호출
if (extension_loaded('ICERTSecu')) {
//01.인증결과 1차 복호화
$rec_cert = ICertSeed(2, 0, $iv, $rec_cert);
//02.복호화 데이터 Split (rec_cert 1차암호화데이터 / 위변조 검증값 / 암복화확장변수)
$decStr_Split = explode("/", $rec_cert);
$encPara = $decStr_Split[0]; //rec_cert 1차 암호화데이터
$encMsg = $decStr_Split[1]; //위변조 검증값
//03.인증결과 2차 복호화
$rec_cert = ICertSeed(2, 0, $iv, $encPara);
//04. 복호화 된 결과자료 "/"로 Split 하기
$decStr_Split = explode("/", $rec_cert);
$certNum = $decStr_Split[0];
$date = $decStr_Split[1];
$CI = $decStr_Split[2];
$phoneNo = $decStr_Split[3];
$phoneCorp = $decStr_Split[4];
$birthDay = $decStr_Split[5];
$gender = $decStr_Split[6];
$nation = $decStr_Split[7];
$name = $decStr_Split[8];
$result = $decStr_Split[9];
$certMet = $decStr_Split[10];
$ip = $decStr_Split[11];
$M_name = $decStr_Split[12];
$M_birthDay = $decStr_Split[13];
$M_Gender = $decStr_Split[14];
$M_nation = $decStr_Split[15];
$plusInfo = $decStr_Split[16];
$DI = $decStr_Split[17];
//05. CI,DI 복호화
if (strlen($CI) > 0) $CI = ICertSeed(2, 0, $iv, $CI);
if (strlen($DI) > 0) $DI = ICertSeed(2, 0, $iv, $DI);
function paramChk($pattern, $param)
{
$result = preg_match($pattern, $param);
return $result;
}
// 요청번호 (최대 40byte까지 유효)
if (strlen($certNum) > 40 || strlen($certNum) == 0) {
gf_alert('요청번호 비정상', 'self_close');
exit;
}
// 요청일시 (숫자 14자리만 유효)
$patn = "/^[0-9]*$/";
if (strlen($date) != 14 || paramchk($patn, $date) == 0) {
gf_alert('휴대폰번호 비정상', 'self_close');
exit;
}
// 휴대폰번호 (값이 있는 경우에는 숫자 10 또는 11자리까지만 유효)
$patn = "/^[0-9]*$/";
if ((strlen($phoneNo) != 10 && strlen($phoneNo) != 11) || paramChk($patn, $phoneNo) == 0) {
gf_alert('휴대폰번호 비정상', 'self_close');
exit;
}
} else {
gf_alert('본인인증에 실패했습니다.', 'self_close');
exit;
}
$this->load->model('web/m_member');
if ($plusInfo == 'member_join1') {
$result = $this->m_member->member_where_mobile_CI_select($CI);
if (count($result) > 0) {
gf_alert('이미 가입되어있는 번호입니다.', 'self_close');
exit;
}
} else if ($plusInfo == 'member_join2') { // 14세 미만
$result = $this->m_member->member_where_parent_CI_select($CI);
if (count($result) > 0) {
gf_alert('이미 가입되어있는 부모님 번호입니다.', 'self_close');
exit;
}
} else if ($plusInfo == 'email_check') {
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['CI'] = $CI;
$count = $this->m_member->member_where_mobile_CI_member_id_count($req_data);
if ($count == 0) {
gf_alert('본인명의의 휴대폰 번호가 아닙니다.', 'self_close');
exit;
}
} else if ($plusInfo == 'member_edit') {
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['CI'] = $CI;
$count = $this->m_member->member_where_mobile_CI_member_id_count($req_data);
if ($count == 0) {
gf_alert('본인명의의 휴대폰 번호로만 변경가능합니다.', 'self_close');
exit;
}
}
$name = iconv("EUC-KR", "UTF-8", $name);
$return_data = array();
$return_data['CI'] = $CI;
$return_data['type'] = $plusInfo;
$return_data['name'] = $name;
$return_data['phone'] = $phoneNo;
# view
return $this->load->view('/web/comm/kmc_mobile_auth_fin', $return_data);
}
public function mobile_auth_encode()
{
# request
$mobile = trim($this->input->get_post('mobile', TRUE));
$type = trim($this->input->get_post('type', TRUE));
$mobile = str_replace('-', '', $mobile);
$cur_time = date('YmdHis');
$rand_no = rand(100000, 999999);
//요청 번호 생성
$cert_num = $cur_time . $rand_no;
$cpId = 'CRMM1001'; // 회원사ID
$urlCode = '003001'; // URL 코드
$certNum = $cert_num; // 요청번호
$date = $cur_time; // 요청일시
$certMet = 'M'; // 본인인증방법
$birthDay = ''; // 생년월일
$gender = ''; // 성별
$name = ''; // 성명
$phoneNo = $mobile; // 휴대폰번호
$phoneCorp = ''; // 이동통신사
$nation = ''; // 내외국인 구분
$plusInfo = $type; // 추가DATA정보
$extendVar = "0000000000000000"; // 확장변수
$name = str_replace(" ", "+", $name); //성명에 space가 들어가는 경우 "+"로 치환하여 암호화 처리
// 02. tr_cert 데이터변수 조합 (서버로 전송할 데이터 "/"로 조합)
$tr_cert = $cpId . "/" . $urlCode . "/" . $certNum . "/" . $date . "/" . $certMet . "/" . $birthDay . "/" . $gender . "/" . $name . "/" . $phoneNo . "/" . $phoneCorp . "/" . $nation . "/" . $plusInfo . "/" . $extendVar;
//암호화모듈 호출
$enc_tr_cert = '';
if (extension_loaded('ICERTSecu')) {
log_message('info', '========== ICERTSecu exteision loaded =========');
//03. 1차암호화
$enc_tr_cert = ICertSeed(1, 0, '', $tr_cert);
//04. 변조검증값 생성
$enc_tr_cert_hash = ICertHMac($enc_tr_cert);
//05. 2차암호화
$enc_tr_cert = $enc_tr_cert . "/" . $enc_tr_cert_hash . "/" . "0000000000000000";
$enc_tr_cert = ICertSeed(1, 0, '', $enc_tr_cert);
}else {
log_message('info', '========== ICERTSecu exteision not loaded =========');
}
if ($enc_tr_cert == '') {
$return_data['result'] = array('code' => '9999');
} else {
$return_data['result'] = array('code' => '0000', 'data' => $enc_tr_cert);
}
# view
$this->output
->set_status_header(200)
->set_content_type('application/json')
->set_output(json_encode($return_data));
}
}

View File

@@ -0,0 +1,253 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
* This class is written based entirely on the work found below
* www.techbytes.co.in/blogs/2006/01/15/consuming-rss-with-php-the-simple-way/
* All credit should be given to the original author
*
* Example:
$this->load->library('rssparser');
$this->rssparser->set_feed_url('http://example.com/feed');
$this->rssparser->set_cache_life(30);
$rss = $this->rssparser->getFeed(6); // Get six items from the feed
// Using a callback function to parse addictional XML fields
$this->load->library('rssparser', array($this, 'parseFile')); // parseFile method of current class
function parseFile($data, $item)
{
$data['summary'] = (string)$item->summary;
return $data;
}
*/
class RSSParser {
public $feed_uri = NULL; // Feed URI
public $data = FALSE; // Associative array containing all the feed items
public $channel_data = array(); // Store RSS Channel Data in an array
public $feed_unavailable = NULL; // Boolean variable which indicates whether an RSS feed was unavailable
public $cache_life = 0; // Cache lifetime
public $cache_dir = './hoosk/hoosk0/cache/'; // Cache directory
public $write_cache_flag = FALSE; // Flag to write to cache
public $callback = FALSE; // Callback to read custom data
function __construct($callback = FALSE)
{
if ($callback)
{
$this->callback = $callback;
}
}
// --------------------------------------------------------------------
function get_http_response_code($url) {
$headers = get_headers($url);
return substr($headers[0], 9, 3);
}
function parse()
{
// Are we caching?
if ($this->cache_life != 0)
{
$filename = $this->cache_dir.'rss_Parse_'.md5($this->feed_uri);
// Is there a cache file ?
if (file_exists($filename))
{
// Has it expired?
$timedif = (time() - filemtime($filename));
if ($timedif < ( $this->cache_life * 60))
{
$rawFeed = file_get_contents($filename);
}
else
{
// So raise the falg
$this->write_cache_flag = true;
}
}
else
{
// Raise the flag to write the cache
$this->write_cache_flag = true;
}
}
// Reset
$this->data = array();
$this->channel_data = array();
// Parse the document
if (!isset($rawFeed))
{
if($this->get_http_response_code($this->feed_uri) != "200"){
return false;
}else{
$rawFeed = file_get_contents($this->feed_uri);
}
}
$xml = new SimpleXmlElement($rawFeed, 0, false);
if ($xml->channel)
{
// Assign the channel data
$this->channel_data['title'] = $xml->channel->title;
$this->channel_data['description'] = $xml->channel->description;
// Build the item array
foreach ($xml->channel->item as $item)
{
$data = array();
$data['title'] = (string)$item->title;
$data['description'] = (string)$item->description;
$data['pubDate'] = (string)$item->pubDate;
$data['link'] = (string)$item->link;
$dc = $item->children('http://purl.org/dc/elements/1.1/');
$data['author'] = (string)$dc->creator;
if ($this->callback)
{
$data = call_user_func($this->callback, $data, $item);
}
$this->data[] = $data;
}
}
else
{
// Assign the channel data
$this->channel_data['title'] = $xml->title;
$this->channel_data['description'] = $xml->subtitle;
// Build the item array
foreach ($xml->entry as $item)
{
$data = array();
$data['id'] = (string)$item->id;
$data['title'] = (string)$item->title;
$data['description'] = (string)$item->content;
$data['pubDate'] = (string)$item->published;
$data['link'] = (string)$item->link['href'];
$dc = $item->children('http://purl.org/dc/elements/1.1/');
$data['author'] = (string)$dc->creator;
if ($this->callback)
{
$data = call_user_func($this->callback, $data, $item);
}
$this->data[] = $data;
}
}
// Do we need to write the cache file?
if ($this->write_cache_flag)
{
if (!$fp = @fopen($filename, 'wb'))
{
echo "RSSParser error";
log_message('error', "Unable to write cache file: ".$filename);
return;
}
flock($fp, LOCK_EX);
fwrite($fp, $rawFeed);
flock($fp, LOCK_UN);
fclose($fp);
}
return TRUE;
}
// --------------------------------------------------------------------
function set_cache_life($period = NULL)
{
$this->cache_life = $period;
return $this;
}
// --------------------------------------------------------------------
function set_feed_url($url = NULL)
{
$this->feed_uri = $url;
return $this;
}
// --------------------------------------------------------------------
/* Return the feeds one at a time: when there are no more feeds return false
* @param No of items to return from the feed
* @return Associative array of items
*/
function getFeed($num)
{
$this->parse();
$c = 0;
$return = array();
foreach ($this->data AS $item)
{
$return[] = $item;
$c++;
if ($c == $num)
{
break;
}
}
return $return;
}
// --------------------------------------------------------------------
/* Return channel data for the feed */
function & getChannelData()
{
$flag = false;
if (!empty($this->channel_data))
{
return $this->channel_data;
}
else
{
return $flag;
}
}
// --------------------------------------------------------------------
/* Were we unable to retreive the feeds ? */
function errorInResponse()
{
return $this->feed_unavailable;
}
// --------------------------------------------------------------------
/* Initialize the feed data */
function clear()
{
$this->feed_uri = NULL;
$this->data = FALSE;
$this->channel_data = array();
$this->cache_life = 0;
$this->callback = FALSE;
return $this;
}
}
/* End of file RSSParser.php */
/* Location: ./application/libraries/RSSParser.php */

View File

@@ -0,0 +1,50 @@
<?php
class Search
{
private $CI;
public function __construct($params = [])
{
$this->CI = &get_instance();
}
public function searchByPostTitle($postTitle, $limit, $exception = [], $activeQ = false)
{
$titleSegments = [];
foreach (explode(' ', $postTitle) as $k => $t) {
if (mb_strlen($t, 'utf-8') > ($activeQ ? 1 : 3)) array_push($titleSegments, $this->clean($t));
}
$this->CI->db
->join('cm_post_tag t', 'p.postID=t.postID', 'left')
->from('cm_post p');
foreach ($titleSegments as $k => $t) {
!$k ? $this->CI->db->like('postTitle', $t) : $this->CI->db->or_like('postTitle', $t);
$this->CI->db->or_like('tag', $t);
}
if ($activeQ) {
return $this->CI->db;
} else {
$rows = $this->CI->db->limit($limit + count($exception))
->get()->result();
return array_filter($rows, function ($row) use ($exception) {
if ($exception && count($exception)) {
$duplicated = false;
foreach ($exception as $ex) {
$duplicated = $row->postID == $ex;
}
return !$duplicated;
}
return true;
});
}
}
private function clean($string)
{
return trim(preg_replace('/[^\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}0-9a-zA-Z\s]/u', "", $string));
}
}

26
application/libraries/Sioen.php Executable file
View File

@@ -0,0 +1,26 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Sioen {
public function __construct()
{
require_once APPPATH.'third_party/Michelf/Markdown.inc.php';
require_once APPPATH.'third_party/Sioen/Converter.php';
require_once APPPATH.'third_party/Sioen/ToHtmlContext.php';
require_once APPPATH.'third_party/Sioen/ToJsonContext.php';
require_once APPPATH.'third_party/Sioen/Types/ConverterInterface.php';
require_once APPPATH.'third_party/Sioen/Types/BaseConverter.php';
require_once APPPATH.'third_party/Sioen/Types/BlockquoteConverter.php';
require_once APPPATH.'third_party/Sioen/Types/HeadingConverter.php';
require_once APPPATH.'third_party/Sioen/Types/IframeConverter.php';
require_once APPPATH.'third_party/Sioen/Types/ImageConverter.php';
require_once APPPATH.'third_party/Sioen/Types/ListConverter.php';
require_once APPPATH.'third_party/Sioen/Types/ParagraphConverter.php';
require_once APPPATH.'third_party/Sioen/Types/ColumnsConverter.php';
require_once APPPATH.'third_party/Sioen/Types/ButtonConverter.php';
require_once APPPATH.'third_party/Sioen/Types/AccordionConverter.php';
require_once APPPATH.'third_party/Sioen/Types/ImageExtendedConverter.php';
require_once APPPATH.'third_party/Sioen/Types/IframeExtendedConverter.php';
}
}

View File

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

View File

@@ -0,0 +1,59 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Category_model extends MY_Model
{
private $table = 'cm_category';
public function __construct()
{
parent::__construct();
}
public function getOne($categoryId)
{
return get_instance()->db->where_in('categoryID', $categoryId)->get('cm_category')->row();
}
public function getAll($categoryId)
{
$categoryId = is_array($categoryId) ? $categoryId : [$categoryId];
return get_instance()->db->where_in('categoryID', $categoryId)->get('cm_category')->result();
}
public function getSubcategoriesByCategoryId(int $categoryId) {
return $this->db->where('parentID', $categoryId)->get('cm_category')->result();
}
public function getTableCategoryTitle(&$rows)
{
$categories = get_instance()->db->get('cm_category')->result();
array_map(function ($r) use (&$rows, $categories) {
foreach ($rows as $k => $row) {
if ($row['postID'] == $r->postID) {
$rows[$k]['categoryID'] = $r->categoryID;
$rows[$k]['categories'][] = $r->categoryID;
foreach ($categories as $c) {
if ($c->categoryID == $r->categoryID) {
$rows[$k]['categoryTitle'] = (empty($rows[$k]['categoryTitle']) ? '' : $rows[$k]['categoryTitle'] . ', ') . $c->categoryTitle;
}
}
}
}
}, $this->getPostCategoryByPostIdIn(array_column($rows, 'postID')));
}
private function getPostCategoryByPostIdIn($postIds)
{
if (count($postIds) == 0) return [];
return $this->db->from('cm_post_category pc')->where_in('pc.postID', $postIds)->get()->result();
}
public function getCategoriesBySlug($slug) {
$slug = is_array($slug) ? $slug : [$slug];
return $this->db->where_in('categorySlug', $slug)->from($this->table);
}
}

332
application/models/Cmap_model.php Executable file
View File

@@ -0,0 +1,332 @@
<?php
require __DIR__ . '/Hoosk_model.php';
class Cmap_model extends Hoosk_model
{
public function __construct()
{
parent::__construct();
}
/* * *************************** */
/* * ** Setting Role Querys ************ */
/* * *************************** */
public function countRoles()
{
return $this->db->count_all('cm_setting_roles');
}
public function getRoles($limit, $offset = 0)
{
// Get a list of all user accounts
$query = $this->db->order_by("created_at", "desc")
->limit($limit, $offset)->get('cm_setting_roles');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function getRole($id)
{
// Get the user details
$query = $this->db->where("roleID", $id)->get('cm_setting_roles');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function createRole()
{
// Create the user account
$data = array(
'name' => $this->input->post('name'),
'slug' => $this->input->post('slug')
);
$this->db->insert('cm_setting_roles', $data);
}
public function updateRole($id)
{
// update the user account
$data = array(
'name' => $this->input->post('name'),
'slug' => $this->input->post('slug')
);
$this->db->where('roleID', $id);
$this->db->update('cm_setting_roles', $data);
}
public function removeRole($id)
{
// Delete a user account
$this->db->delete('cm_setting_roles', array('roleID' => $id));
}
function roleSearch($term)
{
$this->db->select("*");
$this->db->like("name", $term);
// $this->db->limit($limit, $offset);
$query = $this->db->get('cm_setting_roles');
if ($term == "") {
$this->db->limit(15);
}
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $r) :
echo '<tr>';
echo '<td>' . $r['name'] . '</td>';
echo '<td>' . $r['slug'] . '</td>';
echo '<td>' . $r['created_at'] . '</td>';
echo '<td class="td-actions"><a href="' . BASE_URL . '/admin/settings/roles/edit/' . $r['roleID']
. '" class="btn btn-small btn-success"><i class="fa fa-pencil"> '
. '</i></a> <a data-toggle="modal" data-target="#ajaxModal" class="btn btn-danger btn-small" href="'
. BASE_URL . '/admin/settings/roles/delete/' . $r['roleID'] . '"><i class="fa fa-remove"> </i></a></td>';
echo '</tr>';
echo '</tr>';
endforeach;
} else {
echo "<tr><td colspan='5'><p>" . $this->lang->line('no_results') . "</p></td></tr>";
}
}
public function categorySearch($term)
{
$this->load->helper('sql_search');
$this->db->from('cm_category');
$this->db->select("*");
$this->db->like("categoryTitle", $term);
$query = $this->db->query($this->db->get_compiled_select() . ' or ' . getSqlCho('categoryTitle', $term));
if ($term == "") {
$this->db->limit(15);
}
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $p) :
echo '<tr>';
echo '<td>' . $p['categoryTitle'] . '</td>';
echo '<td class="td-actions"><a href="' . BASE_URL . '/admin/posts/categories/edit/' . $p['categoryID'] . '" class="btn btn-small btn-success"><i class="fa fa-pencil"> </i></a> <a data-toggle="modal" data-target="#ajaxModal" class="btn btn-danger btn-small" href="' . BASE_URL . '/admin/posts/categories/delete/' . $p['categoryID'] . '"><i class="fa fa-remove"></i></a></td>';
echo '</tr>';
endforeach;
} else {
echo "<tr><td colspan='5'><p>" . $this->lang->line('no_results') . "</p></td></tr>";
}
}
public function countUsers()
{
$term = getSearchTerm();
return $this->db->from('cm_user u')->select("userName, r.name groupName, email, userID")
->join('cm_setting_roles r', 'u.roleID = r.roleID', 'left')
->like("userName", $term)
->or_like('r.name', $term)->count_all_results();
}
public function getUsers($limit, $offset = 0)
{
// Get a list of all user accounts
$term = getSearchTerm();
$this->load->helper('sql_search');
$query = $this->db->from('cm_user u')->select("userName, if(r.name is Null, 'None', r.name) groupName, email, userID")
->join('cm_setting_roles r', 'u.roleID = r.roleID', 'left')
->like("userName", $term)
->or_like('r.name', $term);
$query = $this->db->query($this->db->get_compiled_select() . ($term ? ' or ' . getSqlCho('userName', $term) : '') . ' order by u.dateUpdated desc');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function userSearch($term)
{
$this->load->helper('sql_search');
$query = $this->db->from('cm_user u')->select("userName, r.name groupName, email, userID")
->join('cm_setting_roles r', 'u.roleID = r.roleID', 'left')
->like("userName", $term)
->or_like('r.name', $term);
$query = $this->db->query($this->db->get_compiled_select() . ($term ? ' or ' . getSqlCho('userName', $term) : '') . ' order by u.dateUpdated desc');
if ($term == "") {
$this->db->limit(15);
}
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u) :
echo '<tr>';
echo '<td>' . $u['userName'] . '</td>';
echo '<td>' . $u['groupName'] . '</td>';
echo '<td>' . $u['email'] . '</td>';
echo '<td class="td-actions"><a href="' . BASE_URL . '/admin/users/edit/' . $u['userID'] . '" class="btn btn-small btn-success"><i class="fa fa-pencil"> </i></a> <a data-toggle="modal" data-target="#ajaxModal" class="btn btn-danger btn-small" href="' . BASE_URL . '/admin/users/delete/' . $u['userID'] . '"><i class="fa fa-remove"> </i></a></td>';
echo '</tr>';
endforeach;
} else {
echo "<tr><td colspan='5'><p>" . $this->lang->line('no_results') . "</p></td></tr>";
}
}
protected function addPostCategory($postID, $categories)
{
$tmp = [];
$this->db->where('postID', $postID)->delete('cm_post_category');
if (count($categories)) {
return $this->db->insert_batch('cm_post_category', array_filter(array_map(function ($category) use ($postID) {
return ['postID' => $postID, 'categoryID' => $category];
}, $categories), function ($c) use (&$tmp) {
$isDup = $c['categoryID'] ? false : true;
if (!$isDup) {
foreach ($tmp as $t) {
if ($t['categoryID'] == $c['categoryID']) {
$isDup = true;
break;
}
}
}
array_push($tmp, $c);
if (!$isDup) {
return $c;
}
}));
}
}
protected function addPostPage($postID, $pages)
{
$tmp = [];
$this->db->where('postID', $postID)->delete('cm_post_page');
if (count($pages)) {
return $this->db->insert_batch('cm_post_page', array_filter(array_map(function ($page) use ($postID) {
return ['postID' => $postID, 'pageID' => $page];
}, $pages), function ($c) use (&$tmp) {
$isDup = $c['pageID'] ? false : true;
if (!$isDup) {
foreach ($tmp as $t) {
if ($t['pageID'] == $c['pageID']) {
$isDup = true;
break;
}
}
}
array_push($tmp, $c);
if (!$isDup) {
return $c;
}
}));
}
}
public function getPostByCategoryId($categoryID, $limit = 15, $offset = 0)
{
$rows = [];
$this->db->select("cm_post.*, cm_category.categoryTitle");
$this->db->where("cm_category.categoryID", $categoryID);
$this->db->join('cm_category', 'cm_category.categoryID = cm_post.categoryID or cm_post.categoryID = 0', 'left');
$this->db->order_by("cm_post.postID", "desc");
$this->db->limit($limit, $offset);
return $this->db->get('cm_post')->result();
}
public function getPostByPageId($pageID, $limit = 15, $offset = 0)
{
$rows = [];
$this->db->select("cm_post.*, cm_category.categoryTitle");
if (is_array($pageID)) {
$this->db->where_in('cm_post.pageID', $pageID);
} else {
$this->db->where('cm_post.pageID', $pageID);
}
$this->db->join('cm_category', 'cm_category.categoryID = cm_post.categoryID or cm_post.categoryID = 0', 'left');
$this->db->order_by("cm_post.postID", "desc");
$this->db->group_by("cm_post.postID");
$this->db->limit($limit, $offset);
return $this->db->get('cm_post')->result();
}
public function createUser()
{
// Create the user account
$data = array(
'userName' => $this->input->post('username'),
'email' => $this->input->post('email'),
'password' => md5($this->input->post('password') . SALT),
'roleID' => $this->input->post('role'),
'name' => $this->input->post('name'),
'gender' => $this->input->post('gender'),
'mobile' => $this->input->post('mobile')
);
$this->db->insert('cm_user', $data);
}
public function updateUser($id)
{
// update the user account
$data = array(
'email' => $this->input->post('email'),
'email' => $this->input->post('email'),
'roleID' => $this->input->post('role'),
'name' => $this->input->post('name'),
'gender' => $this->input->post('gender'),
'mobile' => $this->input->post('mobile')
);
if ($this->input->post('password')) {
$data['password'] = md5($this->input->post('password') . SALT);
}
$this->db->where('userID', $id);
$this->db->update('cm_user', $data);
}
public function createPost()
{
$categoryID = 0;
$data = array(
'postTitle' => $this->input->post('postTitle'),
'categoryID' => $categoryID,
// 'postURL' => $this->input->post('postURL'),
// 'postContent' => $this->input->post('content'),
'postContentHTML' => $this->input->post('content'),
'postExcerpt' => $this->input->post('postExcerpt'),
'published' => $this->input->post('published'),
'datePosted' => date('Y-m-d H:i:s', strtotime($this->input->post('datePosted'))),
'dateUpdated' => date('Y-m-d H:i:s'),
'unixStamp' => $this->input->post('unixStamp'),
);
if ($this->input->post('postImage') != "") {
$data['postImage'] = $this->input->post('postImage');
}
$this->db->insert('cm_post', $data);
$insertID = $this->db->insert_id();
$this->addPostCategory($insertID, $this->input->post('categories') ? explode(',', $this->input->post('categories')) : []);
$this->addPostPage($insertID, $this->input->post('pages') ? explode(',', $this->input->post('pages')) : []);
$this->db->where('postID', $insertID)->update('cm_post', array('postURL' => $insertID));
}
public function updatePost($id)
{
$categoryID = 0;
$this->addPostCategory($id, $this->input->post('categories') ? explode(',', $this->input->post('categories')) : []);
$this->addPostPage($id, $this->input->post('pages') ? explode(',', $this->input->post('pages')) : []);
$data = array(
'postTitle' => $this->input->post('postTitle'),
'categoryID' => $categoryID,
// 'postURL' => $this->input->post('postURL'),
'postContentHTML' => $this->input->post('content'),
'postExcerpt' => $this->input->post('postExcerpt'),
'published' => $this->input->post('published'),
'datePosted' => date('Y-m-d H:i:s', strtotime($this->input->post('datePosted'))),
'dateUpdated' => date('Y-m-d H:i:s'),
'unixStamp' => $this->input->post('unixStamp'),
);
if ($this->input->post('postImage') != "") {
$data['postImage'] = $this->input->post('postImage');
}
$this->db->where("postID", $id);
$this->db->update('cm_post', $data);
}
}

View File

@@ -0,0 +1,270 @@
<?php
require __DIR__ . '/Hoosk_page_model.php';
class Cmap_page_model extends Hoosk_page_model
{
public function __construct()
{
parent::__construct();
}
public function getPageDelivery($pageID)
{
$this->db->join('cm_page_attributes', 'cm_page_attributes.pageID=cm_delivery.pageID');
return $this->db->where('cm_page_attributes.pageID', $pageID)->get('cm_delivery')->result();
}
public function getPostByParentCategoryId($parentID, $limit = 10, $offset = 0)
{
$rows = $this->db
->select('p.*,c.categorySlug')
->join('cm_category c', 'p.categoryID=c.categoryID', 'left')
->where('c.parentID', $parentID)
// ->where('p.published', 1)
->limit($limit)->offset($offset)
->order_by('p.datePosted', 'desc')
->get('cm_post p')->result();
return $rows;
}
public function getPagePostByParentCategoryId($parentID, $limit = 10, $offset = 0, $popular = '')
{
if (!empty($popular)) {
$this->db->join('cm_post_ranking pr', "p.postID=pr.postID and pr.title='$popular'", 'left')->order_by('pr.rating');
} else {
$this->db->order_by('p.dateUpdated', 'desc');
}
return $this->db
->select('p.*, pc.*, pa.pageURL, pc.pageTitle, pa.pageIcon')
->join('cm_category c', 'c.categoryID=p.categoryID or p.categoryID=0', 'left')
->join('cm_page_attributes pa', 'c.categoryID=pa.categoryID and p.pageID=pa.pageID', 'left')
->join('cm_page_content pc', 'pa.pageID=pc.pageID', 'left')
->where("pa.pagePublished", 1)
->where('p.published', 1)
->group_by('p.pageID')
->limit($limit)->offset($offset)
->get('cm_post p')->result();
}
public function getReporterByPostId($postId)
{
return $this->db->where('postID', $postId)->select('r.*, p.press_name, p.logo_img, p.homepage')
->join('cm_press p', 'r.pressID=p.pressID', 'left')
->get('cm_post_reporter r')->row();
}
public function getRankingByPostId($postId)
{
$ranking = ['V' => 0, 'R' => 0, 'L' => 0];
$rows = $this->db->where('postID', $postId)
->get('cm_post_ranking')->result();
foreach ($rows as $row) {
foreach ($ranking as $k => $r) {
if ($row->title == $k) {
$ranking[$k] = $row->rating;
}
}
}
return $ranking;
}
public function getPagePostByCategoryId($categoryID)
{
$posts = [];
$recentUpdatedPosts = $this->db->where('categoryID', $categoryID)->get('cm_page_attributes')->result();
foreach ($recentUpdatedPosts as $p) {
array_push($posts, $this->db
->select('p.*, pc.*, pa.pageURL, pc.pageTitle, pa.pageIcon')
->join('cm_page_attributes pa', 'p.pageID=pa.pageID', 'left')
->join('cm_page_content pc', 'pa.pageID=pc.pageID', 'left')
->where("pa.pagePublished", 1)
->where('p.pageID', $p->pageID)->where('p.published', 1)->limit(4)->order_by('p.dateUpdated', 'desc')
->get('cm_post p')->result());
}
return $posts;
}
public function getColumn($limit = 2, $offset = 0)
{
return $this->db->limit($limit)->join('cm_user u', 'u.userID = p.userID', 'left')
->join('cm_user_group g', 'u.groupID = g.groupID', 'left')->where('g.groupID', 7)
->order_by('datePosted', 'desc')->get('cm_post p')->result();
}
public function getToonSeries($seriesURL)
{
return $this->db->select("cm_post.*, cm_user.name")
->join(
'cm_post_category',
'cm_post.postID = cm_post_category.postID',
'inner'
)
->where('cm_post_category.categoryID', $seriesURL)
->get('cm_post')->result();
}
public function getPostRanking($title = 'V', $categoryID = 0, $exception = [], $limit = 8, $series = 0, $parentID = 0, $isPostCategoryRequired = false)
{
$this->db->select("cm_post.*, cm_user.name, cm_page_content.pageTitle,
UNIX_TIMESTAMP(datePosted) postedTimestamp, cm_post_ranking.rating, cm_category.categorySlug")
->join(
'cm_post_category',
'cm_post.postID = cm_post_category.postID',
'left'
)
->join(
'cm_post_ranking',
'cm_post.postID = cm_post_ranking.postID',
'left'
)
->join(
'cm_user',
'cm_post.userID = cm_user.userID',
'left'
)
->join(
'cm_page_content',
'cm_post.pageID = cm_page_content.pageID',
'left'
)
->group_by('cm_post.postID')
->order_by('cm_post.datePosted', 'desc')
->order_by('cm_post_ranking.rating', 'desc')
->limit($limit);
if (count($exception)) {
$this->db->where_not_in('cm_post.postID', $exception);
}
if (!is_null($title)) {
$this->db->where('cm_post_ranking.title', $title);
}
if ($categoryID) {
$this->db->where('cm_category.categoryID', $categoryID);
}
if ($parentID) {
$this->db->where('cm_category.parentID', $parentID);
}
if ($isPostCategoryRequired) {
$this->db->join(
'cm_category',
'cm_post_category.categoryID = cm_category.categoryID',
'inner'
);
} else {
$this->db->join(
'cm_category',
'cm_post.categoryID = cm_category.categoryID',
'left'
);
}
return $this->db->get('cm_post')->result();
}
public function getCategoryByParentId($parentID)
{
$rows = $this->db->where_in('cm_category.parentID', $parentID)->get('cm_category')->result();
return array_column($rows, 'categoryID');
}
public function getPostRecommend($categoryID = 0, $exception = [], $limit = 8)
{
if ($categoryID > 0) {
$categories = $this->getCategoryByParentId($categoryID);
$this->db->where_in('cm_category.categoryID', $categories);
}
if (count($exception)) {
$this->db->where_not_in('cm_post.postID', $exception);
}
return $this->db->select("cm_post.*, cm_user.name, count(cm_post_recommend.postID) recomCnt, cm_page_content.img")
->join(
'cm_category',
'cm_post.categoryID = cm_category.categoryID',
'inner'
)
->join(
'cm_post_recommend',
'cm_post.postID = cm_post_recommend.postID',
'left'
)
->join(
'cm_user',
'cm_post.userID = cm_user.userID',
'left'
)
->join(
'cm_page_content',
'cm_post.pageID = cm_page_content.pageID',
'left'
)
->group_by('cm_post.postID')
->order_by('cm_post.datePosted', 'desc')
->limit($limit)->get('cm_post')->result();
}
public function getPostRecent($categoryID = 0, $exception = [], $limit = 8, $isUniqueAuthor = true)
{
if ($categoryID > 0) {
$categories = $this->getCategoryByParentId($categoryID);
$this->db->where_in('cm_post_category.categoryID', $categories);
}
if (count($exception)) {
$this->db->where_not_in('cm_post.postID', $exception);
}
if ($isUniqueAuthor) {
$this->db->group_by('cm_user.userID');
} else {
$this->db->group_by('cm_post.postID');
}
return $this->db->select("cm_post.*, cm_user.name, cm_page_content.pageTitle")
->join(
'cm_post_category',
'cm_post.postID = cm_post_category.postID',
'inner'
)
->join(
'cm_user',
'cm_post.userID = cm_user.userID',
'left'
)
->join(
'cm_page_content',
'cm_post.pageID = cm_page_content.pageID',
'left'
)
->order_by('cm_post.datePosted', 'desc')
->where('cm_post.published', 1)
->limit($limit)->get('cm_post')->result();
}
function getArticle($postURL)
{
// Get article
$this->db->select("*");
$this->db->where("postURL", $postURL);
$this->db->where("published", 1);
$query = getPostActiveQuery()->where('p.postURL', $postURL)->get();
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u) {
$category = array(
'pageID' => $u['pageID'],
'postID' => $u['postID'],
'postTitle' => $u['postTitle'],
'pageKeywords' => '',
'pageDescription' => $u['postExcerpt'],
'postContent' => empty($u['postContentHTML']) ? $this->getJsonToPostContent($u['postContent'], $u['categoryID']) : $u['postContentHTML'],
'datePosted' => $u['datePosted'],
'categoryTitle' => $u['categoryTitle'],
'categorySlug' => $u['categorySlug'],
'categoryID' => $u['categoryID'],
'parentID' => $u['parentID'],
'postExcerpt' => $u['postExcerpt'],
);
}
return $category;
}
return array('postID' => "");
}
}

View File

@@ -0,0 +1,155 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Comment_model extends MY_Model
{
private $table = 'cm_comment';
public function __construct()
{
parent::__construct();
}
public function getPaging($limit, $offset = 0)
{
if (!isAdminSite()) {
$this->db->where('dateDeleted', '0000-00-00 00:00:00')->where('parentID', 0);
}
return $this->db->from($this->table . ' c')
->select("c.*, if(u.nickname = '' or u.nickname is null, u.userName, u.nickName) as nickname")
->join('cm_user u', 'c.userID=u.userID', 'left')
->order_by('datePosted', 'desc')
->limit($limit)->offset($offset);
}
public function getCountPaging()
{
if (!isAdminSite()) {
$this->db->where('dateDeleted', '0000-00-00 00:00:00');
}
return $this->db->from($this->table)
->count_all_results();
}
public function getOne($commentId)
{
return $this->db->where('commentID', $commentId)->get($this->table)->row();
}
public function getAll($commentId)
{
$commentId = is_array($commentId) ? $commentId : [$commentId];
return $this->db->where_in('commentId', $commentId)->get($this->table)->result();
}
public function getByParentId(int $parentID)
{
return $this->db->where('parentID', $parentID)->get($this->table)->result();
}
public function getByPostId($postId)
{
$postId = is_array($postId) ? $postId : [$postId];
return $this->db->where_in('postID', $postId)
->where('dateDeleted', '0000-00-00 00:00:00')
->order_by('datePosted', 'desc')->from($this->table);
}
public function getRepliesByCommentId($commentId)
{
$commentId = is_array($commentId) ? $commentId : [$commentId];
return $this->db->where_in('parentID', $commentId)
->where('dateDeleted', '0000-00-00 00:00:00')
->order_by('datePosted', 'desc')->from($this->table);
}
public function getCountByPostId($postId)
{
$postId = is_array($postId) ? $postId : [$postId];
return $this->db->where_in('postID', $postId)
->where('dateDeleted !=', '0000-00-00 00:00:00')
->group_by('postID')->select('count(postID) as cnt, postID')
->from($this->table);
}
public function save($data)
{
$this->db->insert($this->table, $data);
return $this->db->insert_id();
}
public function update($commentId)
{
$data = [
'comment' => $this->input->post('comment'),
'dateUpdated' => date('Y-m-d H:i:s')
];
$this->db->where('commentID', $commentId)
->where('userID', $this->session->userdata('userID'))
->update($this->table, $data);
return $this->db->affected_rows();
}
public function delete($commentId)
{
if (isAdminSite()) {
return $this->db->where('commentID', $commentId)->delete($this->table);
} else {
$data = [
'dateDeleted' => date('Y-m-d H:i:s')
];
$this->db->where('commentID', $commentId)->update($this->table, $data);
return $this->db->affected_rows();
}
}
public function rating($data)
{
$this->db->insert('cm_comment_ranking', $data);
return $this->db->insert_id();
}
public function getCountRatingByCommentIdAndTitle($commentId, $title)
{
return $this->db->where('title', $title)
->where('commentID', $commentId)
->count_all_results('cm_comment_ranking');
}
public function getCommentRatingsByCommentId($commentId)
{
$commentId = is_array($commentId) ? $commentId : [$commentId];
return $this->db
->where_in('commentID', $commentId)
->get('cm_comment_ranking')->result();
}
public function getRepliesAndRankings(&$comments)
{
if (count($comments)) {
array_map(function ($rating) use (&$comments) {
foreach ($comments as $k => $v) {
if ($v->commentID == $rating->commentID) {
if ($rating->title == 1) {
$comments[$k]->like++;
} else {
$comments[$k]->bad++;
}
}
}
}, $this->getCommentRatingsByCommentId(array_column($comments, 'commentID')));
array_map(function ($reply) use (&$comments) {
foreach ($comments as $k => $v) {
if ($v->commentID == $reply->parentID) {
$comments[$k]->replies = $reply->replies;
}
}
}, $this->getRepliesByCommentId(array_column($comments, 'commentID'))
->select('count(commentID) replies, parentID')->group_by('parentID')->get()->result());
}
}
}

View File

@@ -0,0 +1,894 @@
<?php
class Hoosk_model extends MY_Model
{
public function __construct()
{
// Call the Model constructor
parent::__construct();
$this->load->database();
}
/* * *************************** */
/* * ** Dash Querys ************ */
/* * *************************** */
public function getSiteName()
{
$this->db->select("*");
$this->db->where("siteID", 0);
$query = $this->db->get('cm_settings');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u) :
return $u['siteTitle'];
endforeach;
}
return array();
}
public function checkMaintenance()
{
$this->db->select("*");
$this->db->where("siteID", 0);
$query = $this->db->get('cm_settings');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u) :
return $u['siteMaintenance'];
endforeach;
}
return array();
}
public function getTheme()
{
// Get Theme
$this->db->select("*");
$this->db->where("siteID", 0);
$query = $this->db->get('cm_settings');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u) :
return $u['siteTheme'];
endforeach;
}
return array();
}
public function getLang()
{
// Get Theme
$this->db->select("*");
$this->db->where("siteID", 0);
$query = $this->db->get('cm_settings');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u) :
return $u['siteLang'];
endforeach;
}
return array();
}
public function getUpdatedPages()
{
// Get most recently updated pages
$this->db->select("pageTitle, cm_page_attributes.pageID, pageUpdated, pageContentHTML");
$this->db->join('cm_page_content', 'cm_page_content.pageID = cm_page_attributes.pageID');
$this->db->join('cm_page_meta', 'cm_page_meta.pageID = cm_page_attributes.pageID');
$this->db->order_by("pageUpdated", "desc");
$this->db->limit(5);
$query = $this->db->get('cm_page_attributes');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
/* * *************************** */
/* * ** User Querys ************ */
/* * *************************** */
public function countUsers()
{
return $this->db->count_all('cm_user');
}
public function getUsers($limit, $offset = 0)
{
// Get a list of all user accounts
$this->db->select("userName, g.name groupName, email, userID")->join('cm_user_group g', 'u.groupID = g.groupID', 'left');
$this->db->order_by("userName", "asc");
$this->db->limit($limit, $offset);
$query = $this->db->get('cm_user u');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function getUser($id)
{
// Get the user details
$this->db->select("*");
$this->db->where("userID", $id);
$query = $this->db->get('cm_user');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function getUserEmail($id)
{
// Get the user email address
$this->db->select("email");
$this->db->where("userID", $id);
$query = $this->db->get('cm_user');
if ($query->num_rows() > 0) {
foreach ($query->result() as $rows) {
$email = $rows->email;
return $email;
}
}
}
public function createUser()
{
// Create the user account
$data = array(
'userName' => $this->input->post('username'),
'email' => $this->input->post('email'),
'password' => md5($this->input->post('password') . SALT),
);
$this->db->insert('cm_user', $data);
}
public function updateUser($id)
{
// update the user account
$data = array(
'email' => $this->input->post('email'),
'password' => md5($this->input->post('password') . SALT),
);
$this->db->where('userID', $id);
$this->db->update('cm_user', $data);
}
public function removeUser($id)
{
// Delete a user account
$this->db->delete('cm_user', array('userID' => $id));
}
public function login($username, $password)
{
$this->db->select("*");
$this->db->where("userName", $username);
$this->db->where("password", $password);
$query = $this->db->get("cm_user");
if ($query->num_rows() > 0) {
foreach ($query->result() as $rows) {
$data = array(
'userID' => $rows->userID,
'userName' => $rows->userName,
'logged_in' => true,
);
$this->session->set_userdata($data);
return true;
}
} else {
return false;
}
}
/* * *************************** */
/* * ** Page Querys ************ */
/* * *************************** */
public function pageSearch($term)
{
$this->db->select("*");
$this->db->like("pageTitle", $term)->or_like('categoryTitle', $term)->or_like('pageURL', $term);
$this->db->join('cm_page_content', 'cm_page_content.pageID = cm_page_attributes.pageID', 'left')->group_by('cm_page_attributes.pageID');
$this->db->join('cm_category', 'cm_page_attributes.categoryID=cm_category.categoryID or cm_page_attributes.categoryID = 0', 'left');
// $this->db->limit($limit, $offset);
$query = $this->db->get('cm_page_attributes');
if ($term == "") {
$this->db->limit(15);
}
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $p) :
echo '<tr>';
echo '<td>' . $p['navTitle'] . '</td>';
echo '<td>' . $p['categoryTitle'] . '</td>';
echo '<td>' . $p['pageCreated'] . '</td>';
echo '<td>' . ($p['pagePublished'] ? '<span class="fa fa-2x fa-check-circle"></span>' : '<span class="fa fa-2x fa-times-circle"></span>') . '</td>';
echo '<td class="td-actions"><a href="' . BASE_URL . '/admin/pages/jumbo/' . $p['pageID'] . '" class="btn btn-small btn-primary">' . $this->lang->line('btn_jumbotron') . '</a> <a href="' . BASE_URL . '/admin/pages/edit/' . $p['pageID'] . '" class="btn btn-small btn-success"><i class="fa fa-pencil"> </i></a> <a data-toggle="modal" data-target="#ajaxModal" class="btn btn-danger btn-small" href="' . BASE_URL . '/admin/pages/delete/' . $p['pageID'] . '"><i class="fa fa-remove"> </i></a></td>';
echo '</tr>';
endforeach;
} else {
echo "<tr><td colspan='5'><p>" . $this->lang->line('no_results') . "</p></td></tr>";
}
}
public function countPages()
{
return $this->db->count_all('cm_page_attributes');
}
public function getPages($limit, $offset = 0)
{
// Get a list of all pages
$this->db->select("*, cm_category.categoryTitle");
$this->db->join('cm_page_content', 'cm_page_content.pageID = cm_page_attributes.pageID');
$this->db->join('cm_page_meta', 'cm_page_meta.pageID = cm_page_attributes.pageID');
$this->db->join('cm_category', 'cm_page_attributes.categoryID=cm_category.categoryID');
$this->db->limit($limit, $offset);
$query = $this->db->get('cm_page_attributes');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function getPagesAll()
{
// Get a list of all pages
$this->db->select("*");
$this->db->join('cm_page_content', 'cm_page_content.pageID = cm_page_attributes.pageID');
$this->db->join('cm_page_meta', 'cm_page_meta.pageID = cm_page_attributes.pageID');
$query = $this->db->get('cm_page_attributes');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function createPage()
{
// Create the page
$data = array(
'pagePublished' => $this->input->post('pagePublished'),
'pageTemplate' => $this->input->post('pageTemplate'),
'pageURL' => $this->input->post('pageURL'),
);
$this->db->insert('cm_page_attributes', $data);
if ($this->input->post('content') != "") {
$sirTrevorInput = $this->input->post('content');
$converter = new Converter();
$HTMLContent = $converter->toHtml($sirTrevorInput);
} else {
$HTMLContent = "";
}
$this->db->select("*");
$this->db->where("pageURL", $this->input->post('pageURL'));
$query = $this->db->get("cm_page_attributes");
if ($query->num_rows() > 0) {
foreach ($query->result() as $rows) {
$contentdata = array(
'pageID' => $rows->pageID,
'pageTitle' => $this->input->post('pageTitle'),
'navTitle' => $this->input->post('navTitle'),
'pageContent' => $this->input->post('content'),
'pageContentHTML' => $HTMLContent,
);
$this->db->insert('cm_page_content', $contentdata);
$metadata = array(
'pageID' => $rows->pageID,
'pageKeywords' => $this->input->post('pageKeywords'),
'pageDescription' => $this->input->post('pageDescription'),
);
$this->db->insert('cm_page_meta', $metadata);
}
}
}
public function getPage($id)
{
// Get the page details
$this->db->select("*");
$this->db->where("cm_page_attributes.pageID", $id)->or_where("cm_page_attributes.pageURL", $id);
$this->db->join('cm_page_content', 'cm_page_content.pageID = cm_page_attributes.pageID');
$this->db->join('cm_page_meta', 'cm_page_meta.pageID = cm_page_attributes.pageID');
$query = $this->db->get('cm_page_attributes');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function getPageBanners($id)
{
// Get the page banners
$this->db->select("*");
$this->db->where("pageID", $id);
$this->db->order_by("slideOrder ASC");
$query = $this->db->get('cm_banner');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function removePage($id)
{
// Delete a page
$this->db->delete('cm_page_content', array('pageID' => $id));
$this->db->delete('cm_page_meta', array('pageID' => $id));
$this->db->delete('cm_page_attributes', array('pageID' => $id));
}
public function getPageURL($id)
{
// Get the page URL
$this->db->select("pageURL");
$this->db->where("pageID", $id);
$query = $this->db->get('cm_page_attributes');
if ($query->num_rows() > 0) {
foreach ($query->result() as $rows) {
$pageURL = $rows->pageURL;
return $pageURL;
}
}
}
public function updatePage($id)
{
// Update the page
if ($this->input->post('content') != "") {
$sirTrevorInput = $this->input->post('content');
$converter = new Converter();
$HTMLContent = $converter->toHtml($sirTrevorInput);
} else {
$HTMLContent = "";
}
if ($id != 1) {
$data = array(
'pagePublished' => $this->input->post('pagePublished'),
'pageURL' => $this->input->post('pageURL'),
'pageTemplate' => $this->input->post('pageTemplate'),
);
} else {
$data = array(
'pagePublished' => $this->input->post('pagePublished'),
'pageTemplate' => $this->input->post('pageTemplate'),
);
}
$this->db->where("pageID", $id);
$this->db->update('cm_page_attributes', $data);
$contentdata = array(
'pageTitle' => $this->input->post('pageTitle'),
'navTitle' => $this->input->post('navTitle'),
'pageContent' => $this->input->post('content'),
'pageContentHTML' => $HTMLContent,
);
$this->db->where("pageID", $id);
$this->db->update('cm_page_content', $contentdata);
$metadata = array(
'pageKeywords' => $this->input->post('pageKeywords'),
'pageDescription' => $this->input->post('pageDescription'),
);
$this->db->where("pageID", $id);
$this->db->update('cm_page_meta', $metadata);
}
public function updateJumbotron($id)
{
// Update the jumbotron
if ($this->input->post('jumbotron') != "") {
$sirTrevorInput = $this->input->post('jumbotron');
$converter = new Converter();
$HTMLContent = $converter->toHtml($sirTrevorInput);
} else {
$HTMLContent = "";
}
$data = array(
'enableJumbotron' => $this->input->post('enableJumbotron'),
'enableSlider' => $this->input->post('enableSlider'),
);
$this->db->where("pageID", $id);
$this->db->update('cm_page_attributes', $data);
$contentdata = array(
'jumbotron' => $this->input->post('jumbotron'),
'jumbotronHTML' => $HTMLContent,
);
$this->db->where("pageID", $id);
$this->db->update('cm_page_content', $contentdata);
// Clear the sliders
$this->db->delete('cm_banner', array('pageID' => $id));
/*for($i=0;$i<=$_POST['total_upload_pics'];$i++)
{
if(isset($_POST['slide' . $i]))
{
$slidedata = array(
'pageID' => $id,
'slideImage' => $this->input->post('slide'.$i),
'slideLink' => $this->input->post('link'.$i),
'slideOrder' => $i,
);
$this->db->insert('hoosk_banner', $slidedata));
}
}*/
$sliders = explode('{', $this->input->post('pics'));
for ($i = 1; $i < count($sliders); $i++) {
$div = explode('|', $sliders[$i]);
$slidedata = array(
'pageID' => $id,
'slideImage' => $div[0],
'slideLink' => $div[1],
'slideAlt' => substr($div[2], 0, -1),
'slideOrder' => $i - 1,
);
$this->db->insert('cm_banner', $slidedata);
}
}
/* * *************************** */
/* * ** Navigation Querys ****** */
/* * *************************** */
public function countNavigation()
{
return $this->db->count_all('cm_navigation');
}
public function getAllNav($limit, $offset = 0)
{
// Get a list of all pages
$this->db->select("*");
$this->db->limit($limit, $offset);
$query = $this->db->get('cm_navigation');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function getNav($id)
{
// Get a list of all pages
$this->db->select("*");
$this->db->where("navSlug", $id);
$query = $this->db->get('cm_navigation');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
//Get page details for building nav
public function getPageNav($url)
{
// Get the page details
$this->db->select("*");
$this->db->where("cm_page_attributes.pageURL", $url);
$this->db->join('cm_page_content', 'cm_page_content.pageID = cm_page_attributes.pageID');
$this->db->join('cm_page_meta', 'cm_page_meta.pageID = cm_page_attributes.pageID');
$query = $this->db->get('cm_page_attributes');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function insertNav()
{
$navigationHTML = $this->input->post('convertedNav');
$navigationHTML = str_replace("<ul></ul>", "", $navigationHTML);
$navigationEdit = $this->input->post('seriaNav');
$navigationEdit = str_replace('<button data-action="collapse" type="button">Collapse</button><button style="display: none;" data-action="expand" type="button">Expand</button>', "", $navigationEdit);
$data = array(
'navSlug' => $this->input->post('navSlug'),
'navTitle' => $this->input->post('navTitle'),
'navEdit' => $navigationEdit,
'navHTML' => $navigationHTML,
);
$this->db->insert('cm_navigation', $data);
}
public function updateNav($id)
{
$navigationHTML = $this->input->post('convertedNav');
$navigationHTML = str_replace("<ul></ul>", "", $navigationHTML);
$navigationEdit = $this->input->post('seriaNav');
$navigationEdit = str_replace('<button data-action="collapse" type="button">Collapse</button><button style="display: none;" data-action="expand" type="button">Expand</button>', "", $navigationEdit);
$data = array(
'navTitle' => $this->input->post('navTitle'),
'navEdit' => $navigationEdit,
'navHTML' => $navigationHTML,
);
$this->db->where("navSlug", $id);
$this->db->update('cm_navigation', $data);
}
public function removeNav($id)
{
// Delete a nav
$this->db->delete('cm_navigation', array('navSlug' => $id));
}
public function getSettings()
{
// Get the settings
$this->db->select("*");
$this->db->where("siteID", 0);
$query = $this->db->get('cm_settings');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function updateSettings()
{
$data = array(
'siteTheme' => $this->input->post('siteTheme'),
'siteLang' => $this->input->post('siteLang'),
'siteFooter' => $this->input->post('siteFooter'),
'siteMaintenance' => $this->input->post('siteMaintenance'),
'siteMaintenanceHeading' => $this->input->post('siteMaintenanceHeading'),
'siteMaintenanceMeta' => $this->input->post('siteMaintenanceMeta'),
'siteMaintenanceContent' => $this->input->post('siteMaintenanceContent'),
'siteAdditionalJS' => $this->input->post('siteAdditionalJS'),
'webmaster_name' => $this->input->post('webmaster_name'),
'webmaster_email' => $this->input->post('webmaster_email'),
'banned_word' => $this->input->post('banned_word'),
'legal_terms' => str_replace('\r\n','<br />',$this->input->post('legal_terms')),
'legal_privacy' => str_replace('\r\n','<br />', $this->input->post('legal_privacy')),
'legal_privatedata' => str_replace('\r\n','<br />', $this->input->post('legal_privatedata')),
);
if ($this->input->post('siteTitle') != "") {
$data['siteTitle'] = $this->input->post('siteTitle');
}
if ($this->input->post('siteLogo') != "") {
$data['siteLogo'] = $this->input->post('siteLogo');
}
if ($this->input->post('siteFavicon') != "") {
$data['siteFavicon'] = $this->input->post('siteFavicon');
}
$this->db->where("siteID", 0);
$this->db->update('cm_settings', $data);
}
/* * *************************** */
/* * ** Post Querys ************ */
/* * *************************** */
public function postSearch($term)
{
$this->db->select("cm_post.*, cm_user.userName, cm_category.categoryTitle");
$this->db->like("postTitle", $term)->or_like("postExcerpt", $term)->or_like("cm_category.categoryTitle", $term)->or_where('cm_post.postID', $term);
$this->db->join('cm_category', 'cm_category.categoryID = cm_post.categoryID or cm_post.categoryID = 0', 'left');
$this->db->join('cm_post_category', 'cm_post.postID = cm_post_category.postID', 'left');
$this->db->join('cm_user', 'cm_post.userID = cm_user.userID', 'left');
$this->db->order_by("unixStamp", "desc");
if ($term == "") {
$this->db->limit(15);
}
$query = $this->db->get('cm_post');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $p) :
echo '<tr>';
echo '<td>' . $p['postTitle'] . '</td>';
echo '<td>' . $p['categoryTitle'] . '</td>';
echo '<td>' . $p['userName'] . '</td>';
echo '<td>' . $p['datePosted'] . '</td>';
echo '<td>' . ($p['published'] ? '<span class="fa fa-2x fa-check-circle"></span>' : '<span class="fa fa-2x fa-times-circle"></span>') . '</td>';
echo '<td class="td-actions"><a href="' . BASE_URL . '/admin/posts/edit/' . $p['postID'] . '" class="btn btn-small btn-success"><i class="fa fa-pencil"> </i></a> <a data-toggle="modal" data-target="#ajaxModal" class="btn btn-danger btn-small" href="' . BASE_URL . '/admin/posts/delete/' . $p['postID'] . '"><i class="fa fa-remove"> </i></a></td>';
echo '</tr>';
endforeach;
} else {
echo "<tr><td colspan='5'><p>" . $this->lang->line('no_results') . "</p></td></tr>";
}
}
public function countPosts()
{
if ($term = getSearchTerm()) {
$this->db->join('cm_category', 'cm_category.categoryID = cm_post.categoryID', 'left');
$this->db->join('cm_post_category', 'cm_category.categoryID = cm_post_category.categoryID and cm_post_category.postID=cm_post.postID', 'left');
$this->db->like("postTitle", $term)->or_like("postExcerpt", $term)->or_like("cm_category.categoryTitle", $term)->or_where('cm_post.postID', $term);
}
return $this->db->count_all_results('cm_post');
}
public function getPosts($limit, $offset = 0, $categoryID = 0, $parentID = 0, $exceptions = [], $isCount = false)
{
$rows = [];
if (!$isCount) {
$this->db->select("cm_post.*, cm_user.userName, cm_category.categoryTitle, cm_category.categorySlug");
$this->db->limit($limit, $offset);
$this->db->order_by("dateUpdated", "desc");
}
if ($term = getSearchTerm()) {
$this->db->like("postTitle", $term)->or_like("postExcerpt", $term)
->or_like("cm_category.categoryTitle", $term)->or_where('cm_post.postID', $term)
->or_like('cm_page_content.pageTitle', $term)
->join('cm_post_page', 'cm_post.postID=cm_post_page.postID', 'left')
->join('cm_page_content', 'cm_post_page.pageID=cm_page_content.pageID', 'left');
}
$this->db->join('cm_post_category', 'cm_post_category.postID=cm_post.postID', 'left');
$this->db->join('cm_category', 'cm_post_category.categoryID = cm_category.categoryID', 'left');
$this->db->join('cm_user', 'cm_post.userID = cm_user.userID', 'left');
$this->db->group_by('cm_post.postID');
if ($categoryID > 0) {
$this->db->where("cm_post.categoryID", $categoryID);
}
if ($parentID > 0) {
$this->db->where('cm_category.parentID', $parentID);
}
if (count($exceptions) > 0) {
$this->db->where_not_in('cm_post.postID', $exceptions);
}
if ($isCount) {
return $this->db->from('cm_post')->count_all_results();
} else {
$query = $this->db->get('cm_post');
if ($query->num_rows() > 0) {
$rows = $query->result_array();
$this->getMultipleCategory($rows);
$this->getMultiplePage($rows);
}
return $rows;
}
}
protected function getMultiplePage(&$rows)
{
$this->load->model('page_model');
$pages = $this->db->from('cm_page_content')->join('cm_post_page', 'cm_page_content.pageID=cm_post_page.pageID', 'left')
->where_in('cm_post_page.postID', array_column($rows, 'postID'))->get()->result();
foreach ($pages as $r) {
foreach ($rows as $k => $row) {
$rows[$k]['pageTitle'] = empty($rows[$k]['pageTitle']) ? '' : $rows[$k]['pageTitle'];
if ($row['postID'] == $r->postID) {
$rows[$k]['pages'][] = $r->pageID;
$rows[$k]['pageTitle'] = (empty($rows[$k]['pageTitle']) ? '' : $rows[$k]['pageTitle'] . ', ') . $r->pageTitle;
}
}
}
}
protected function getMultipleCategory(&$rows)
{
$categories = $this->getCategories();
array_map(function ($r) use (&$rows, $categories) {
foreach ($rows as $k => $row) {
if ($row['postID'] == $r->postID) {
$rows[$k]['categoryID'] = $r->categoryID;
$rows[$k]['categories'][] = $r->categoryID;
foreach ($categories as $c) {
if ($c['categoryID'] == $r->categoryID) {
$rows[$k]['categoryTitle'] = (empty($rows[$k]['categoryTitle']) ? '' : $rows[$k]['categoryTitle'] . ', ') . $c['categoryTitle'];
}
}
}
}
}, $this->getPostCategoryByPostIdIn(array_column(array_filter($rows, function ($row) {
return $row['categoryID'] == 0;
}), 'postID')));
}
public function createPost()
{
// Create the post
// if ($this->input->post('content') != "") {
// $sirTrevorInput = $this->input->post('content');
// $converter = new Converter();
// $HTMLContent = $converter->toHtml($sirTrevorInput);
// } else {
// $HTMLContent = "";
// }
$categoryID = 0;
$categories = explode(',', $this->input->post('categories'));
if (count($categories) == 1) {
$categoryID = $categories[0];
}
$data = array(
'postTitle' => $this->input->post('postTitle'),
'categoryID' => $categoryID,
// 'postURL' => $this->input->post('postURL'),
// 'postContent' => $this->input->post('content'),
'postContentHTML' => $this->input->post('content'),
'postExcerpt' => $this->input->post('postExcerpt'),
'published' => $this->input->post('published'),
'datePosted' => $this->input->post('datePosted'),
'unixStamp' => $this->input->post('unixStamp'),
);
if ($this->input->post('postImage') != "") {
$data['postImage'] = $this->input->post('postImage');
}
$this->db->insert('cm_post', $data);
$insertID = $this->db->insert_id();
if (count($categories) > 1) {
$this->addPostCategory($insertID, $categories);
}
$this->db->where('postID', $insertID)->update('cm_post', array('postURL' => $insertID));
}
public function getPost($id)
{
// Get the post details
$this->db->select("*");
$this->db->where("postID", $id);
$this->db->join('cm_category', 'cm_category.categoryID = cm_post.categoryID', 'left');
$query = $this->db->get('cm_post');
if ($query->num_rows() > 0) {
$rows = $query->result_array();
$this->getMultipleCategory($rows);
return $rows;
}
return array();
}
public function removePost($id)
{
// Delete a post
$this->db->delete('cm_post', array('postID' => $id));
}
public function updatePost($id)
{
// Update the post
// if ($this->input->post('content') != "") {
// $sirTrevorInput = $this->input->post('content');
// $converter = new Converter();
// $HTMLContent = $converter->toHtml($sirTrevorInput);
// } else {
// $HTMLContent = "";
// }
$categoryID = 0;
$categories = explode(',', $this->input->post('categories'));
if (count($categories) > 1) {
$this->addPostCategory($id, $categories);
} else {
$categoryID = $categories[0];
}
$data = array(
'postTitle' => $this->input->post('postTitle'),
'categoryID' => $categoryID,
// 'postURL' => $this->input->post('postURL'),
'postContentHTML' => $this->input->post('content'),
'postExcerpt' => $this->input->post('postExcerpt'),
'published' => $this->input->post('published'),
'datePosted' => $this->input->post('datePosted'),
'unixStamp' => $this->input->post('unixStamp'),
);
if ($this->input->post('postImage') != "") {
$data['postImage'] = $this->input->post('postImage');
}
$this->db->where("postID", $id);
$this->db->update('cm_post', $data);
}
/* * *************************** */
/* * ** Category Querys ******** */
/* * *************************** */
public function countCategories()
{
return $this->db->count_all('cm_category');
}
public function getCategories()
{
// Get a list of all categories
$this->db->select("*");
$query = $this->db->get('cm_category');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function getPostCategoryByPostIdIn($postIds)
{
if (count($postIds) == 0) return [];
return $this->db->from('cm_post_category pc')->where_in('pc.postID', $postIds)->get()->result();
}
public function getCategoriesAll($limit, $offset = 0)
{
// Get a list of all categories
$this->db->select("*");
$this->db->limit($limit, $offset);
$query = $this->db->get('cm_category');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function createCategory()
{
// Create the category
$data = array(
'categoryTitle' => $this->input->post('categoryTitle'),
'categorySlug' => $this->input->post('categorySlug'),
'categoryDescription' => $this->input->post('categoryDescription')
);
$this->db->insert('cm_category', $data);
}
public function getCategory($id)
{
// Get the category details
$this->db->select("*");
$this->db->where("categoryID", $id);
$query = $this->db->get('cm_category');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function removeCategory($id)
{
// Delete a category
$this->db->delete('cm_category', array('categoryID' => $id));
}
public function updateCategory($id)
{
// Update the category
$data = array(
'categoryTitle' => $this->input->post('categoryTitle'),
'categorySlug' => $this->input->post('categorySlug'),
'categoryDescription' => $this->input->post('categoryDescription')
);
$this->db->where("categoryID", $id);
$this->db->update('cm_category', $data);
}
/* * *************************** */
/* * ** Social Querys ********** */
/* * *************************** */
public function getSocial()
{
$this->db->select("*");
$query = $this->db->get('cm_social');
if ($query->num_rows() > 0) {
return $query->result_array();
}
return array();
}
public function updateSocial()
{
$this->db->select("*");
$query = $this->db->get("cm_social");
if ($query->num_rows() > 0) {
foreach ($query->result() as $rows) {
$data = array();
$data['socialLink'] = $this->input->post($rows->socialName);
if (isset($_POST['checkbox' . $rows->socialName])) {
$data['socialEnabled'] = $this->input->post('checkbox' . $rows->socialName);
} else {
$data['socialEnabled'] = 0;
}
$this->db->where("socialName", $rows->socialName);
$this->db->update('cm_social', $data);
}
}
}
}

View File

@@ -0,0 +1,168 @@
<?php
class Hoosk_page_model extends MY_Model {
function __construct() {
// Call the Model constructor
parent::__construct();
$this->load->database();
}
/* * *************************** */
/* * ** Page Querys ************ */
/* * *************************** */
/*function getSiteName() {
// Get Theme
$this->db->select("*");
$this->db->where("siteID", 0);
$query = $this->db->get('cm_settings');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u):
return $u['siteTitle'];
endforeach;
}
return array();
}
function getTheme() {
// Get Theme
$this->db->select("*");
$this->db->where("siteID", 0);
$query = $this->db->get('cm_settings');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u):
return $u['siteTheme'];
endforeach;
}
return array();
}*/
function getPage($pageURL) {
// Get page
$this->db->select("*");
$this->db->join('cm_page_content', 'cm_page_content.pageID = cm_page_attributes.pageID');
$this->db->join('cm_page_meta', 'cm_page_meta.pageID = cm_page_attributes.pageID');
$this->db->where("pagePublished", 1);
$this->db->where("pageURL", $pageURL);
$query = $this->db->get('cm_page_attributes');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u):
$page = array(
'pageID' => $u['pageID'],
'categoryID' => $u['categoryID'],
'pageTitle' => $u['pageTitle'],
'pageIntro' => $u['intro'],
'pageIcon' => $u['pageIcon'],
'pageImg' => $u['img'],
'pageKeywords' => $u['pageKeywords'],
'pageDescription' => $u['pageDescription'],
'pageContentHTML' => $u['pageContentHTML'],
'pageTemplate' => $u['pageTemplate'],
'enableJumbotron' => $u['enableJumbotron'],
'enableSlider' => $u['enableSlider'],
'jumbotronHTML' => $u['jumbotronHTML'],
);
endforeach;
return $page;
}
return array('pageID' => "",'pageTemplate' => "");
}
function getCategory($catSlug) {
// Get category
$this->db->select("*");
$this->db->where("categorySlug", $catSlug);
$query = $this->db->get('cm_category');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u):
$category = array(
'pageID' => $u['categoryID'],
'categoryID' => $u['categoryID'],
'pageTitle' => $u['categoryTitle'],
'pageKeywords' => '',
'pageDescription' => $u['categoryDescription'],
);
endforeach;
return $category;
}
return array('categoryID' => "");
}
function getArticle($postURL) {
// Get article
$this->db->select("*");
$this->db->where("postURL", $postURL);
// $this->db->where("published", 1);
$this->db->join('cm_category', 'cm_category.categoryID = cm_post.categoryID or cm_post.categoryID=0', 'left');
$query = $this->db->get('cm_post');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u) {
$category = array(
'pageID' => $u['postID'],
'postID' => $u['postID'],
'postTitle' => $u['postTitle'],
'pageKeywords' => '',
'pageDescription' => $u['postExcerpt'],
'postContent' => empty($u['postContentHTML']) ? $this->getJsonToPostContent($u['postContent'], $u['categoryID']) : $u['postContentHTML'],
'datePosted' => $u['datePosted'],
'categoryTitle' => $u['categoryTitle'],
'categorySlug' => $u['categorySlug'],
'categoryID' => $u['categoryID'],
'parentID' => $u['parentID'],
'postExcerpt' => $u['postExcerpt'],
);
}
return $category;
}
return array('postID' => "");
}
protected function getJsonToPostContent($content, $categoryID) {
$html = '';
$c = json_decode($content);
foreach($c as $url) {
$html .= '<img src="http://crossmap.co.kr'.$url.'">';
}
return $html;
}
function getSettings() {
// Get settings
$this->db->select("*");
$this->db->where("siteID", 0);
$query = $this->db->get('cm_settings');
if ($query->num_rows() > 0) {
$results = $query->result_array();
foreach ($results as $u):
$page = array(
'siteLogo' => $u['siteLogo'],
'siteFavicon' => $u['siteFavicon'],
'siteTitle' => $u['siteTitle'],
'siteTheme' => $u['siteTheme'],
'siteFooter' => $u['siteFooter'],
'siteMaintenanceHeading' => $u['siteMaintenanceHeading'],
'siteMaintenanceMeta' => $u['siteMaintenanceMeta'],
'siteMaintenanceContent' => $u['siteMaintenanceContent'],
'siteMaintenance' => $u['siteMaintenance'],
'siteAdditionalJS' => $u['siteAdditionalJS'],
);
endforeach;
return $page;
}
return array();
}
}
?>

View File

@@ -0,0 +1,51 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Page_model extends MY_Model
{
public function __construct()
{
parent::__construct();
}
private static function init()
{
return get_instance()->db->from('cm_page_attributes')
->join('cm_page_content', 'cm_page_content.pageID = cm_page_attributes.pageID')
->join('cm_page_meta', 'cm_page_meta.pageID = cm_page_attributes.pageID')
->where("pagePublished", 1);
}
public function getOne($pageUrl)
{
$pageUrl = is_array($pageUrl) ? $pageUrl : [$pageUrl];
return self::init()->where_in("cm_page_content.pageID", $pageUrl)->get()->row();
}
public function getPageDelivery($pageID)
{
$this->db->join('cm_page_attributes', 'cm_page_attributes.pageID=cm_delivery.pageID');
return $this->db->where('cm_page_attributes.pageID', $pageID)->get('cm_delivery')->result();
}
public function getTablePageTitle(&$rows)
{
if (count($rows)) {
$pages = get_instance()->db
->join('cm_post_page', 'cm_page_content.pageID=cm_post_page.pageID', 'left')
->where_in('cm_post_page.postID', array_column($rows, 'postID'))->get('cm_page_content')->result();
foreach ($rows as $k => $row) {
$rows[$k]['pages'] = [];
foreach ($pages as $r) {
if ($row['postID'] == $r->postID) {
$rows[$k]['pages'][] = $r->pageID;
$rows[$k]['pageTitle'] = (empty($rows[$k]['pageTitle']) ? '' : $rows[$k]['pageTitle'] . ', ') . $r->pageTitle;
}
}
}
}
}
}

313
application/models/Post_model.php Executable file
View File

@@ -0,0 +1,313 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Post_model extends MY_Model
{
public function __construct()
{
parent::__construct();
}
public function getPostQuery()
{
get_instance()->load->library('session');
get_instance()->db->from('cm_post p')
->join('cm_post_category pc', 'p.postID=pc.postID', 'left')
->join('cm_category c', 'pc.categoryID=c.categoryID', 'left')
->join('cm_post_page pp', 'p.postID=pp.postID', 'left');
if (!isAdminSite() && !get_instance()->session->userdata('userName')) {
get_instance()->db->where('p.published', 1);
}
return get_instance()->db;
}
public function getPostsByCategoryId($categories, $limit, $offset = 0)
{
$categories = is_array($categories) ? $categories : [$categories];
return $this->getPostQuery()
->where_in('c.categoryID', $categories)
->limit($limit)->order_by('datePosted', 'desc')
->offset($offset)
->select('*, p.postID postSeq');
}
public function getPagePostsByCategoryId($categories, $limit, $offset = 0)
{
$categories = is_array($categories) ? $categories : [$categories];
return $this->getPostQuery()
->join('cm_page_content co', 'pp.pageID=co.pageID', 'left')
->where_in('c.categoryID', $categories)
->limit($limit)->order_by('datePosted', 'desc')
->offset($offset);
}
public function getPagePostsByPageId($PageId, $limit = 0, $offset = 0)
{
$PageId = is_array($PageId) ? $PageId : [$PageId];
return $this->getPostQuery()
->join('cm_page_content co', 'pp.pageID=co.pageID', 'left')
->join('cm_page_attributes pa', 'pp.pageID=pa.pageID', 'left')
->where_in('pp.pageID', $PageId)
->limit($limit)->order_by('datePosted', 'desc')
->offset($offset)
->select('*, p.postID postSeq')
->group_by('p.postID');
}
public function getCountPostsByCategoryId($categories)
{
$categories = is_array($categories) ? $categories : [$categories];
return $this->getPostQuery()
->where_in('c.categoryID', $categories)
->count_all_results();
}
public function getCountPostsByPageId($pageId)
{
$pageId = is_array($pageId) ? $pageId : [$pageId];
return $this->getPostQuery()
->where_in('pp.pageID', $pageId)
->count_all_results();
}
public function getPostsByPageId($pageId, $limit)
{
$pageId = is_array($pageId) ? $pageId : [$pageId];
return $this->getPostQuery()
->where_in('pp.pageID', $pageId)
->limit($limit)->order_by('datePosted', 'desc')
->select('*, p.postID postSeq')
->group_by('p.postID');
}
public function getPostsRatingByPageId($pageId, $limit)
{
$pageId = is_array($pageId) ? $pageId : [$pageId];
return $this->getPostQuery()
->join('cm_post_ranking pr', "p.postID=pr.postID", 'left')
->where_in('pp.pageID', $pageId)
->limit($limit)
->group_by('p.postID')
->select('*, p.postID postSeq');
}
public function getPostsByPageIdAndCategoryId($pageId, $categoryId, $limit)
{
$pageId = is_array($pageId) ? $pageId : [$pageId];
$categoryId = is_array($categoryId) ? $categoryId : [$categoryId];
return $this->getPostQuery()
->where_in('c.categoryID', $categoryId)
->where_in('pp.pageID', $pageId)
->limit($limit)->order_by('datePosted', 'desc');
}
public function getCountPostsByPageIdAndCategoryId($pageId, $categoryId)
{
$pageId = is_array($pageId) ? $pageId : [$pageId];
$categoryId = is_array($categoryId) ? $categoryId : [$categoryId];
return $this->getPostQuery()
->where_in('c.categoryID', $categoryId)
->where_in('pp.pageID', $pageId)
->order_by('datePosted', 'desc')->count_all_results();
}
public function getPostsRankingByRankTypeAndCategoryId($rankType, $categoryId, $limit)
{
$categoryId = is_array($categoryId) ? $categoryId : [$categoryId];
return $this->getPostQuery()
->join('cm_post_ranking pr', "p.postID=pr.postID and pr.title='$rankType'", 'left')
->where_in('c.categoryID', $categoryId)
->group_by('p.postID')
->limit($limit)->order_by('datePosted', 'desc')
->select('*, p.postID postSeq');
}
public function getPost($postURL)
{
return isAdminSite() ? (function () use ($postURL) {
return $this->getPostQuery()
->join('cm_post_thumb t', 'p.postID=t.postID', 'left')
->join('cm_post_schedule s', 'p.postID=s.postID', 'left')
->where('p.postID', $postURL)
->select('p.*, c.*, t.thumb postThumb, s.run_at dateReserved')->group_by('p.postID');
})() : $this->getPostQuery()->where('p.postURL', $postURL)->select('*, p.postID postSeq')->get()->row();
}
public function getPosts($limit, $offset)
{
if (isAdminSite()) {
if ($term = getSearchTerm()) {
$this->db->like("p.postTitle", $term)->or_like("p.postExcerpt", $term)
->or_like("c.categoryTitle", $term)->or_where('p.postID', $term)
->or_like('pcn.pageTitle', $term);
}
return $this->getPostQuery()
->join('cm_user u', 'p.userID = u.userID', 'left')
->join('cm_page_content pcn', 'pp.pageID=pcn.pageID', 'left')
->group_by('p.postID')->order_by('dateUpdated', 'desc')
->limit($limit)->offset($offset);
}
}
public function getPostsRankingByPostId($postId)
{
return $this->db->where_in('postID', $postId)->from('cm_post_ranking');
}
public function getPostsScheduled()
{
return get_instance()->db->where('done', 'N')->get('cm_post_schedule')->result();
}
public function publishPosts($postIds)
{
get_instance()->db->where_in('postID', $postIds)->update('cm_post', ['published' => 1]);
get_instance()->db->where_in('postID', $postIds)->update('cm_post_schedule', ['done' => 'Y']);
return get_instance()->db->affected_rows();
}
public function save()
{
$categoryID = 0;
$data = array(
'postTitle' => $this->input->post('postTitle'),
'postSubTitle' => $this->input->post('postSubTitle'),
'categoryID' => $categoryID,
// 'postURL' => $this->input->post('postURL'),
// 'postContent' => $this->input->post('content'),
'postContentHTML' => $this->input->post('content'),
'postExcerpt' => $this->input->post('postExcerpt'),
'published' => $this->input->post('published'),
'datePosted' => date('Y-m-d H:i:s'),
'dateUpdated' => date('Y-m-d H:i:s'),
'unixStamp' => $this->input->post('unixStamp'),
);
if ($this->input->post('postImage') != "") {
$data['postImage'] = $this->input->post('postImage');
}
$this->db->insert('cm_post', $data);
$insertID = $this->db->insert_id();
if ($this->input->post('postTag')) {
$this->db->where('postID', $insertID)->delete('cm_post_tag');
$this->db->insert('cm_post_tag', ['postID' => $insertID, 'tag' => $this->input->post('postTag')]);
}
$this->postThumbnail($insertID, $this->input->post('postThumb'));
$this->addPostCategory($insertID, $this->input->post('categories') ? explode(',', $this->input->post('categories')) : []);
$this->addPostPage($insertID, $this->input->post('pages') ? explode(',', $this->input->post('pages')) : []);
$this->db->where('postID', $insertID)->update('cm_post', array('postURL' => $insertID));
}
public function update($id)
{
$categoryID = 0;
$this->addPostCategory($id, $this->input->post('categories') ? explode(',', $this->input->post('categories')) : []);
$this->addPostPage($id, $this->input->post('pages') ? explode(',', $this->input->post('pages')) : []);
if ($this->input->post('video')) {
$this->db->where('postID', $id)->update('cm_post_video', ['videoURL' => '']);
}
if ($this->input->post('postTag')) {
$this->db->where('postID', $id)->delete('cm_post_tag');
$this->db->insert('cm_post_tag', ['postID' => $id, 'tag' => $this->input->post('postTag')]);
}
$data = array(
'postTitle' => $this->input->post('postTitle'),
'postSubTitle' => $this->input->post('postSubTitle'),
'categoryID' => $categoryID,
// 'postURL' => $this->input->post('postURL'),
'postContentHTML' => $this->input->post('content'),
'postExcerpt' => $this->input->post('postExcerpt'),
'published' => $this->input->post('published'),
'dateUpdated' => date('Y-m-d H:i:s'),
'unixStamp' => $this->input->post('unixStamp'),
'userID' => $this->input->post('userID')
);
if ($this->input->post('postImage')) {
$data['postImage'] = '/images/' . date('Y/m/d/') . $this->input->post('postImage');
}
$this->postThumbnail($id, $this->input->post('postThumb'));
$this->db->where("postID", $id);
$this->db->update('cm_post', $data);
}
private function postThumbnail($postId, $thumb)
{
if ($thumb) {
$thumb = '/thumbs/' . date('Y/m/d/') . $thumb;
$this->db->where('postID', $postId)->delete('cm_post_thumb');
$this->db->insert('cm_post_thumb', ['postID' => $postId, 'thumb' => $thumb]);
return $this->db->insert_id();
}
}
public function addPostCategory($postID, $categories)
{
$tmp = [];
$this->db->where('postID', $postID)->delete('cm_post_category');
if (count($categories)) {
return $this->db->insert_batch('cm_post_category', array_filter(array_map(function ($category) use ($postID) {
return ['postID' => $postID, 'categoryID' => $category];
}, $categories), function ($c) use (&$tmp) {
$isDup = $c['categoryID'] ? false : true;
if (!$isDup) {
foreach ($tmp as $t) {
if ($t['categoryID'] == $c['categoryID']) {
$isDup = true;
break;
}
}
}
array_push($tmp, $c);
if (!$isDup) {
return $c;
}
}));
}
}
public function addPostPage($postID, $pages)
{
$tmp = [];
$this->db->where('postID', $postID)->delete('cm_post_page');
if (count($pages)) {
return $this->db->insert_batch('cm_post_page', array_filter(array_map(function ($page) use ($postID) {
return ['postID' => $postID, 'pageID' => $page];
}, $pages), function ($c) use (&$tmp) {
$isDup = $c['pageID'] ? false : true;
if (!$isDup) {
foreach ($tmp as $t) {
if ($t['pageID'] == $c['pageID']) {
$isDup = true;
break;
}
}
}
array_push($tmp, $c);
if (!$isDup) {
return $c;
}
}));
}
}
public function getPostVideo($postId)
{
return $this->db->where('postID', $postId)->get('cm_post_video')->row();
}
public function getPostTag($postId)
{
$query = $this->db->where('postID', $postId)->get('cm_post_tag');
return $query->num_rows() ? array_map(function ($row) {
$row['tag'] = explode(strpos($row['tag'], ',') ? ',':' ', $row['tag']);
return $row;
}, $query->result_array())[0] : ['tag' => []];
}
}

106
application/models/Pray_model.php Executable file
View File

@@ -0,0 +1,106 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Pray_model extends MY_Model
{
private $table = 'cm_pray';
public function __construct()
{
parent::__construct();
}
public function getPrayQuery()
{
return $this->db->from($this->table)->order_by('dateUpdated', 'desc');
}
public function getPaging($limit, $offset = 0)
{
if (!isAdminSite()) {
$this->db->where('dateDeleted is null');
}
return $this->db->from($this->table . ' py')
->select("py.*, if(u.nickname = '' or u.nickname is null, u.userName, u.nickName) as nickname")
->join('cm_user u', 'py.userID=u.userID', 'left')
->order_by('dateUpdated', 'desc')
->limit($limit)->offset($offset);
}
public function getCountPaging()
{
if (!isAdminSite()) {
$this->db->where('dateDeleted is null');
}
return $this->db->from($this->table)
->count_all_results();
}
public function getAll($limit, $offiset)
{
return $this->getPostQuery()->limit($limit)->offset($offiset);
}
public function getOne($prayId)
{
return $this->db->where('prayID', $prayId)->get($this->table)->row();
}
public function save($data)
{
$this->db->insert($this->table, $data);
return $this->db->insert_id();
}
public function update($prayId, $data)
{
$this->db->where('prayID', $prayId)->update($this->table, $data);
return $this->db->affected_rows();
}
public function delete($prayId)
{
return $this->db->where('prayID', $prayId)->delete($this->table);
}
public function bookmark($data)
{
$this->db->insert('cm_pray_ranking', $data);
return $this->db->insert_id();
}
public function getBookmarksAndRankings(&$prayers)
{
if (count($prayers)) {
$userID = getSessionUser()->is ? getSessionUser()->userID : 0;
array_map(function ($rating) use (&$prayers, $userID) {
foreach ($prayers as $k => $v) {
if ($v->prayID == $rating->prayID) {
if ($rating->title == 1) {
$prayers[$k]->like++;
} else if($rating->title == 3){
if($rating->userID == $userID) {
$prayers[$k]->bookmark = 1;
}
$prayers[$k]->bookmarks++;
}
}
}
}, $this->getRankingsByPrayId(array_column($prayers, 'prayID')));
}
}
private function getRankingsByPrayId($prayId)
{
$prayId = is_array($prayId) ? $prayId : [$prayId];
return $this->db->where_in('prayID', $prayId)
->get('cm_pray_ranking')->result();
}
public function getPrayRankingCountByTitle($prayId, $title) {
return $this->db->where('prayID', $prayId)->where('title', $title)->count_all_results('cm_pray_ranking');
}
}

View File

@@ -0,0 +1,15 @@
<?php
class Settings_model extends MY_Model {
public function __construct()
{
parent::__construct();
}
public function findBySiteID(int $siteID) {
return $this->db->where("siteID", $siteID)
->get('cm_settings')
->row();
}
}

View File

@@ -0,0 +1,49 @@
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class User_model extends MY_Model
{
private $db;
private $table = 'cm_user';
public function __construct()
{
parent::__construct();
$this->db = &get_instance()->db;
}
private function init()
{
return $this->db->from('cm_user');
}
public function getOne($seq)
{
return self::init()->where_in("seq", $seq)->get()->row();
}
public function findByUserName($userName)
{
return $this->init()->where('userName', $userName)
->get()->result();
}
public function findByEmail($email)
{
return $this->init()->where('email', $email)
->get()->result();
}
public function save($data)
{
return $this->db->insert_batch('cm_user', is_array($data) ? $data : [$data]);
}
public function getAdminSiteUsers()
{
return $this->db->where_in('roleID', [2, 5, 7])->get($this->table)->result();
}
}

10
application/models/index.html Executable file
View File

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

View File

@@ -0,0 +1,10 @@
<?php
# Use this file if you cannot use class autoloading. It will include all the
# files needed for the Markdown parser.
#
# Take a look at the PSR-0-compatible class autoloading implementation
# in the Readme.php file if you want a simple autoloader setup.
require_once dirname(__FILE__) . '/MarkdownInterface.php';
require_once dirname(__FILE__) . '/Markdown.php';

3144
application/third_party/Michelf/Markdown.php vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
<?php
# Use this file if you cannot use class autoloading. It will include all the
# files needed for the MarkdownExtra parser.
#
# Take a look at the PSR-0-compatible class autoloading implementation
# in the Readme.php file if you want a simple autoloader setup.
require_once dirname(__FILE__) . '/MarkdownInterface.php';
require_once dirname(__FILE__) . '/Markdown.php';
require_once dirname(__FILE__) . '/MarkdownExtra.php';

View File

@@ -0,0 +1,37 @@
<?php
#
# Markdown Extra - A text-to-HTML conversion tool for web writers
#
# PHP Markdown Extra
# Copyright (c) 2004-2014 Michel Fortin
# <http://michelf.com/projects/php-markdown/>
#
# Original Markdown
# Copyright (c) 2004-2006 John Gruber
# <http://daringfireball.net/projects/markdown/>
#
# Just force Michelf/Markdown.php to load. This is needed to load
# the temporary implementation class. See below for details.
\Michelf\Markdown::MARKDOWNLIB_VERSION;
#
# Markdown Extra Parser Class
#
# Note: Currently the implementation resides in the temporary class
# \Michelf\MarkdownExtra_TmpImpl (in the same file as \Michelf\Markdown).
# This makes it easier to propagate the changes between the three different
# packaging styles of PHP Markdown. Once this issue is resolved, the
# _MarkdownExtra_TmpImpl will disappear and this one will contain the code.
#
class MarkdownExtra extends \Michelf\_MarkdownExtra_TmpImpl {
### Parser Implementation ###
# Temporarily, the implemenation is in the _MarkdownExtra_TmpImpl class.
# See note above.
}

View File

@@ -0,0 +1,9 @@
<?php
# Use this file if you cannot use class autoloading. It will include all the
# files needed for the MarkdownInterface interface.
#
# Take a look at the PSR-0-compatible class autoloading implementation
# in the Readme.php file if you want a simple autoloader setup.
require_once dirname(__FILE__) . '/MarkdownInterface.php';

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