first commit

This commit is contained in:
pakerpale
2020-06-10 06:19:03 +09:00
commit cd6b5b7832
6081 changed files with 624389 additions and 0 deletions

20
.gitignore vendored Executable file
View File

@@ -0,0 +1,20 @@
public/images/
public/uploads/
storage/
public/ART/
public/ART
public/files/
public/files
public/thumbs/
public/thumbs
public/smarteditor/
public/smarteditor
public/img/
public/img
application/cache/
.htaccess
application/hooks/
application/logs/
application/config/development/
application/third_party/aws/
application/third_party/google/

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

@@ -0,0 +1,135 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
|
| You can also supply an alternative property name to be assigned in
| the controller:
|
| $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('general', '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();

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

@@ -0,0 +1,533 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/core_classes.html
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'CM_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = false;
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = '가-힣 a-z 0-9~%.:_\-\@';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = false;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Allow $_GET array
|--------------------------------------------------------------------------
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = true;
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 1;
/*
|--------------------------------------------------------------------------
| 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'] = APPPATH. 'logs/';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Whether to take the URL query string into consideration when generating
| output cache files. Valid options are:
|
| FALSE = Disabled
| TRUE = Enabled, take all query parameters into account.
| Please be aware that this may result in numerous cache
| files generated for the same page over and over again.
| array('q') = Enabled, but only take into account the specified list
| of query parameters.
|
*/
$config['cache_query_string'] = false;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| https://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = 'crossmap2018';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, driver dependent.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
|
| For the 'database' driver, it's a table name.
| Please read up the manual for the format with other session drivers.
|
| IMPORTANT: You are REQUIRED to set a valid save path!
|
| 'sess_match_ip'
|
| Whether to match the user's IP address when reading the session data.
|
| WARNING: If you're using the database driver, don't forget to update
| your session table's PRIMARY KEY when changing this setting.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'crossmap_admin_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = false;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = false;
$config['sess_expire_on_close'] = false;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = false;
$config['cookie_httponly'] = false;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = false;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = false;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = false;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = true;
$config['csrf_exclude_uris'] = array();
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = false;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = false;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';
/**
* Crossmap Life Category recategorize
*/
$config['categories'] = array(
'grace' => array('postcard' => 30, 'book' => 31, 'dailyQT' => 32, 'enQT' => 33, 'qna' => 34),
'crossmaptv' => array('word' => 40, 'worship' => 38, 'social' => 39, 'tv' => 41));

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

@@ -0,0 +1,117 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Display Debug backtrace
|--------------------------------------------------------------------------
|
| If set to TRUE, a backtrace will be displayed along with php errors. If
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
*/
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
| Exit Status Codes
|--------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
/*--------------------------------------------------------------------------
| 사용자 정의
|--------------------------------------------------------------------------*/
define('PATH_ROOT', '');
define('DIR_IMG', PATH_ROOT.'/img');
define('DIR_JS', PATH_ROOT.'/js');
define('DIR_CSS', PATH_ROOT.'/css');
$_SERVER['HTTP_HOST'] = (isset($_SERVER['HTTP_HOST'])==TRUE) ? $_SERVER['HTTP_HOST'] : 'crossmap.co.kr';
define('WWW_CROSSMAP','https://'.$_SERVER['HTTP_HOST']);
define('CROSSMAP_URL','https://'.$_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']);
define('WWW_CROSSMAP_M','https://'.$_SERVER['HTTP_HOST'])."/m";
define('CROSSMAP_URL_M','https://'.$_SERVER['HTTP_HOST']."/m/". $_SERVER['REQUEST_URI']);
define('PAGE_SIZE', '30');
define('CROSSMAP_EMAIL', 'crossmapkr@gmail.com');
define('CROSSMAP_EMAIL_NAME', '크로스맵');
define('CROSSMAP_EMAIL_ID', 'crossmap.test');
define('CROSSMAP_EMAIL_PASSWORD', 'zmfhtm123!');
define('DEF_MEMBER_COLUMNIST_CODE', '7'); // 칼럼리스트
define('DEF_NEWS_CODE', '1'); // 뉴스
define('DEF_COLUMN_CODE', '2'); // 칼럼
define('DEF_LIFE_CODE', '3'); // 라이프
define('MAPTOON_DIR_FRONT', '/files/maptoon/');
define('MAPTOON_DIR_BACK', $_SERVER['DOCUMENT_ROOT'].'/files/maptoon/');

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

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

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,27 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| File Cache configuration
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['file_cache_path'] = dirname(FCPATH). '/application/cache/';

View File

@@ -0,0 +1,103 @@
<?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',
'/Þ|þ/' => 'th',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
'/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
'/В/' => 'V',
'/в/' => 'v',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
'/ź|ż|ž|ζ|з/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/' => 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f',
'/ξ/' => 'ks',
'/π/' => 'p',
'/β/' => 'v',
'/μ/' => 'm',
'/ψ/' => 'ps',
'/Ё/' => 'Yo',
'/ё/' => 'yo',
'/Є/' => 'Ye',
'/є/' => 'ye',
'/Ї/' => 'Yi',
'/Ж/' => 'Zh',
'/ж/' => 'zh',
'/Х/' => 'Kh',
'/х/' => 'kh',
'/Ц/' => 'Ts',
'/ц/' => 'ts',
'/Ч/' => 'Ch',
'/ч/' => 'ch',
'/Ш/' => 'Sh',
'/ш/' => 'sh',
'/Щ/' => 'Shch',
'/щ/' => 'shch',
'/Ъ|ъ|Ь|ь/' => '',
'/Ю/' => 'Yu',
'/ю/' => 'yu',
'/Я/' => 'Ya',
'/я/' => 'ya'
);

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:
|
| https://codeigniter.com/user_guide/general/hooks.html
|
*/

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: https://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' = Sequential migration naming (001_add_blog.php)
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
| Use timestamp format YYYYMMDDHHIISS.
|
| Note: If this configuration value is missing the Migration library
| defaults to 'sequential' for backward compatibility with CI2.
|
*/
$config['migration_type'] = 'timestamp';
/*
|--------------------------------------------------------------------------
| Migrations table
|--------------------------------------------------------------------------
|
| This is the name of the table that will store the current migrations state.
| When migrations runs it will store in a database table which migration
| level the system is at. It then compares the migration level in this
| table to the $config['migration_version'] if they are not the same it
| will migrate up. This must be set.
|
*/
$config['migration_table'] = 'migrations';
/*
|--------------------------------------------------------------------------
| Auto Migrate To Latest
|--------------------------------------------------------------------------
|
| If this is set to TRUE when you load the migrations class and have
| $config['migration_enabled'] set to TRUE the system will auto migrate
| to your latest migration (whatever $config['migration_version'] is
| set to). This way you do not have to call migrations anywhere else
| in your code to have the latest migration.
|
*/
$config['migration_auto_latest'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->current() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
|
*/
$config['migration_path'] = APPPATH.'migrations/';

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

@@ -0,0 +1,183 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
'ai' => array('application/pdf', 'application/postscript'),
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => array('application/x-javascript', 'text/plain'),
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => array('audio/x-aiff', 'audio/aiff'),
'aiff' => array('audio/x-aiff', 'audio/aiff'),
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => array('text/css', 'text/plain'),
'html' => array('text/html', 'text/plain'),
'htm' => array('text/html', 'text/plain'),
'shtml' => array('text/html', 'text/plain'),
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => array('application/xml', 'text/xml', 'text/plain'),
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
'mp4' => array('video/mp4', 'video/3gpp', 'application/octet-stream'),
'movie' => 'video/x-sgi-movie',
'doc' => array('application/msword', 'application/vnd.ms-office'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
'dot' => array('application/msword', 'application/vnd.ms-office'),
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json'),
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
'der' => 'application/x-x509-ca-cert',
'kdb' => 'application/octet-stream',
'pgp' => 'application/pgp',
'gpg' => 'application/gpg-keys',
'sst' => 'application/octet-stream',
'csr' => 'application/octet-stream',
'rsa' => 'application/x-pkcs7',
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
'3g2' => 'video/3gpp2',
'3gp' => array('video/3gp', 'video/3gpp'),
'm4a' => 'audio/x-m4a',
'f4v' => array('video/mp4', 'video/x-f4v'),
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => array('application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
'vcf' => 'text/x-vcard',
'srt' => array('text/srt', 'text/plain'),
'vtt' => array('text/vtt', 'text/plain'),
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
'odc' => 'application/vnd.oasis.opendocument.chart',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'odf' => 'application/vnd.oasis.opendocument.formula',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'odi' => 'application/vnd.oasis.opendocument.image',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'odt' => 'application/vnd.oasis.opendocument.text',
'odm' => 'application/vnd.oasis.opendocument.text-master',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oth' => 'application/vnd.oasis.opendocument.text-web'
);

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:
|
| https://codeigniter.com/user_guide/general/profiling.html
|
*/

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

@@ -0,0 +1,70 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'index';
// $route['grace/.*/:num'] = 'grace/view';
$route['grace/:num'] = 'grace/view';
$route['grace/category/.*'] = 'grace/category';
$route['grace/editor/.*'] = 'grace/editor';
$route['grace/posts'] = 'grace/posts';
$route['grace/.*'] = 'grace/view';
$route['cmtv/:num'] = 'cmtv/view';
$route['cmtv/category/.*'] = 'cmtv/category';
$route['cmtv/channel/.*'] = 'cmtv/channel';
$route['cmtv/channels/.*'] = 'cmtv/channels';
$route['cmtv/posts'] = 'cmtv/posts';
$route['cmtv/.*'] = 'cmtv/view';
$route['adm'] = 'adm/content';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

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

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

View File

@@ -0,0 +1,214 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains four arrays of user agent data. It is used by the
| User Agent Class to help identify browser, platform, robot, and
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
*/
$platforms = array(
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'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',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot'
);

View File

@@ -0,0 +1,187 @@
<?php
class Cmtv extends MY_Controller
{
private $parentCategoryName = 'crossmaptv-category';
public function __construct()
{
parent::__construct();
$this->load->library('Post', '', 'post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('life_model');
$this->cmtvCategories = $this->getSubCategoryId($this->parentCategoryName);
}
public function index()
{
$data = array(
'cmtvCategories' => $this->category_model->findById($this->cmtvCategories)->result(),
'cmtvEditors' => $this->editor_model->findByCategoryId($this->cmtvCategories)->get()->result(),
);
$this->load->view($this->adminViewFolder . 'cmtv', $data);
}
private function tableClause()
{
if ($this->param('term')) {
$this->db->like('l.title', $this->param('term'));
}
if ($this->param('category')) {
$this->db->like('l.category_idx', $this->param('category'));
}
if ($this->param('editor')) {
$this->db->like('p.idx', $this->param('editor'));
}
}
public function table()
{
$request = $this->getRequest();
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->life_model->findByCategoryId($this->cmtvCategories)
->order_by('l.' . (empty($sortColumns[$sort]) ? $sortColumns['reg_date'] : $sortColumns[$sort]), $this->param('order'))
->where('l.is_display !=', null)
->select('l.display_date, l.is_display')
->limit($this->param('limit'))
->offset($this->param('offset'));
$this->tableClause();
$graces = $this->db->get()->result();
foreach($graces as $k => $g) {
if(strtotime($g->display_date) > time() && $g->is_display == 'N') {
$graces[$k]->isSetDptime = 1;
}
}
$graceTotalCount = $this->life_model->findByCategoryId($this->cmtvCategories);
$this->tableClause();
$graceTotalCount = $this->db->count_all_results();
$categories = array();
foreach ($graces as $grace) {
array_push($categories, $grace->categoryId);
}
$categories = $this->category_model->findById($categories)->result();
foreach ($graces as $k => $g) {
foreach ($categories as $c) {
if ($g->categoryId == $c->idx) {
$graces[$k]->categoryName = $c->category_name;
}
}
}
$this->output
->set_content_type('application/json')
->set_output(json_encode(array('total' => $graceTotalCount,
'rows' => $graces)));
}
public function content_delete()
{
$this->life_model->findById(1)->reset_query()->where('idx', $this->param('contentId'))->delete($this->life_model->table);
if ($deleted = $this->db->affected_rows()) {
$this->response(array('deleted' => $deleted));
}
}
public function content_category()
{
$data = array();
if ($this->param('category')) {
$data['category_idx'] = $this->param('category');
}
if ($this->param('editor')) {
$data['partner_idx'] = $this->param('editor');
}
$this->life_model->findById($this->param('contentId'))->set($data)->update();
$updated = $this->db->affected_rows();
$this->response(array('updated' => $updated));
}
public function category()
{
$this->load->view($this->adminViewFolder . 'cmtv-category');
}
public function category_table()
{
$sort = $this->param('sort');
$order = $this->param('order');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->category_model->findById($this->cmtvCategories, true)
->join($this->editor_model->table . ' p', 'category.idx = p.category_idx', 'left')
->where('category.is_del', 'N')
->group_by('category.idx')->select('count(category_idx) editorCount, category.category_name categoryName, category.display_sort displayOrder, category.reg_date, category.idx categoryId');
if ($this->param('term')) {
$this->db->like('category.category_name', $this->param('term'));
}
$categoryEditors = $this->db->get()->result();
$categories = array();
foreach ($categoryEditors as $grace) {
array_push($categories, $grace->categoryId);
}
$posts = $this->life_model->findByCategoryId($this->cmtvCategories)->group_by('l.category_idx')
->select('count(l.idx) postCount, sum(l.hit_count) views')->get()->result();
foreach ($categoryEditors as $k => $g) {
$categoryEditors[$k]->postCount = 0;
$categoryEditors[$k]->views = 0;
foreach ($posts as $p) {
if ($g->categoryId == $p->categoryId) {
$categoryEditors[$k]->postCount += $p->postCount;
$categoryEditors[$k]->views += $p->views;
}
}
}
$this->output
->set_content_type('application/json')
->set_output(json_encode(array('total' => count($categoryEditors),
'rows' => $categoryEditors)));
}
public function category_save()
{
$parentId = $this->category_model->getSubCategoryId($this->parentCategoryName)['parent'];
if (!empty($this->param('id'))) {
$this->db->where('idx', $this->param('id'))->update($this->category_model->table, array(
'category_name' => $this->param('name'),
'display_sort' => $this->param('order'),
'parent' => $parentId,
'update_id' => $this->session->userdata('Adm_Id'),
'update_date' => date('Y-m-d H:i:s'),
));
if ($updated = $this->db->affected_rows()) {
$this->response(array('updated' => $updated));
}
} else {
if ($inserted = $this->db->insert($this->category_model->table, array(
'category_name' => $this->param('name'),
'display_sort' => $this->param('order'),
'parent' => $parentId,
'reg_id' => $this->session->userdata('Adm_Id'),
'reg_date' => date('Y-m-d H:i:s'),
))) {
$this->response(array('inserted' => $this->db->insert_id()));
}
}
}
public function category_delete()
{
if (!empty($this->param('id'))) {
$this->db->where('idx', $this->param('id'))->update($this->category_model->table, array(
'is_del' => 'Y',
));
if ($updated = $this->db->affected_rows()) {
$this->response(array('updated' => $updated));
}
}
}
}

View File

@@ -0,0 +1,102 @@
<?php
class Comment extends MY_Controller
{
private $menuCategories = array();
public function __construct()
{
parent::__construct();
$this->load->model('editor_model');
$this->load->model('comment_model');
$this->menuCategories['은혜충전'] = $this->getSubCategoryId('grace-category');
$this->menuCategories['크로스맵TV'] = $this->getSubCategoryId('crossmaptv-category');
}
public function index()
{
$data = array(
'menuCategories' => array_keys($this->menuCategories),
'graceCategories' => $this->category_model->findById($this->categories['grace'])->result(),
'graceEditors' => $this->editor_model->findByCategoryId($this->categories['grace'])->get()->result(),
);
$this->load->view($this->adminViewFolder . 'comment', $data);
}
private function tableClause()
{
if ($this->param('term')) {
$this->db->like('l.title', $this->param('term'));
}
if ($this->param('category')) {
$this->db->like('l.category_idx', $this->param('category'));
}
if ($this->param('editor')) {
$this->db->like('p.idx', $this->param('editor'));
}
}
public function table()
{
$request = $this->getRequest();
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->comment_model->find()->limit($this->param('limit'))->offset($this->param('offset'))
->join('life f', 'cmt.content_idx=f.idx', 'left')
->join('category c', 'f.category_idx=c.idx', 'left')
->join('partner p', 'f.partner_idx=p.idx', 'left')
->where('cmt.content_type', '3')->where('f.is_del', 'N')->where('cmt.is_del', 'N');
if($this->param('term')) {
$this->db->group_start()->like('cmt.comment', $this->param('term'), 'both')
->or_like('f.title', $this->param('term'), 'both')->group_end();
}
$comments = $this->db->select('cmt.idx commentId, f.title, c.category_name, p.partner_name, cmt.comment, f.idx, cmt.reg_date, 0 likes, 0 bads')
->get()->result();
$commentId = array();
foreach($comments as $c) {
array_push($commentId, $c->idx);
}
if(count($comments)) {
$likes = $this->db->where_in('comment_idx', $commentId)
->select('count(idx) cnt, type_name, comment_idx')
->group_by('comment_idx, type_name')->get('comment_like_log')->result();
foreach($comments as $k => $c) {
foreach($likes as $l) {
if($c->idx == $l->comment_idx) {
if($l->type_name == 'like_count') {
$comments[$k]->likes += $l->cnt;
}else {
$comments[$k]->bads += $l->cnt;
}
}
}
}
}
if($this->param('term')) {
$this->db->group_start()->like('cmt.comment', $this->param('term'), 'both')
->or_like('f.title', $this->param('term'), 'both')->group_end();
}
$commentTotalCount = $this->comment_model->find()
->join('life f', 'cmt.content_idx=f.idx', 'left')
->where('cmt.content_type', '3')->where('f.is_del', 'N')->where('cmt.is_del', 'N')
->count_all_results();
$this->output
->set_content_type('application/json')
->set_output(json_encode(array('total' => $commentTotalCount,
'rows' => $comments)));
}
public function content_delete() {
$this->db->where('idx', $this->param('contentId'))->update($this->comment_model->table, array('is_del' => 'Y'));
if ($deleted = $this->db->affected_rows()) {
$this->response(array('deleted' => $deleted));
}
}
}

View File

@@ -0,0 +1,114 @@
<?php
class Content extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function upload()
{
$config['upload_path'] = FCPATH . '/uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 1024;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$this->load->library('upload', $config);
if (!$this->upload->do_upload('userfile')) {
$this->response(null, 500, $this->upload->display_errors('', ''));
} else {
$uploaded = $this->upload->data();
$uploaded['url'] = $_SERVER['HTTP_ORIGIN'] . '/uploads/' . $uploaded['file_name'];
$this->response($uploaded);
}
}
public function dptime()
{
}
public function config()
{
$this->load->model('config_model');
if ($this->input->method() == 'post') {
if ($this->param('type') == 'dptime') {
$this->load->model('life_model');
$this->db->where('idx', $this->param('postid'))->update($this->life_model->table, array('is_display' => 'N', 'display_date' => $this->param('dptime')));
$config = $this->config_model->findByTypeAndPostId($this->param('type'), $this->param('postid'))->get()->row();
if($config) {
if($this->db->where('Id', $config->Id)->update($this->config_model->table, array(
'PostId' => $this->param('postid'),
'Type' => $this->param('type'),
'DpTime' => $this->param('dptime')
))){
$this->response(array('updated' => $this->db->affected_rows()));
} else {
$this->response(null, 402, 'failed to update');
}
}else {
if($this->db->insert($this->config_model->table, array(
'PostId' => $this->param('postid'),
'Type' => $this->param('type'),
'DpTime' => $this->param('dptime')
))){
$this->response(array('inserted' => $this->db->insert_id()));
} else {
$this->response(null, 402, 'failed to svae');
}
}
} else if ($this->param('id')) {
$config = $this->config_model->findByTypeAndNameAndPageAndOrderNum($this->param('type'),
$this->param('name'), $this->param('page'), $this->param('order'))->get();
if ($config->num_rows() && $config->row()->Id != $this->param('id')) {
$this->response(null, 401, '삭제먼저');
} else if ($this->db->where('Id', $this->param('id'))->update($this->config_model->table, array(
'PostId' => $this->param('postid'),
'Type' => $this->param('type'),
'Name' => $this->param('name'),
'Page' => $this->param('page'),
'OrderNum' => $this->param('order'),
'Headline' => $this->param('headline'),
'Title' => $this->param('title'),
'Thumbnail' => $this->param('thumbnail'),
))) {
$this->response(array('inserted' => $this->db->insert_id()));
} else {
$this->response(null, 402, 'failed to svae');
}
} else if ($this->config_model->findByTypeAndNameAndPageAndOrderNum($this->param('type'), $this->param('name'),
$this->param('page'), $this->param('order'))->count_all_results()) {
$this->response(null, 401, '삭제먼저');
} else {
if ($this->db->insert($this->config_model->table, array(
'PostId' => $this->param('postid'),
'Type' => $this->param('type'),
'Name' => $this->param('name'),
'Page' => $this->param('page'),
'OrderNum' => $this->param('order'),
'Headline' => $this->param('headline'),
'Title' => $this->param('title'),
'Thumbnail' => $this->param('thumbnail'),
))) {
$this->response(array('inserted' => $this->db->insert_id()));
} else {
$this->response(null, 402, 'failed to svae');
}
}
} else if ($this->input->method() == 'delete') {
$this->db->where('Id', $this->param('id'))->delete($this->config_model->table);
if ($this->db->affected_rows()) {
$this->response(null, 200, '삭제성공');
} else {
$this->response(null, 401, '삭제실패');
}
} else {
if ($configQuery = $this->config_model->findByTypeAndNameAndPage($this->param('type'), $this->param('name'), $this->param('page'))->order_by('OrderNum')->get()->result()) {
$this->response($configQuery);
} else {
$this->response(array(), 200);
}
}
}
}

View File

@@ -0,0 +1,188 @@
<?php
class Grace extends MY_Controller
{
private $parentCategoryName = 'grace-category';
public function __construct()
{
parent::__construct();
$this->load->library('Post', '', 'post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('life_model');
$this->graceCategories = $this->getSubCategoryId($this->parentCategoryName);
}
public function index()
{
$data = array(
'graceCategories' => $this->category_model->findById($this->graceCategories)->result(),
'graceEditors' => $this->editor_model->findByCategoryId($this->graceCategories)->get()->result(),
);
$this->load->view($this->adminViewFolder . 'grace', $data);
}
private function tableClause()
{
if ($this->param('term')) {
$this->db->like('l.title', $this->param('term'));
}
if ($this->param('category')) {
$this->db->like('l.category_idx', $this->param('category'));
}
if ($this->param('editor')) {
$this->db->like('p.idx', $this->param('editor'));
}
}
public function table()
{
$request = $this->getRequest();
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->life_model->findByCategoryId($this->graceCategories)
->order_by('l.' . (empty($sortColumns[$sort]) ? $sortColumns['reg_date'] : $sortColumns[$sort]), $this->param('order'))
->where('l.is_display !=', null)
->select('l.display_date, l.is_display')
->limit($this->param('limit'))
->offset($this->param('offset'));
$this->tableClause();
$graces = $this->db->get()->result();
foreach($graces as $k => $g) {
if(strtotime($g->display_date) > time() && $g->is_display == 'N') {
$graces[$k]->isSetDptime = 1;
}
}
$graceTotalCount = $this->life_model->findByCategoryId($this->graceCategories);
$this->tableClause();
$graceTotalCount = $this->db->count_all_results();
$categories = array();
foreach ($graces as $grace) {
array_push($categories, $grace->categoryId);
}
$categories = $this->category_model->findById($categories)->result();
foreach ($graces as $k => $g) {
foreach ($categories as $c) {
if ($g->categoryId == $c->idx) {
$graces[$k]->categoryName = $c->category_name;
}
}
}
$this->output
->set_content_type('application/json')
->set_output(json_encode(array('total' => $graceTotalCount,
'rows' => $graces)));
}
public function content_delete()
{
$this->life_model->findById(1)->reset_query()->where('idx', $this->param('contentId'))->delete($this->life_model->table);
if ($deleted = $this->db->affected_rows()) {
$this->response(array('deleted' => $deleted));
}
}
public function content_category()
{
$data = array();
if ($this->param('category')) {
$data['category_idx'] = $this->param('category');
}
if ($this->param('editor')) {
$data['partner_idx'] = $this->param('editor');
}
$this->life_model->findById($this->param('contentId'))->set($data)->update();
$this->response(array('updated' => $updated));
}
public function category()
{
$this->load->view($this->adminViewFolder . 'grace-category');
}
public function category_table()
{
$sort = $this->param('sort');
$order = $this->param('order');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->category_model->findById($this->graceCategories, true)
->join($this->editor_model->table . ' p', 'category.idx = p.category_idx', 'left')
->where('category.is_del', 'N')
->group_by('category.idx')->select('count(category_idx) editorCount, category.category_name categoryName, category.display_sort displayOrder, category.reg_date, category.idx categoryId');
if ($this->param('term')) {
$this->db->like('category.category_name', $this->param('term'));
}
$categoryEditors = $this->db->get()->result();
$categories = array();
foreach ($categoryEditors as $grace) {
array_push($categories, $grace->categoryId);
}
$posts = $this->life_model->findByCategoryId($this->graceCategories)->group_by('l.category_idx')
->select('count(l.idx) postCount, sum(l.hit_count) views')->get()->result();
foreach ($categoryEditors as $k => $g) {
$categoryEditors[$k]->postCount = 0;
$categoryEditors[$k]->views = 0;
foreach ($posts as $p) {
if ($g->categoryId == $p->categoryId) {
$categoryEditors[$k]->postCount += $p->postCount;
$categoryEditors[$k]->views += $p->views;
}
}
}
$this->output
->set_content_type('application/json')
->set_output(json_encode(array('total' => count($categoryEditors),
'rows' => $categoryEditors)));
}
public function category_save()
{
$parentId = $this->category_model->getSubCategoryId($this->parentCategoryName)['parent'];
if (!empty($this->param('id'))) {
$this->db->where('idx', $this->param('id'))->update($this->category_model->table, array(
'category_name' => $this->param('name'),
'display_sort' => $this->param('order'),
'parent' => $parentId,
'update_id' => $this->session->userdata('Adm_Id'),
'update_date' => date('Y-m-d H:i:s'),
));
if ($updated = $this->db->affected_rows()) {
$this->response(array('updated' => $updated));
}
} else {
if ($inserted = $this->db->insert($this->category_model->table, array(
'category_name' => $this->param('name'),
'display_sort' => $this->param('order'),
'parent' => $parentId,
'reg_id' => $this->session->userdata('Adm_Id'),
'reg_date' => date('Y-m-d H:i:s'),
))) {
$this->response(array('inserted' => $this->db->insert_id()));
}
}
}
public function category_delete()
{
if (!empty($this->param('id'))) {
$this->db->where('idx', $this->param('id'))->update($this->category_model->table, array(
'is_del' => 'Y',
));
if ($updated = $this->db->affected_rows()) {
$this->response(array('updated' => $updated));
}
}
}
}

View File

@@ -0,0 +1,116 @@
<?php
class Korea extends MY_Controller
{
private $parentCategoryName = 'grace-category';
private $lifeCategories = array('ids' => array());
public function __construct()
{
parent::__construct();
$this->load->library(array('pagination'));
$this->load->library('Post', '', 'post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('life_model');
$this->lifeCategories['result'] = $this->category_model->findById()->result();
foreach ($this->lifeCategories['result'] as $c) {
array_push($this->lifeCategories['ids'], $c->idx);
}
}
public function index()
{
$table = $this->table();
// print_r($table['rows']);die;
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__);
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
$data = array(
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result(),
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page
);
$this->load->view('adm/template', $data);
}
private function tableClause()
{
}
public function table()
{
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->life_model->findByCategoryId($this->lifeCategories['ids'])
->order_by('l.' . $sortColumns['reg_date'], $this->param('order'))
->where('l.is_display !=', null)
->select('l.display_date, l.is_display')
->limit($this->param('limit'))
->offset($this->param('limit') * $this->param('page'));
if ($this->param('term')) {
$this->db->like('l.title', $this->param('term'));
}
if ($this->param('category')) {
$this->db->like('l.category_idx', $this->param('category'));
}
if ($this->param('editor')) {
$this->db->like('p.idx', $this->param('editor'));
}
$graces = $this->db->get()->result();
foreach ($graces as $k => $g) {
if (strtotime($g->display_date) > time() && $g->is_display == 'N') {
$graces[$k]->isSetDptime = 1;
}
}
$graceTotalCount = $this->life_model->findByCategoryId($this->lifeCategories['ids']);
if ($this->param('term')) {
$this->db->like('l.title', $this->param('term'));
}
if ($this->param('category')) {
$this->db->like('l.category_idx', $this->param('category'));
}
if ($this->param('editor')) {
$this->db->like('p.idx', $this->param('editor'));
}
$graceTotalCount = $this->db->count_all_results();
$categories = array();
foreach ($graces as $grace) {
array_push($categories, $grace->categoryId);
}
if (count($categories)) {
$categories = $this->category_model->findById(implode(',', $categories))->result();
foreach ($graces as $k => $g) {
foreach ($categories as $c) {
if ($g->categoryId == $c->idx) {
$graces[$k]->categoryName = $c->category_name;
}
}
}
}
return array('total' => $graceTotalCount, 'rows' => $graces);
}
public function write() {
$this->load->view('adm/write');
}
}

View File

@@ -0,0 +1,197 @@
<?php
class Life extends MY_Controller
{
private $parentCategoryName = 'grace-category';
private $lifeCategories = array('ids' => array());
public function __construct()
{
parent::__construct();
$this->load->library('Post', '', 'post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('life_model');
$this->lifeCategories['result'] = $this->category_model->findById()->result();
foreach ($this->lifeCategories['result'] as $c) {
array_push($this->lifeCategories['ids'], $c->idx);
}
}
public function index()
{
$data = array(
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result(),
);
$this->load->view($this->adminViewFolder . 'life', $data);
}
private function tableClause()
{
if ($this->param('term')) {
$this->db->like('l.title', $this->param('term'));
}
if ($this->param('category')) {
$this->db->like('l.category_idx', $this->param('category'));
}
if ($this->param('editor')) {
$this->db->like('p.idx', $this->param('editor'));
}
}
public function table()
{
$request = $this->getRequest();
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->life_model->findByCategoryId($this->lifeCategories['ids'])
->order_by('l.' . (empty($sortColumns[$sort]) ? $sortColumns['reg_date'] : $sortColumns[$sort]), $this->param('order'))
->where('l.is_display !=', null)
->select('l.display_date, l.is_display')
->limit($this->param('limit'))
->offset($this->param('offset'));
$this->tableClause();
$graces = $this->db->get()->result();
foreach ($graces as $k => $g) {
if (strtotime($g->display_date) > time() && $g->is_display == 'N') {
$graces[$k]->isSetDptime = 1;
}
}
$graceTotalCount = $this->life_model->findByCategoryId($this->lifeCategories['ids']);
$this->tableClause();
$graceTotalCount = $this->db->count_all_results();
$categories = array();
foreach ($graces as $grace) {
array_push($categories, $grace->categoryId);
}
if (count($categories)) {
$categories = $this->category_model->findById($categories)->result();
foreach ($graces as $k => $g) {
foreach ($categories as $c) {
if ($g->categoryId == $c->idx) {
$graces[$k]->categoryName = $c->category_name;
}
}
}
}
$this->output
->set_content_type('application/json')
->set_output(json_encode(array('total' => $graceTotalCount,
'rows' => $graces)));
}
public function content_delete()
{
$this->life_model->findById(1)->reset_query()->where('idx', $this->param('contentId'))->delete($this->life_model->table);
if ($deleted = $this->db->affected_rows()) {
$this->response(array('deleted' => $deleted));
}
}
public function content_category()
{
$data = array();
if ($this->param('category')) {
$data['category_idx'] = $this->param('category');
}
if ($this->param('editor')) {
$data['partner_idx'] = $this->param('editor');
}
$this->life_model->findById($this->param('contentId'))->set($data)->update();
if ($updated = $this->db->affected_rows()) {
$this->response(array('updated' => $updated));
}
}
public function category()
{
$this->load->view($this->adminViewFolder . 'life-category');
}
public function category_table()
{
$sort = $this->param('sort');
$order = $this->param('order');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->editor_model->findByCategoryId(null)
->join($this->category_model->table . ' c', 'p.category_idx=c.idx', 'right')
->where_in('c.idx', $this->lifeCategories['ids'])
->where('c.is_del', 'N')
->group_by('c.idx')->select('count(category_idx) editorCount, c.category_name categoryName,
c.display_sort displayOrder, c.reg_date, c.idx categoryId');
if ($this->param('term')) {
$this->db->like('c.category_name', $this->param('term'));
}
$categoryEditors = $this->db->get()->result();
$categories = array();
foreach ($categoryEditors as $grace) {
array_push($categories, $grace->categoryId);
}
$posts = $this->life_model->findByCategoryId($this->lifeCategories['ids'])->group_by('p.category_idx')
->select('count(p.idx) postCount, sum(hit_count) views')->get()->result();
foreach ($categoryEditors as $k => $g) {
$categoryEditors[$k]->postCount = 0;
$categoryEditors[$k]->views = 0;
foreach ($posts as $p) {
if ($g->categoryId == $p->categoryId) {
$categoryEditors[$k]->postCount += $p->postCount;
$categoryEditors[$k]->views += $p->views;
}
}
}
$this->output
->set_content_type('application/json')
->set_output(json_encode(array('total' => count($categoryEditors),
'rows' => $categoryEditors)));
}
public function category_save()
{
$parentId = $this->category_model->getSubCategoryId($this->parentCategoryName)['parent'];
if (!empty($this->param('id'))) {
$this->db->where('idx', $this->param('id'))->update($this->category_model->table, array(
'category_name' => $this->param('name'),
'display_sort' => $this->param('order'),
'parent' => $parentId,
'update_id' => $this->session->userdata('Adm_Id'),
'update_date' => date('Y-m-d H:i:s'),
));
if ($updated = $this->db->affected_rows()) {
$this->response(array('updated' => $updated));
}
} else {
if ($inserted = $this->db->insert($this->category_model->table, array(
'category_name' => $this->param('name'),
'display_sort' => $this->param('order'),
'parent' => $parentId,
'reg_id' => $this->session->userdata('Adm_Id'),
'reg_date' => date('Y-m-d H:i:s'),
))) {
$this->response(array('inserted' => $this->db->insert_id()));
}
}
}
public function category_delete()
{
if (!empty($this->param('id'))) {
$this->db->where('idx', $this->param('id'))->update($this->category_model->table, array(
'is_del' => 'Y',
));
if ($updated = $this->db->affected_rows()) {
$this->response(array('updated' => $updated));
}
}
}
}

View File

@@ -0,0 +1,16 @@
<?php
class Main extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->view($this->adminViewFolder . 'main');
}
}

View File

@@ -0,0 +1,493 @@
<?php
class Content extends MY_Controller
{
private $parentCategoryName = 'grace-category';
private $lifeCategories = array('ids' => array());
public function __construct()
{
parent::__construct();
$this->load->library('pagination');
$this->load->library('post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('life_model');
$this->load->model('member_model');
$this->load->library('awsfileuploader');
$this->lifeCategories['result'] = $this->category_model->findById()->result();
foreach ($this->lifeCategories['result'] as $c) {
array_push($this->lifeCategories['ids'], $c->idx);
}
$this->editors = $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->order_by('partner_name')->get()->result();
}
public function index()
{
$table = $this->table();
// print_r($table['rows']);die;
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__);
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
if ($this->input->get('pageset')) {
foreach ($table['rows'] as $k => $r) {
$table['rows'][$k]->title = html_entity_decode(convertEmoji($table['rows'][$k]->title));
$table['rows'][$k]->mainImg = imgSrc($table['rows'][$k]->mainImg);
}
$this->response($table);
} else {
$data = array(
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editors,
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/content', $data);
}
}
private function tableClause()
{
if ($this->param('term')) {
$this->db->like('l.title', $this->param('term'));
}
if ($this->param('category')) {
$ccc = $this->param('category');
if ($this->input->get('pageset') && strpos($this->param('category'), '-')) {
$ccc = explode('-', $this->param('category'));
}
$this->db->where_in('l.category_idx', $ccc);
}
if ($this->param('editor')) {
$this->db->like('l.partner_idx', $this->param('editor'));
}
$this->db->where('l.is_display !=', null);
if ($this->input->get('pageset')) {$this->db->where('l.is_del', 'N');
$this->db->where('l.is_display', 'Y');}
}
private function getTableRows()
{
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->tableClause();
$this->life_model->findByCategoryId($this->lifeCategories['ids'])
->order_by('l.' . $sortColumns['reg_date'], $this->param('order'))
->select('l.display_date, l.is_display, l.is_del')
->limit($this->param('limit'))
->offset($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0));
$graces = $this->db->get()->result();
foreach ($graces as $k => $g) {
if (strtotime($g->display_date) > time() && $g->is_display == 'N') {
$graces[$k]->isSetDptime = 1;
}
}
return $graces;
}
private function getTableCount()
{
$this->tableClause();
$this->life_model->findByCategoryId($this->lifeCategories['ids']);
return $this->db->count_all_results();
}
public function table()
{
$graces = $this->getTableRows();
$graceTotalCount = $this->getTableCount();
$this->addCategoryNameToTableResponse($graces);
return array('total' => $graceTotalCount, 'rows' => $graces);
}
private function addCategoryNameToTableResponse(&$graces)
{
$categories = array();
foreach ($graces as $grace) {
array_push($categories, $grace->categoryId);
}
if (count($categories)) {
$categories = $this->category_model->findById(implode(',', $categories))->result();
foreach ($graces as $k => $g) {
foreach ($categories as $c) {
if ($g->categoryId == $c->idx) {
$graces[$k]->categoryName = $c->category_name;
}
}
}
}
}
private function getContentImages()
{
preg_match_all('/(..\/..\/..\/uploads\/[a-z0-9A-Z._]+)/',
$this->input->post('content'), $matches);
$contentImages = array(array(), array());
foreach ($matches[0] as $match) {
$contentImages[0][] = $match;
$contentImages[1][] = FCPATH . 'uploads' . DIRECTORY_SEPARATOR . basename($match);
}
return $contentImages;
}
private function uploadContentImage($insertId = 0)
{
if (!$insertId) {
return null;
}
$contentImages = $this->getContentImages();
if ($this->input->post('contentId')) {
$contentUploadedImages = $this->db->where('content_idx', $this->input->post('contentId'))->get('cm_content_image')->result();
if (count($contentUploadedImages)) {
foreach ($contentUploadedImages as $img) {
$this->awsfileuploader->delete($img->url);
}
$this->db->where('content_idx', $this->input->post('contentId'))->delete('cm_content_image');
}
}
foreach ($contentImages[1] as $k => $img) {
$url = '/files/life/' . date('Y/m/') . basename($img);
$this->awsfileuploader->upload($img, 'files/life/' . date('Y/m/') . basename($img));
$this->db->insert('cm_content_image', array(
'content_idx' => $insertId,
'url' => substr($url, 1),
));
}
}
public function write()
{ini_set('display_errors', 1);
if ($this->input->post('title')) {
$categoryId = $this->input->post('category');
$editorId = $this->input->post('editor');
$title = str_replace('"', '\"', addslashes(convertEmoji($this->input->post('title'), 'ENCODE')));
$mainImg = $this->input->post('main_img');
$contentImages = $this->getContentImages();
$content = $this->input->post('content');
if(isset($contentImages[1]) && count($contentImages[1])) {
foreach ($contentImages[1] as $k => $img) {
$url = '/files/life/' . date('Y/m/') . basename($img);
$content = str_replace($contentImages[0][$k], $url, $content);
}
}
$content = str_replace('"', '\"', addslashes(convertEmoji($content, 'ENCODE')));
$isDisplay = $this->input->post('is_display');
$isDisplay = $isDisplay == 'R' ? 'N' : $isDisplay;
$displayTime = $this->input->post('display_time');
$now = date('Y-m-d H:i:s');
if (isset($_FILES['uploadfile']) && is_uploaded_file($_FILES['uploadfile']['tmp_name'])) {
$upload = $this->post->upload('uploadfile');
$filePath = FCPATH . 'uploads/' . explode('uploads/', $upload['full_path'])[1];
$keyPath = 'files/life/' . date('Y/m/') . basename($filePath);
$mainImg = $this->awsfileuploader->upload($filePath, $keyPath);
}
if ($this->input->post('contentId')) {
$sql = "UPDATE life
SET
category_idx = $categoryId,
partner_idx = $editorId,
title = '$title',
main_img = '$mainImg',
content = '$content',
update_date = '$now',
display_date = '$displayTime',
is_display = '$isDisplay'
WHERE
idx = " . $this->input->post('contentId');
} else {
$sql = "insert into
life(category_idx, partner_idx, title, main_img, content, reg_date, display_date, is_display)
values($categoryId, $editorId,'$title', '$mainImg', '$content', '$now', '$displayTime', '$isDisplay')";
}
if ($this->db->query($sql)) {
if(isset($contentImages[1]) && count($contentImages[1])) {
$this->uploadContentImage($this->input->post('contentId') ? $this->input->post('contentId') : $this->db->insert_id());
}
go($this->input->server('HTTP_REFERER'), '등록성공.');
} else {
echo 'error' . $this->db->last_query();
}
} else if ($this->uri->segment(4)) {
$contentId = $this->uri->segment(4);
$query = $this->db->query("SELECT
`p`.`idx` `editorId`,
`p`.`partner_img` `editorImg`,
`p`.`main_img` `editorMainImg`,
`p`.`partner_name` `editorName`,
`p`.`partner_intro` `editorIntro`,
`l`.`title`,
`l`.`head_title`,
`l`.`sub_title`,
`l`.`content`,
`l`.`category_idx` `categoryId`,
`l`.`idx`,
`l`.`main_img` `mainImg`,
`l`.`hit_count` `views`,
`l`.`like_count` `likes`,
`l`.`comment_count` `comments`,
`l`.*
FROM
`life` `l`
LEFT JOIN
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
WHERE
`l`.`idx` IN ($contentId)");
$post = $query->row();
$data = array(
'post' => $post,
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editors,
);
$this->load->view('adm/contentwrite', $data);
} else {
$data = array(
'lifeCategories' => $this->category_model->getCategories($this->lifeCategories['ids']),
'graceEditors' => $this->editors,
);
$this->load->view('adm/contentwrite', $data);
}
}
public function delete()
{
$this->db->where_in('idx', explode('-', $this->input->get('list')))->update('life', array('is_del' => 'Y', 'is_display' => 'N'));
go($this->input->server('HTTP_REFERER'), '삭제되었습니다.');
}
public function display()
{
$this->db->where('idx', $this->input->post('postid'))->update('life', array('is_display' => $this->input->post('is_display'), 'is_del' => 'N'));
}
public function reserve()
{
$configType = 'dptime';
$this->load->model('config_model');
if ($this->input->post('title')) {
$this->load->model('life_model');
$this->db->where('idx', $this->input->post('postid'))->update($this->life_model->table, array('is_display' => 'N', 'display_date' => $this->input->post('dptime')));
$config = $this->config_model->findByTypeAndPostId($configType, $this->input->post)->get()->row();
if ($config) {
if ($this->db->where('Id', $config->Id)->update($this->config_model->table, array(
'PostId' => $this->input->post('postid'),
'Type' => $configType,
'DpTime' => $this->input->post('dptime'),
))) {
go($this->input->post('redirect'), '예약설정 변경성공');
} else {
go($this->input->post('redirect'), '예약설정 실패');
}
} else {
if ($this->db->insert($this->config_model->table, array(
'PostId' => $this->input->post('postid'),
'Type' => $configType,
'DpTime' => $this->input->post('dptime'),
))) {
go($this->input->post('redirect'), '예약설정 등록성공');
} else {
go($this->input->post('redirect'), '예약설정 실패');
}
}
} else {
$contentId = $this->input->get('list');
$query = $this->db->query("SELECT
`l`.*
FROM
`life` `l`
WHERE
`l`.`idx` IN ($contentId)");
$post = $query->row();
$post->reserve_time = date('Y-m-d H:i:s', time() + 3600 * 24);
if ($config = $this->config_model->findByTypeAndPostId($configType, $contentId)->get()->row()) {
$post->reserve_time = $config->DpTime;
}
$data = array(
'post' => $post,
);
$this->load->view('adm/reserve', $data);
}
}
public function config()
{
$this->load->model('config_model');
if ($this->input->method() == 'post') {
if ($this->param('id')) {
$config = $this->config_model->findByTypeAndNameAndPageAndOrderNum($this->param('type'),
$this->param('name'), $this->param('page'), $this->param('order'))->get();
if ($config->num_rows() && $config->row()->Id != $this->param('id')) {
$this->response(null, 401, '삭제먼저');
} else if ($this->db->where('Id', $this->param('id'))->update($this->config_model->table, array(
'PostId' => $this->param('postid'),
'Type' => $this->param('type'),
'Name' => $this->param('name'),
'Page' => $this->param('page'),
'OrderNum' => $this->param('order'),
'Headline' => $this->param('headline'),
'Title' => $this->param('title'),
'Thumbnail' => $this->param('thumbnail'),
))) {
$this->response(array('inserted' => $this->db->insert_id()));
} else {
$this->response(null, 402, 'failed to svae');
}
} else if ($this->config_model->findByTypeAndNameAndPageAndOrderNum($this->param('type'), $this->param('name'),
$this->param('page'), $this->param('order'))->count_all_results()) {
$this->response(null, 401, '삭제먼저');
} else {
if ($this->db->insert($this->config_model->table, array(
'PostId' => $this->param('postid'),
'Type' => $this->param('type'),
'Name' => $this->param('name'),
'Page' => $this->param('page'),
'OrderNum' => $this->param('order'),
'Headline' => $this->param('headline'),
'Title' => $this->param('title'),
'Thumbnail' => $this->param('thumbnail'),
))) {
$this->response(array('inserted' => $this->db->insert_id()));
} else {
$this->response(null, 402, 'failed to svae');
}
}
} else if ($this->input->method() == 'delete') {
$this->db->where('Id', $this->param('id'))->delete($this->config_model->table);
if ($this->db->affected_rows()) {
$this->response(null, 200, '삭제성공');
} else {
$this->response(null, 401, '삭제실패');
}
} else {
if ($configQuery = $this->config_model->findByTypeAndNameAndPage($this->param('type'), $this->param('name'), $this->param('page'))->order_by('OrderNum')->get()->result()) {
$this->response($configQuery);
} else {
$this->response(array(), 200);
}
}
}
/////////////////// category lsit /////////////////////
public function category()
{
$table = $this->tableCategory();
// print_r($table['rows']);die;
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__) . '/category';
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
foreach ($table['rows'] as $k => $v) {
$table['rows'][$k]->category_fullpath = array('<a href="/adm/content/categoryedit/' . $v->idx . '">' . $v->category_name . '</a>');
foreach ($this->categoryall as $c) {
if ($v->parent == $c->idx) {
$table['rows'][$k]->category_fullpath[] = '<a href="/adm/content/categoryedit/' . $c->idx . '">' . $c->category_name . '</a>';
}
}
$table['rows'][$k]->category_fullpath = implode(' > ', array_reverse($table['rows'][$k]->category_fullpath));
}
$data = array(
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/contentcategory', $data);
}
public function tableCategory()
{
$graces = $this->getTableCategoryRows();
$graceTotalCount = $this->getTableCategoryCount();
return array('total' => $graceTotalCount, 'rows' => $graces);
}
private function getTableCategoryCount()
{
$this->tableCategoryClause();
$this->category_model->findAll();
$cnt = $this->db->count_all_results();
$this->category_model->findAll();
$query = $this->db->get();
$this->categoryall = $query->result();
return $cnt;
}
private function tableCategoryClause()
{
if ($this->param('term')) {
$this->db->like('l.category_name', $this->param('term'));
}
$this->db->where('l.is_del', 'N');
}
private function getTableCategoryRows()
{
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'parent');
$this->tableCategoryClause();
$this->category_model->findAll()
->order_by('l.parent desc, reg_date desc')
->limit($this->param('limit'))
->offset($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0));
$graces = $this->db->get()->result();
return $graces;
}
public function categoryedit()
{
if ($this->input->post('idx')) {
$data = array('parent' => $this->input->post('parent'), 'category_name' => $this->input->post('category_name'), 'update_date' => date('Y-m-d H:i:s'), 'description' => $this->input->post('description'));
$this->db->where('idx', $this->input->post('idx'))->update('category', $data);
go($this->input->post('redirect'), 'Success');
} else if ($this->input->post('category_name')) {
$data = array('parent' => $this->input->post('parent'), 'category_name' => $this->input->post('category_name'), 'reg_date' => date('Y-m-d H:i:s'), 'description' => $this->input->post('description'));
$this->db->insert('category', $data);
go($this->input->post('redirect'), 'Success');
} else {
$category = null;
if ($this->uri->segment(4)) {
$category = $this->category_model->findById($this->uri->segment(4))->row();
}
$data = array(
'lifeCategories' => $this->lifeCategories['result'],
'category' => $category,
);
$this->load->view('adm/contentcategoryedit', $data);
}
}
public function categorydelete()
{
if ($this->input->get('list')) {
$this->db->where_in('idx', explode('-', $this->input->get('list')))->update('category', array('is_del' => 'Y'));
go($this->input->server('HTTP_REFERER'), 'Success');
}
}
}

View File

@@ -0,0 +1,288 @@
<?php
class Dataman extends MY_Controller
{
private $parentCategoryName = 'grace-category';
private $lifeCategories = array('ids' => array());
public function __construct()
{
parent::__construct();
$this->load->library('pagination');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('member_model');
$this->lifeCategories['result'] = $this->category_model->findById()->result();
foreach ($this->lifeCategories['result'] as $c) {
array_push($this->lifeCategories['ids'], $c->idx);
}
}
public function ytchannel()
{
$table = $this->table();
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__) . '/ytchannel';
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
$data = array(
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/ytchannel', $data);
}
private function getTableRows()
{
// $sort = $this->param('sort');
// $sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
// $this->tableClause();
// $this->member_model->findAll()
// ->order_by('l.' . $sortColumns['reg_date'], $this->param('order'))
// ->limit($this->param('limit'))
// ->offset($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0));
// $graces = $this->db->get()->result();
$sql = "SELECT yt.*, l.sync_date, l.contentCount FROM cm_ytchannel yt inner join (select count(idx) contentCount, max(reg_date) sync_date, category_idx, partner_idx from life l group by category_idx, partner_idx) as l on yt.CategoryId = l.category_idx and yt.editorId = l.partner_idx limit " . ($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0)) . ", " . $this->param('limit');
return $this->db->query($sql)->result();
}
private function getTableCount()
{
// $this->tableClause();
// $this->member_model->findAll();
// return $this->db->count_all_results();
$sql = "SELECT count(*) cnt FROM cm_ytchannel";
return $this->db->query($sql)->row()->cnt;
}
private function tableClause()
{
if ($this->param('term')) {
$this->db->like('l.member_name', $this->param('term'));
}
$this->db->where('l.member_status !=', 2);
}
public function table()
{
$graces = $this->getTableRows();
$graceTotalCount = $this->getTableCount();
return array('total' => $graceTotalCount, 'rows' => $graces);
}
public function reg()
{
if ($this->input->post('title')) {
$categoryId = $this->input->post('category');
$editorId = $this->input->post('editor');
$title = str_replace('"', '\"', addslashes($this->input->post('title')));
$mainImg = $this->input->post('main_img');
$content = str_replace('"', '\"', addslashes($this->input->post('content')));
$now = date('Y-m-d H:i:s');
if (isset($_FILES['uploadfile']) && is_uploaded_file($_FILES['uploadfile']['tmp_name'])) {
$upload = $this->post->upload('uploadfile');
$this->load->library('awsfileuploader');
$mainImg = $this->awsfileuploader->upload('uploads/' . explode('uploads/', $upload['full_path'])[1]);
}
if ($this->input->post('contentId')) {
$sql = "UPDATE life
SET
is_display = 'N',
category_idx = $categoryId,
partner_idx = $editorId,
title = '$title',
main_img = '$mainImg',
content = '$content',
update_date = '$now'
WHERE
idx = " . $this->input->post('contentId');
} else {
$sql = "insert into
life(is_display, category_idx, partner_idx, title, main_img, content, reg_date)
values('N', $categoryId, $editorId,'$title', '$mainImg', '$content', '$now')";
}
if ($this->db->query($sql)) {
header('location:' . $this->input->server('HTTP_REFERER'));
} else {
echo 'error' . $this->db->last_query();
}
} else if ($this->uri->segment(4)) {
$contentId = $this->uri->segment(4);
$query = $this->db->query("SELECT
`p`.`idx` `editorId`,
`p`.`partner_img` `editorImg`,
`p`.`main_img` `editorMainImg`,
`p`.`partner_name` `editorName`,
`p`.`partner_intro` `editorIntro`,
`l`.`title`,
`l`.`head_title`,
`l`.`sub_title`,
`l`.`content`,
`l`.`category_idx` `categoryId`,
`l`.`idx`,
`l`.`main_img` `mainImg`,
`l`.`hit_count` `views`,
`l`.`like_count` `likes`,
`l`.`comment_count` `comments`,
`l`.*
FROM
`life` `l`
LEFT JOIN
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
WHERE
`l`.`idx` IN ($contentId)");
$post = $query->row();
$data = array(
'post' => $post,
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result(),
);
$this->load->view('adm/content_write', $data);
} else {
$data = array(
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result(),
);
$this->load->view('adm/content_write', $data);
}
}
public function delete()
{
go($this->input->server('HTTP_REFERER'), '삭제되었습니다.');
}
public function display()
{
$this->db->where('idx', $this->input->post('postid'))->update('life', array('is_display' => $this->input->post('is_display')));
}
public function podbbang()
{
$table = $this->tablePodbbang();
// print_r($table['rows']);die;
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__) . '/podbbang';
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
$data = array(
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/podbbang', $data);
}
public function tablePodbbang()
{
$graces = $this->gettablePodbbangRows();
$graceTotalCount = $this->gettablePodbbangCount();
return array('total' => $graceTotalCount, 'rows' => $graces);
}
private function tablePodbbangClause()
{
if ($this->param('term')) {
$this->db->like('l.partner_name', $this->param('term'));
}
}
private function gettablePodbbangRows()
{
// $sort = $this->param('sort');
// $sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
// $this->tablePodbbangClause();
// $this->editor_model->findAll()
// ->order_by('l.' . $sortColumns['reg_date'], $this->param('order'))
// ->limit($this->param('limit'))
// ->offset($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0));
// $graces = $this->db->get()->result();
$sql = "SELECT * FROM cm_station limit " . ($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0)) . ", " . $this->param('limit');
return $this->db->query($sql)->result();
}
private function gettablePodbbangCount()
{
// $this->tablePodbbangClause();
// $this->editor_model->findAll();
// return $this->db->count_all_results();
$sql = "SELECT count(*) cnt FROM cm_station";
return $this->db->query($sql)->row()->cnt;
}
public function church()
{
$table = $this->tableChurch();
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__) . '/church';
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
$data = array(
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/church', $data);
}
private function getTableChurchRows()
{
// $sort = $this->param('sort');
// $sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
// $this->tableClause();
// $this->member_model->findAll()
// ->order_by('l.' . $sortColumns['reg_date'], $this->param('order'))
// ->limit($this->param('limit'))
// ->offset($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0));
// $graces = $this->db->get()->result();
$sql = "SELECT * FROM cm_naver_place limit " . ($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0)) . ", " . $this->param('limit');
return $this->db->query($sql)->result();
}
private function getTableChurchCount()
{
// $this->tableClause();
// $this->member_model->findAll();
// return $this->db->count_all_results();
$sql = "SELECT count(*) cnt FROM cm_naver_place";
return $this->db->query($sql)->row()->cnt;
}
private function tableChurchClause()
{
if ($this->param('term')) {
$this->db->like('l.member_name', $this->param('term'));
}
$this->db->where('l.member_status !=', 2);
}
public function tableChurch()
{
$graces = $this->getTableChurchRows();
$graceTotalCount = $this->getTableChurchCount();
return array('total' => $graceTotalCount, 'rows' => $graces);
}
}

View File

@@ -0,0 +1,400 @@
<?php
class Member extends MY_Controller
{
private $parentCategoryName = 'grace-category';
private $lifeCategories = array('ids' => array());
public function __construct()
{
parent::__construct();
$this->load->library('pagination');
$this->load->library('post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('member_model');
$this->load->model('life_model');
$this->load->model('comment_model');
$this->load->library('awsfileuploader');
$this->lifeCategories['result'] = $this->category_model->findById()->result();
foreach ($this->lifeCategories['result'] as $c) {
array_push($this->lifeCategories['ids'], $c->idx);
}
}
public function index()
{
$table = $this->table();
// print_r($table['rows']);die;
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__);
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
$data = array(
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/member', $data);
}
public function active()
{
$this->db->where('idx', $this->input->post('postid'))->update('member', array('member_status' => $this->input->post('is_display')));
}
public function editor()
{
$table = $this->tableEditor();
// print_r($table['rows']);die;
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__) . '/editor';
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
$data = array(
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/editor', $data);
}
public function editoredit()
{
if ($this->input->post('partner_name')) {
$mainImg = $this->input->post('main_img');
$partner_img = $this->input->post('partner_img');
$is_del = $this->input->post('is_del');
$partner_id = $this->input->post('partner_id');
$partner_real_name = $this->input->post('partner_real_name');
$partner_name = $this->input->post('partner_name');
$partner_intro = $this->input->post('partner_intro');
$partner_homepage = $this->input->post('partner_homepage');
if (isset($_FILES['uploadfile']) && is_uploaded_file($_FILES['uploadfile']['tmp_name'])) {
if ($mainImg) {
$this->awsfileuploader->upload(substr($mainImg, 1));
}
$upload = $this->post->upload('uploadfile');
$filePath = FCPATH . 'uploads/' . explode('uploads/', $upload['full_path'])[1];
$keyPath = 'files/life/' . date('Y/m/') . basename($filePath);
$mainImg = $this->awsfileuploader->upload($filePath, $keyPath);
}
if (isset($_FILES['uploadfile2']) && is_uploaded_file($_FILES['uploadfile2']['tmp_name'])) {
if ($partner_img) {
$this->awsfileuploader->upload(substr($partner_img, 1));
}
$upload = $this->post->upload('uploadfile2');
$filePath = FCPATH . 'uploads/' . explode('uploads/', $upload['full_path'])[1];
$keyPath = 'files/life/' . date('Y/m/') . basename($filePath);
$partner_img = $this->awsfileuploader->upload($filePath, $keyPath);
}
$now = date('Y-m-d H:i:s');
if ($this->input->post('contentId')) {
$sql = "UPDATE partner
SET
partner_real_name = '$partner_real_name',
partner_id = '$partner_id',
partner_name = '$partner_name',
main_img = '$mainImg',
partner_img = '$partner_img',
update_date = '$now',
is_del = '$is_del',
partner_intro='$partner_intro',
partner_homepage='$partner_homepage'
WHERE
idx = " . $this->input->post('contentId');
} else {
$sql = "insert into
partner(partner_id, partner_name, partner_real_name, main_img, partner_img, reg_date, is_del,partner_intro,partner_homepage)
values('$partner_id', '$partner_name','$partner_real_name', '$mainImg', '$partner_img', '$now', '$is_del', '$partner_intro','$partner_homepage')";
}
if ($this->db->query($sql)) {
go($this->input->server('HTTP_REFERER'), '등록성공.');
} else {
echo 'error' . $this->db->last_query();
}
} else if ($this->uri->segment(4)) {
$this->load->view('adm/membereditoredit', array('post' => $this->db->where('idx', $this->uri->segment(4))->get('partner')->row()));
} else {
$this->load->view('adm/membereditoredit');
}
}
public function editordelete()
{
$this->db->where_in('idx', explode('-', $this->input->get('list')))->update('partner', array('is_del' => 'Y'));
go($this->input->server('HTTP_REFERER'), '삭제되었습니다.');
}
public function editoractive()
{
$this->db->where('idx', $this->input->post('postid'))->update('partner', array('is_del' => $this->input->post('is_display')));
}
public function comment()
{
$table = $this->tableComment();
// print_r($table['rows']);die;
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__) . '/comment';
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
$data = array(
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result(),
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/comment', $data);
}
private function tableCommentClause()
{
if ($this->param('term')) {
$this->db->like('l.title', $this->param('term'));
}
if ($this->param('category')) {
$this->db->like('l.category_idx', $this->param('category'));
}
if ($this->param('editor')) {
$this->db->like('l.partner_idx', $this->param('editor'));
}
$this->db->where('l.is_display !=', null);
}
private function getTableCommentRows()
{
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->tableCommentClause();
$this->life_model->findByCategoryId($this->lifeCategories['ids'])
->order_by('l.' . $sortColumns['reg_date'], $this->param('order'))
->select('l.display_date, l.is_display, c.comment, c.idx commentId')
->join('comment c', 'c.content_idx=l.idx', 'inner')
->limit($this->param('limit'))
->offset($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0));
$graces = $this->db->get()->result();
foreach ($graces as $k => $g) {
if (strtotime($g->display_date) > time() && $g->is_display == 'N') {
$graces[$k]->isSetDptime = 1;
}
}
return $graces;
}
private function getTableCommentCount()
{
$this->tableCommentClause();
$this->life_model->findByCategoryId($this->lifeCategories['ids'])->join('comment c', 'c.content_idx=l.idx', 'inner');
return $this->db->count_all_results();
}
public function tableComment()
{
$graces = $this->getTableCommentRows();
$graceTotalCount = $this->getTableCommentCount();
$this->addCategoryNameToTableResponse($graces);
return array('total' => $graceTotalCount, 'rows' => $graces);
}
private function addCategoryNameToTableResponse(&$graces)
{
$categories = array();
foreach ($graces as $grace) {
array_push($categories, $grace->categoryId);
}
if (count($categories)) {
$categories = $this->category_model->findById(implode(',', $categories))->result();
foreach ($graces as $k => $g) {
foreach ($categories as $c) {
if ($g->categoryId == $c->idx) {
$graces[$k]->categoryName = $c->category_name;
}
}
}
}
}
private function tableClause()
{
if ($this->param('term')) {
$this->db->like('l.member_name', $this->param('term'));
$this->db->or_like('l.member_id', $this->param('term'));
}
// $this->db->where('l.member_status !=', 2);
}
private function tableEditorClause()
{
if ($this->param('term')) {
$this->db->like('l.partner_name', $this->param('term'));
$this->db->or_like('l.partner_id', $this->param('term'));
}
}
private function getTableRows()
{
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->tableClause();
$this->member_model->findAll()
->order_by('l.' . $sortColumns['reg_date'], $this->param('order'))
->limit($this->param('limit'))
->offset($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0));
$graces = $this->db->get()->result();
return $graces;
}
private function getTableEditorRows()
{
$sort = $this->param('sort');
$sortColumns = array('comments' => 'comment_count', 'reg_date' => 'reg_date');
$this->tableEditorClause();
$this->editor_model->findAll()
->order_by('l.' . $sortColumns['reg_date'], $this->param('order'))
->limit($this->param('limit'))
->offset($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0));
$graces = $this->db->get()->result();
return $graces;
}
private function getTableCount()
{
$this->tableClause();
$this->member_model->findAll();
return $this->db->count_all_results();
}
private function getTableEditorCount()
{
$this->tableEditorClause();
$this->editor_model->findAll();
return $this->db->count_all_results();
}
public function table()
{
$graces = $this->getTableRows();
$graceTotalCount = $this->getTableCount();
return array('total' => $graceTotalCount, 'rows' => $graces);
}
public function tableEditor()
{
$graces = $this->getTableEditorRows();
$graceTotalCount = $this->getTableEditorCount();
return array('total' => $graceTotalCount, 'rows' => $graces);
}
public function reg()
{
if ($this->input->post('title')) {
$categoryId = $this->input->post('category');
$editorId = $this->input->post('editor');
$title = str_replace('"', '\"', addslashes($this->input->post('title')));
$mainImg = $this->input->post('main_img');
$content = str_replace('"', '\"', addslashes($this->input->post('content')));
$now = date('Y-m-d H:i:s');
if (isset($_FILES['uploadfile']) && is_uploaded_file($_FILES['uploadfile']['tmp_name'])) {
$upload = $this->post->upload('uploadfile');
$this->load->library('awsfileuploader');
$mainImg = $this->awsfileuploader->upload('uploads/' . explode('uploads/', $upload['full_path'])[1]);
}
if ($this->input->post('contentId')) {
$sql = "UPDATE life
SET
is_display = 'N',
category_idx = $categoryId,
partner_idx = $editorId,
title = '$title',
main_img = '$mainImg',
content = '$content',
update_date = '$now'
WHERE
idx = " . $this->input->post('contentId');
} else {
$sql = "insert into
life(is_display, category_idx, partner_idx, title, main_img, content, reg_date)
values('N', $categoryId, $editorId,'$title', '$mainImg', '$content', '$now')";
}
if ($this->db->query($sql)) {
header('location:' . $this->input->server('HTTP_REFERER'));
} else {
echo 'error' . $this->db->last_query();
}
} else if ($this->uri->segment(4)) {
$contentId = $this->uri->segment(4);
$query = $this->db->query("SELECT
`p`.`idx` `editorId`,
`p`.`partner_img` `editorImg`,
`p`.`main_img` `editorMainImg`,
`p`.`partner_name` `editorName`,
`p`.`partner_intro` `editorIntro`,
`l`.`title`,
`l`.`head_title`,
`l`.`sub_title`,
`l`.`content`,
`l`.`category_idx` `categoryId`,
`l`.`idx`,
`l`.`main_img` `mainImg`,
`l`.`hit_count` `views`,
`l`.`like_count` `likes`,
`l`.`comment_count` `comments`,
`l`.*
FROM
`life` `l`
LEFT JOIN
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
WHERE
`l`.`idx` IN ($contentId)");
$post = $query->row();
$data = array(
'post' => $post,
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result(),
);
$this->load->view('adm/content_write', $data);
} else {
$data = array(
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result(),
);
$this->load->view('adm/content_write', $data);
}
}
public function delete()
{
go($this->input->server('HTTP_REFERER'), '삭제되었습니다.');
}
public function display()
{
$this->db->where('idx', $this->input->post('postid'))->update('life', array('is_display' => $this->input->post('is_display')));
}
}

View File

@@ -0,0 +1,235 @@
<?php
class News extends MY_Controller
{
private $parentCategoryName = 'grace-category';
private $lifeCategories = array('ids' => array());
public function __construct()
{
parent::__construct();
$this->load->library('pagination');
$this->load->library('post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('life_model');
$this->lifeCategories['result'] = $this->category_model->findById()->result();
foreach ($this->lifeCategories['result'] as $c) {
array_push($this->lifeCategories['ids'], $c->idx);
}
}
public function index()
{
$table = $this->table();
// print_r($table['rows']);die;
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__);
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
if ($this->input->get('pageset')) {
foreach ($table['rows'] as $k => $r) {
$table['rows'][$k]->title = html_entity_decode(convertEmoji($table['rows'][$k]->title));
$table['rows'][$k]->main_img = imgSrc($table['rows'][$k]->main_img);
}
$this->response($table);
} else {
$data = array(
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result(),
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/news', $data);
}
}
private function gettableRows()
{
$sql = "SELECT * FROM news where reg_date > '2019-12-01'";
$sql .= $this->param('category') ? ' and category_code = '. $this->param('category') : '';
$sql .= $this->param('term') ? ' and title like \'%'. $this->param('term'). '%\'' : '';
$sql .= " order by reg_date desc limit " . ($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0)) . ", " . $this->param('limit');
return $this->db->query($sql)->result();
}
private function getTableCount()
{
$sql = "SELECT count(*) cnt FROM news where reg_date > '2019-12-01'";
$sql .= $this->param('category') ? ' and category_code = '. $this->param('category') : '';
$sql .= $this->param('term') ? ' and title like \'%'. $this->param('term'). '%\'' : '';
return $this->db->query($sql)->row()->cnt;
}
public function table()
{
$graces = $this->getTableRows();
$graceTotalCount = $this->getTableCount();
return array('total' => $graceTotalCount, 'rows' => $graces);
}
public function display()
{
$this->db->where('idx', $this->input->post('postid'))->update('news', array('is_display' => $this->input->post('is_display'), 'is_del' => 'N'));
}
public function delete()
{
$this->db->where_in('idx', explode('-', $this->input->get('list')))->update('news', array('is_del' => 'Y', 'is_display' => 'N'));
go($this->input->server('HTTP_REFERER'), '삭제되었습니다.');
}
public function company()
{
$table = $this->tableCompany();
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__) . '/company';
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
$data = array(
'lifeCategories' => $this->lifeCategories['result'],
'graceEditors' => $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result(),
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/newscompany', $data);
}
private function getTableCompanyRows()
{
$sql = "SELECT * FROM press order by reg_date desc limit " . ($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0)) . ", " . $this->param('limit');
return $this->db->query($sql)->result();
}
private function gettableCompanyCount()
{
$sql = "SELECT count(*) cnt FROM press";
return $this->db->query($sql)->row()->cnt;
}
public function tableCompany()
{
$graces = $this->getTableCompanyRows();
$graceTotalCount = $this->getTableCompanyCount();
return array('total' => $graceTotalCount, 'rows' => $graces);
}
/////////////////// category lsit /////////////////////
public function category()
{
$table = $this->tableCategory();
// print_r($table['rows']);die;
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$config['base_url'] = '/adm/' . strtolower(__CLASS__) . '/category';
$config['total_rows'] = $table['total'];
$config['per_page'] = $this->param('limit');
$this->pagination->initialize($config);
foreach ($table['rows'] as $k => $v) {
$table['rows'][$k]->category_fullpath = array('<a href="/adm/news/categoryedit/' . $v->idx . '">' . $v->category_name . '</a>');
foreach ($this->categoryall as $c) {
if ($v->p_category_code == $c->category_code && $v->category_code != $c->category_code) {
$table['rows'][$k]->category_fullpath[] = '<a href="/adm/news/categoryedit/' . $c->idx . '">' . $c->category_name . '</a>';
}
}
$table['rows'][$k]->category_fullpath = implode(' > ', array_reverse($table['rows'][$k]->category_fullpath));
}
$data = array(
'paging' => $this->pagination->create_links(),
'table' => $table,
'page' => $page,
);
$this->load->view('adm/newscategory', $data);
}
public function tableCategory()
{
$graces = $this->getTableCategoryRows();
$graceTotalCount = $this->getTableCategoryCount();
return array('total' => $graceTotalCount, 'rows' => $graces);
}
private function getTableCategoryCount()
{
$this->tableCategoryClause();
$this->db->from('news_section l');
$cnt = $this->db->count_all_results();
$this->db->from('news_section l');
$query = $this->db->where('l.is_del', 'N')->get();
$this->categoryall = $query->result();
return $cnt;
}
private function tableCategoryClause()
{
if ($this->param('term')) {
$this->db->like('l.category_name', $this->param('term'));
}
$this->db->where('l.is_del', 'N');
}
private function getTableCategoryRows()
{
$this->tableCategoryClause();
$this->db->from('news_section l')
->order_by('l.category_code')
->limit($this->param('limit'))
->offset($this->param('limit') * ($this->param('page') ? $this->param('page') - 1 : 0));
$graces = $this->db->get()->result();
return $graces;
}
public function categoryedit()
{
if ($this->input->post('idx')) {
$data = array('p_category_code' => $this->input->post('parent'), 'category_code' => $this->input->post('parent').$this->input->post('idx'), 'category_name' => $this->input->post('category_name'));
$this->db->where('idx', $this->input->post('idx'))->update('news_section', $data);
go($this->input->post('redirect'), 'Success');
} else if ($this->input->post('category_name')) {
$data = array('p_category_code' => $this->input->post('parent'), 'category_name' => $this->input->post('category_name'));
$this->db->insert('news_section', $data);
$insertid = $this->db->insert_id();
$data = array('category_code' => $this->input->post('parent').$insertid);
$this->db->where('idx', $insertid)->update('news_section', $data);
go($this->input->post('redirect'), 'Success');
} else {
$category = null;
if ($this->uri->segment(4)) {
$category = $this->db->where('idx', $this->uri->segment(4))->get('news_section')->row();
}
$data = array(
'newsCategories' => $this->db->where('is_del', 'N')->where('idx !=', $category ? $category->idx : 0)->get('news_section')->result(),
'category' => $category,
);
$this->load->view('adm/newscategoryedit', $data);
}
}
public function categorydelete()
{
if ($this->input->get('list')) {
$this->db->where_in('idx', explode('-', $this->input->get('list')))->update('news_section', array('is_del' => 'Y'));
go($this->input->server('HTTP_REFERER'), 'Success');
}
}
}

View File

@@ -0,0 +1,198 @@
<?php
class Setcmtv extends MY_Controller
{
private $parentCategoryName = 'grace-category';
private $lifeCategories = array('ids' => array());
public function __construct()
{
parent::__construct();
$this->load->library('pagination');
$this->load->library('post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('life_model');
$this->lifeCategories['result'] = $this->category_model->findByParentId(36)->result();
foreach ($this->lifeCategories['result'] as $c) {
array_push($this->lifeCategories['ids'], $c->idx);
}
}
public function index()
{
}
public function homehot()
{
$configType = 'cmtv';
$configPage = 'cmtvhomehot';
$this->load->model('config_model');
if ($this->input->post('title')) {
$this->db->where('Page', $configPage)->delete('cm_config');
foreach ($this->input->post('title') as $k => $title) {
$this->db->insert($this->config_model->table, array(
'PostId' => $this->input->post('postid')[$k],
'Type' => $configType,
'Page' => $configPage,
'OrderNum' => $this->input->post('display_sort')[$k],
));
}
go($this->input->post('redirect'), 'Success');
} else {
$config = $this->config_model->findByTypeAndPage($configType, $configPage)->order_by('OrderNum')->get()->result();
$data = array($configPage => null, 'posts' => array(null));
if ($config) {
$postIds = array();
foreach ($config as $c) {
$postIds[] = $c->PostId;
}
$postIds = implode(',', $postIds);
$query = $this->db->query("SELECT
`l`.*
FROM
`life` `l`
WHERE
`l`.`idx` IN ($postIds)");
$post = $query->result();
foreach ($post as $k => $p) {
foreach ($config as $c) {
if ($p->idx == $c->PostId) {
$post[$k]->display_sort = $c->OrderNum;
if (!$c->OrderNum) {
$post[$k]->display_sort = $k + 1;
}
}
}
}
$data = array($configPage => $config, 'posts' => $post);
}
$data['lifeCategories'] = $this->lifeCategories['result'];
$data['graceEditors'] = $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result();
$this->load->view('adm/pageset/cmtv/homehot', $data);
}
}
public function categorylatest($categoryNo = 40)
{
$configType = 'cmtv';
$configPage = 'categorylatest';
$this->load->model('config_model');
if ($this->input->post('title')) {
$this->db->where('Page', $configPage)->where('CategoryId', $categoryNo)->delete('cm_config');
foreach ($this->input->post('title') as $k => $title) {
$this->db->insert($this->config_model->table, array(
'PostId' => $this->input->post('postid')[$k],
'Type' => $configType,
'Page' => $configPage,
'CategoryId' => $categoryNo,
'OrderNum' => $this->input->post('display_sort')[$k],
));
}
go($this->input->post('redirect'), 'Success');
} else {
$config = $this->config_model->findByTypeAndPage($configType, $configPage)
->where('CategoryId', $categoryNo)->order_by('OrderNum')->get()->result();
$data = array($configPage => null, 'posts' => array(null));
if ($config) {
$postIds = array();
foreach ($config as $c) {
$postIds[] = $c->PostId;
}
$postIds = implode(',', $postIds);
$query = $this->db->query("SELECT
`l`.*
FROM
`life` `l`
WHERE
`l`.`idx` IN ($postIds)");
$post = $query->result();
foreach ($post as $k => $p) {
foreach ($config as $c) {
if ($p->idx == $c->PostId) {
$post[$k]->display_sort = $c->OrderNum;
if (!$c->OrderNum) {
$post[$k]->display_sort = $k + 1;
}
}
}
}
$data = array($configPage => $config, 'posts' => $post);
}
$data['lifeCategories'] = $this->lifeCategories['result'];
$data['categoryNo'] = $categoryNo;
$data['graceEditors'] = $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result();
$this->load->view('adm/pageset/cmtv/categorylatest', $data);
}
}
public function channellatest($categoryNo = 80) {
$configType = 'cmtv';
$configPage = 'channellatest';
$this->load->model('config_model');
if ($this->input->post('title')) {
$this->db->where('Page', $configPage)->where('CategoryId', $categoryNo)->delete('cm_config');
foreach ($this->input->post('title') as $k => $title) {
$this->db->insert($this->config_model->table, array(
'PostId' => $this->input->post('postid')[$k],
'Type' => $configType,
'Page' => $configPage,
'CategoryId' => $categoryNo,
'OrderNum' => $this->input->post('display_sort')[$k],
));
}
go($this->input->post('redirect'), 'Success');
} else {
$config = $this->config_model->findByTypeAndPage($configType, $configPage)
->where('CategoryId', $categoryNo)->order_by('OrderNum')->get()->result();
$data = array($configPage => null, 'posts' => array(null));
if ($config) {
$postIds = array();
foreach ($config as $c) {
$postIds[] = $c->PostId;
}
$postIds = implode(',', $postIds);
$query = $this->db->query("SELECT
`l`.*
FROM
`life` `l`
WHERE
`l`.`idx` IN ($postIds)");
$post = $query->result();
foreach ($post as $k => $p) {
foreach ($config as $c) {
if ($p->idx == $c->PostId) {
$post[$k]->display_sort = $c->OrderNum;
if (!$c->OrderNum) {
$post[$k]->display_sort = $k + 1;
}
}
}
}
$data = array($configPage => $config, 'posts' => $post);
}
$data['lifeCategories'] = $this->lifeCategories['result'];
$data['categoryNo'] = $categoryNo;
$data['graceEditors'] = $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result();
$this->load->view('adm/pageset/cmtv/channellatest', $data);
}
}
}

View File

@@ -0,0 +1,104 @@
<?php
class Setgrace extends MY_Controller
{
private $parentCategoryName = 'grace-category';
private $lifeCategories = array('ids' => array());
public function __construct()
{
parent::__construct();
$this->load->library('pagination');
$this->load->library('post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('life_model');
$this->lifeCategories['result'] = $this->category_model->findByParentId(35)->result();
foreach ($this->lifeCategories['result'] as $c) {
array_push($this->lifeCategories['ids'], $c->idx);
}
}
public function index()
{
}
public function hometop()
{
$configType = 'grace';
$configPage = 'gracehometop';
$this->load->model('config_model');
if ($this->input->post('title')) {
$this->db->where('Page', $configPage)->delete('cm_config');
foreach ($this->input->post('title') as $k => $title) {
$this->db->insert($this->config_model->table, array(
'PostId' => $this->input->post('postid')[$k],
'Type' => $configType,
'Page' => $configPage,
'OrderNum' => $this->input->post('display_sort')[$k]
));
}
go($this->input->post('redirect'), 'Success');
} else {
$config = $this->config_model->findByTypeAndPage($configType, $configPage)->order_by('OrderNum')->get()->result();
$data = array($configPage => null, 'posts' => array(null));
if ($config) {
$postIds = array();
foreach($config as $c) {
$postIds[] = $c->PostId;
}
$postIds = implode(',', $postIds);
$query = $this->db->query("SELECT
`l`.*
FROM
`life` `l`
WHERE
`l`.`idx` IN ($postIds)");
$post = $query->result();
foreach($post as $k => $p) {
foreach($config as $c) {
if($p->idx == $c->PostId) {
$post[$k]->display_sort = $c->OrderNum;
if(!$c->OrderNum) $post[$k]->display_sort = $k+1;
}
}
}
$data = array($configPage => $config, 'posts' => $post);
}
$data['lifeCategories'] = $this->lifeCategories['result'];
$data['graceEditors'] = $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result();
$this->load->view('adm/pageset/grace/hometop', $data);
}
}
public function homekeyword()
{
$configType = 'dailyqt';
$configPage = 'home-dailyqt';
$this->load->model('config_model');
$config = $this->config_model->findByTypeAndPage($configType, $configPage)->order_by('OrderNum')->get()->row();
$data = array('dailyqt' => null, 'post' => null);
if($config) {
$query = $this->db->query("SELECT
`l`.*
FROM
`life` `l`
WHERE
`l`.`idx` IN ($config->PostId)");
$post = $query->row();
$data = array('dailyqt' => $config, 'post' => $post);
}
$data['lifeCategories'] = $this->lifeCategories['result'];
$data['graceEditors'] = $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result();
$this->load->view('adm/pageset/grace/homekeyword', $data);
}
}

View File

@@ -0,0 +1,163 @@
<?php
class Setmain extends MY_Controller
{
private $parentCategoryName = 'grace-category';
private $lifeCategories = array('ids' => array());
public function __construct()
{
parent::__construct();
$this->load->library('pagination');
$this->load->library('post');
$this->load->model('category_model');
$this->load->model('editor_model');
$this->load->model('life_model');
$this->lifeCategories['result'] = $this->category_model->findById()->result();
foreach ($this->lifeCategories['result'] as $c) {
array_push($this->lifeCategories['ids'], $c->idx);
}
}
public function index()
{
}
public function homenews()
{
$configType = 'home';
$configPage = 'hometopnews';
$this->load->model('config_model');
if ($this->input->post('title')) {
$this->db->where('Page', $configPage)->delete('cm_config');
foreach ($this->input->post('title') as $k => $title) {
$this->db->insert($this->config_model->table, array(
'PostId' => $this->input->post('postid')[$k],
'Type' => $configType,
'Page' => $configPage,
'OrderNum' => $this->input->post('display_sort')[$k],
));
}
go($this->input->post('redirect'), 'Success');
} else {
$config = $this->config_model->findByTypeAndPage($configType, $configPage)->order_by('OrderNum')->get()->result();
$data = array($configPage => null, 'posts' => array(null));
if ($config) {
$postIds = array();
foreach ($config as $c) {
$postIds[] = $c->PostId;
}
$postIds = implode(',', $postIds);
$query = $this->db->query("SELECT
`l`.*
FROM
`news` `l`
WHERE
`l`.`idx` IN ($postIds)");
$post = $query->result();
foreach ($post as $k => $p) {
foreach ($config as $c) {
if ($p->idx == $c->PostId) {
$post[$k]->display_sort = $c->OrderNum;
if (!$c->OrderNum) {
$post[$k]->display_sort = $k + 1;
}
}
}
}
$data = array($configPage => $config, 'posts' => $post);
}
$data['newsCategories'] = $this->db->where('is_del', 'N')->get('news_section')->result();
$this->load->view('adm/pageset/main/topnews', $data);
}
}
public function dailyqt()
{
$configType = 'home';
$configPage = 'homedailyqt';
$this->load->model('config_model');
if ($this->input->post('title')) {
$this->db->where('Page', $configPage)->delete('cm_config');
foreach ($this->input->post('title') as $k => $title) {
$this->db->insert($this->config_model->table, array(
'PostId' => $this->input->post('postid')[$k],
'Type' => $configType,
'Page' => $configPage,
'DpTime' => $this->input->post('dptime')[$k],
));
}
go($this->input->post('redirect'), 'Success');
} else {
$config = $this->config_model->findByTypeAndPage($configType, $configPage)->order_by('OrderNum')->get()->row();
$data = array('dailyqt' => null, 'posts' => array(null));
if ($config) {
$query = $this->db->query("SELECT
`l`.*, c.DpTime
FROM
`life` `l` inner join cm_config c on l.idx = c.PostId
WHERE c.Type='$configType' and c.Page='$configPage'");
$post = $query->result();
$data = array('dailyqt' => $config, 'posts' => $post);
}
$data['lifeCategories'] = $this->lifeCategories['result'];
$data['graceEditors'] = $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result();
$this->load->view('adm/pageset/main/dailyqt', $data);
}
}
public function todayword()
{
$configType = 'home';
$configPage = 'hometodayword';
$this->load->model('config_model');
if ($this->input->post('title')) {
$this->db->where('Page', $configPage)->delete('cm_config');
foreach ($this->input->post('title') as $k => $title) {
$this->db->insert($this->config_model->table, array(
'PostId' => 0,
'Type' => $configType,
'Page' => $configPage,
'Title' => $this->input->post('title')[$k],
'Headline' => $this->input->post('headline')[$k],
'DpTime' => $this->input->post('dptime')[$k],
));
}
go($this->input->post('redirect'), 'Success');
} else {
$config = $this->config_model->findByTypeAndPage($configType, $configPage)->order_by('OrderNum')->get()->result();
$data = array('posts' => array(null));
if ($config) {
// $ccc = array();
// foreach($config as $c) $ccc[] = $c->PostId;
// $query = $this->db->query("SELECT
// `l`.*
// FROM
// `life` `l`
// WHERE
// `l`.`idx` IN (".implode(',', $ccc).")");
// $post = $query->result();
$data = array('posts' => $config);
}
$data['lifeCategories'] = $this->lifeCategories['result'];
$data['graceEditors'] = $this->editor_model->findByCategoryId($this->lifeCategories['ids'])->get()->result();
$this->load->view('adm/pageset/main/todayword', $data);
}
}
}

View File

@@ -0,0 +1,72 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once (APPPATH.'core/admin/cm_controller.php');
class admin_member extends cm_controller {
#---------------------------------------------------------------------------
# PURPOSE : 관리자 수정
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function fn_member_edit() {
# view
return $this->load->view('/admin/admin_member/member_edit', '', true);
}
#---------------------------------------------------------------------------
# PURPOSE : 관리자 수정 실행
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function fn_member_edit_proc() {
# Request
$org_user_pwd = trim($this->input->get_post('org_user_pwd', TRUE)); // 기존비밀번호
$new_user_pwd = trim($this->input->get_post('new_user_pwd', TRUE)); // 신규비밀번호
# valid Check
if (empty($org_user_pwd) == true) {
gf_alert('이전 비밀번호를 입력해주세요.', '/admin/admin_member/member_edit');
exit;
}
if (empty($new_user_pwd) == true) {
gf_alert('신규 비밀번호를 입력해주세요.', '/admin/admin_member/member_edit');
exit;
}
$req_data['org_user_pwd'] = addslashes($org_user_pwd);
$req_data['new_user_pwd'] = addslashes($new_user_pwd);
# model - 이전 비밀번호 확인
$this->load->model('admin/admin_member/m_admin_member');
$return_data = $this->m_admin_member->member_edit_proc($req_data);
if($return_data == '') {
gf_alert('기존 비밀번호가 다릅니다.', '/admin/admin_member/member_edit');
exit;
}
# model - 신규 비밀번호 업데이트
$this->load->model('admin/admin_member/m_admin_member');
$this->m_admin_member->member_passwd_update($req_data);
gf_alert('수정되었습니다.', '/admin/main');
exit;
}
}
?>

View File

@@ -0,0 +1,316 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once (APPPATH.'core/admin/cm_controller.php');
class advertisement extends cm_controller {
var $ad_page_tb_name = 'ad_page'; // 광고 페이지 테이블 이름
var $ad_code_tb_name = 'ad_detail'; // 광고 코드 테이블 이름
/*
title : 광고 페이지 관리 (목록)
*/
public function fn_1($page=1) {
$this->load->database();
$query = $this->db->get($this->ad_page_tb_name);
$i = 0;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['row'][$i] = $row;
$i++;
}
return $this->load->view('/admin/advertisement/ads', $return_data, true);
}
public function fn_ad_page_arr_del_proc() {
$is_del = $this->input->post('is_del');
foreach($is_del as $v) {
if($v>0) {
$where_in[] = $v;
}
}
if(count($where_in)>0) {
$this->load->database();
$this->db->where_in('idx',$where_in);
$ret = $this->db->delete($this->ad_page_tb_name);
if($ret==TRUE) {
$message = '삭제되었습니다.';
} else {
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
}
echo "<script>alert('".$message."'); parent.location.reload();</script>";
}
exit;
}
public function fn_ad_page_edit() {
$idx = $this->input->get('idx');
if(is_numeric($idx)==TRUE) {
$this->load->database();
$query = $this->db->get_where($this->ad_page_tb_name, array('idx'=>$idx));
$row = $query->row_array();
$row['result'] = 'success';
} else {
$row['result'] = 'fail';
}
echo json_encode($row);
exit;
}
/**
* [ad_page_proc register ad page]
* @return [boolean]
*/
public function fn_ad_page_proc() {
$page_key = $this->input->post('page_key');
$page_name = $this->input->post('page_name');
$ad_pos_key = $this->input->post('ad_pos_key');
$ad_pos_name = $this->input->post('ad_pos_name');
$mode = $this->input->post('mode');
$idx = $this->input->post('idx');
$this->load->library('form_validation');
$this->form_validation->set_rules('page_key','페이지 키',array('required','regex_match[/^[a-zA-Z]+$/]'));
$this->form_validation->set_rules('page_name','페이지 이름',array('required'));
$this->form_validation->set_rules('ad_pos_key','광고 위치 키',array('required','regex_match[/^[a-zA-Z]+$/]'));
$this->form_validation->set_rules('ad_pos_name','광고 위치 이름',array('required'));
if ($this->form_validation->run() == TRUE) {
$this->load->database();
$data = ['page_key'=>$page_key,
'page_name'=>$page_name,
'ad_pos_key'=>$ad_pos_key,
'ad_pos_name'=>$ad_pos_name];
if($mode=='upt' && $idx>0) {
$this->db->where('idx',$idx);
$this->db->update($this->ad_page_tb_name,$data);
$message = '수정되었습니다';
} else {
$this->db->insert($this->ad_page_tb_name,$data);
$message = '등록되었습니다';
}
echo "<script>alert('".$message."'); parent.location.reload();</script>";
} else {
echo "<script>alert('적합한 데이터를 입력해 주십시오.');exit;</script>";
}
exit;
}
// 개별광고페이지
public function fn_ad_detail(){
$this->load->database();
// $this->db->select('*');
// $this->db->from($this->ad_code_tb_name);
// $this->db->join($this->ad_page_tb_name, $this->ad_page_tb_name.'.idx = '.$this->ad_code_tb_name.'.ad_idx');
// $query = $this->db->get();
$query = $this->db->query("SELECT a.idx, b.page_name, b.ad_pos_name, a.ad_code, a.ad_file FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx");
$i = 0;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['row'][$i] = $row;
$i++;
}
return $this->load->view('/admin/advertisement/ad_detail',$return_data,true);
}
// 개별광고페이지 등록 및 수정 form
public function fn_ad_register(){
$this->load->database();
//page_list 만들기
$query = $this->db->get($this->ad_page_tb_name);
$i=0;
$return_data = array();
$result=$query->result_array();
foreach($result as $v){
$page_list[]=$v['page_name'];
}
$return_data['page_name']=array_values(array_unique($page_list)); //page_name list
//page_list array 에 광고 위치 push
$x = count($return_data['page_name']);
$return_data['ad_pos_name']=array();
$y=0;
foreach($return_data['page_name'] as $row2) {
foreach($result as $row) {
if($row['page_name']==$row2){
$return_data['ad_pos_name'][$y][]=$row['ad_pos_name'];
}
}
$y++;
}
//수정btn으로 이동했을 시
if($this->input->post('mode')=='modify'){
$return_data['mode']='modify';
$select ='a.*, b.page_name, b.ad_pos_name';
$query = $this->db->query("SELECT $select FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx");
foreach($query->result_array() as $row) {
$return_data['edit_data'] = $row;
}
}else{
$return_data['mode']='reg';
}
// row -> 전체 배열
// page_name -> page_name list
// ad_pos_name -> ad_pos_name list
// mode -> 수정 등록 구분
// edit_data -> 수정일 때 data
return $this->load->view('/admin/advertisement/ad_reg', $return_data , true);
}
//개별광고 등록
public function fn_ad_detail_reg(){
$page_name = $this->input->post('page_title');
$ad_pos_name = $this->input->post('ad_pos');
$ad_option = $this->input->post('ad_option'); // $ad_option 0: 광고 파일 등록 1:광고 코드 등록
$ad_lending = $this->input->post('ad_lending');
$ad_code = htmlspecialchars($this->input->post('ad_code'));
$where=array('page_name' => $page_name, 'ad_pos_name' => $ad_pos_name);
$this->load->database();
$query = $this->db->get_where($this->ad_page_tb_name, $where);
$ad_idx; //ad_idx 찾기
foreach ($query->result() as $row)
{
$ad_idx = $row->idx;
}
//이미지 업로드
if($_FILES['ad_file']['name']!='') {
$upload_path = './files/advertisement/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
umask(0);
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$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('ad_file')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$ad_file = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
}
// 이미 존재하는 데이터이면 수정 함
$where=array('ad_idx' => $ad_idx);
$query = $this->db->get_where($this->ad_code_tb_name, $where);
$result = $query->result();
empty($result[0]->idx)?$isdata=false:$isdata=true;
if($isdata){
if(!empty($ad_file)){
$update_data = array(
'ad_idx' => $ad_idx,
'ad_option' => $ad_option,
'ad_file' => $ad_file,
'ad_lending' => $ad_lending,
'ad_code' => $ad_code,
);
}else{
$update_data = array(
'ad_idx' => $ad_idx,
'ad_option' => $ad_option,
'ad_lending' => $ad_lending,
'ad_code' => $ad_code,
);
}
$this->db->where('idx', $result[0]->idx);
$this->db->update($this->ad_code_tb_name, $update_data);
}else{
if(!empty($ad_file)){
$insert_data = array(
'ad_idx' => $ad_idx,
'ad_option' => $ad_option,
'ad_file' => $ad_file,
'ad_lending' => $ad_lending,
'ad_code' => $ad_code,
);
}else{
$insert_data = array(
'ad_idx' => $ad_idx,
'ad_option' => $ad_option,
'ad_lending' => $ad_lending,
'ad_code' => $ad_code,
);
}
$this->db->insert($this->ad_code_tb_name, $insert_data);
}
$this->config->load('filecache',TRUE);
$file_cache_path = $this->config->item('file_cache_path','filecache');
$params = array('file_cache_path'=>$file_cache_path);
$this->load->library('advertisement_lib',$params);
$this->advertisement_lib->create_ad_cache();
$this->load->helper('url');
redirect('https://crossmap.co.kr/admin/advertisement/ad_detail');
}
//광고 개별 관리 삭제
public function fn_ad_detail_arr_del_proc() {
$is_del = $this->input->post('is_del');
foreach($is_del as $v) {
if($v>0) {
$where_in[] = $v;
}
}
if(count($where_in)>0) {
$this->load->database();
$this->db->where_in('idx',$where_in);
$ret = $this->db->delete($this->ad_code_tb_name);
if($ret==TRUE) {
$message = '삭제되었습니다.';
} else {
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
}
echo "<script>alert('".$message."'); parent.location.reload();</script>";
}
$this->config->load('filecache',TRUE);
$file_cache_path = $this->config->item('file_cache_path','filecache');
$params = array('file_cache_path'=>$file_cache_path);
$this->load->library('advertisement_lib',$params);
$this->advertisement_lib->create_ad_cache();
exit;
}
public function fn_ad_create_cache(){
$this->load->database();
$query = $this->db->query("SELECT a.idx, b.page_key, b.ad_pos_key, a.ad_option, a.ad_code, a.ad_file,a.ad_lending FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx");
$i=array();
foreach($query->result_array() as $v){
$i[$v['page_key']][$v['ad_pos_key']]=array('option'=>$v['ad_option'],'ad_code'=>$v['ad_code'],'ad_file'=>$v['ad_file'],'ad_lending'=>$v['ad_lending']);
}
$json_data=json_encode($i);
print_r($i);
$this->config->load('filecache',TRUE);
$file_cache_path = $this->config->item('file_cache_path','filecache');
$params = array('file_cache_path'=>$file_cache_path);
$this->load->library('advertisement_lib',$params);
if($json_data!=FALSE) {
$this->advertisement_lib->write_ad_cache($json_data);
}
}
}

View File

@@ -0,0 +1,40 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once (APPPATH.'core/admin/cm_controller.php');
class advertisement_ajax extends CI_Controller {
var $ad_page_tb_name = 'ad_page'; // 광고 페이지 테이블 이름
var $ad_code_tb_name = 'ad_detail'; // 광고 코드 테이블 이름
// find ad_detail by page_name, pos_name
public function ajax_call_ad_detail_ad_idx(){
$this->load->database();
$page_name = $this->input->get_post('page_name');
$pos_name = $this->input->get_post('pos_name');
$select ='a.*, b.page_name, b.ad_pos_name';
$where = "b.page_name='".$page_name."' AND b.ad_pos_name= '".$pos_name."'";
$db_query ="SELECT $select FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx WHERE $where";
$result = $this->db->query($db_query);
$data=null;
foreach($result->result_object() as $row) {
$data = $row;
}
echo json_encode($data);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,805 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/admin/cm_controller.php');
class cs extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 1:1문의 list
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_question_list() {
# request
$page = $this->uri->segment(5);
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_click1 = trim($this->input->get_post('search_click1', TRUE));
$search_click2 = trim($this->input->get_post('search_click2', TRUE));
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# 검색
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = addslashes($search_keyword);
$req_data['search_click1'] = $search_click1;
$req_data['search_click2'] = $search_click2;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/cs/m_bbs_question');
$total_count = $this->m_bbs_question->bbs_question_list_total_count($req_data);
$result = $this->m_bbs_question->bbs_question_list($req_data);
$new_count = $this->m_bbs_question->bbs_question_new_count($req_data);
$is_reply_count = $this->m_bbs_question->bbs_question_group_by_is_reply($req_data);
$arr_is_reply_count = array();
foreach($is_reply_count as $val) {
$arr_is_reply_count[$val['is_reply']] = $val['cnt'];
}
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/cs/cs_question_list/7' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
# view data
$return_data['pagination'] = $pagination;
$return_data['page'] = $page;
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['list'] = $result;
$return_data['new_count'] = $new_count;
$return_data['arr_is_reply_count'] = $arr_is_reply_count;
$return_data['search_click1'] = $search_click1;
$return_data['search_click2'] = $search_click2;
# view
return $this->load->view('/admin/cs/cs_question_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 1:1문의 reply add
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_question_reply_add() {
# request
$page = trim($this->input->get_post('page', TRUE));;
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/cs/m_bbs_question');
$return_data = $this->m_bbs_question->bbs_question_select($idx);
if(count($return_data) == 0) {
gf_alert("잘못된 접근입니다.", '/admin/main');
}
# view data
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['idx'] = $idx;
$return_data['result'] = $return_data[0];
# view
return $this->load->view('/admin/cs/cs_question_reply_add', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 1:1문의 reply add - 저장
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function fn_cs_question_reply_add_proc() {
# request
$page = trim($this->input->get_post('page', TRUE));;
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$title = trim($this->input->get_post('title', TRUE));
$content = trim($this->input->get_post('content', FALSE));
# model
$this->load->model('admin/cs/m_bbs_question');
# select
$result = $this->m_bbs_question->bbs_question_select($idx);
if(count($result)==0) {
gf_alert("저장에 실패했습니다. 다시시도해 주세요.", '/admin/cs/cs_question_list/7');
exit;
}
$member_id = $result[0]['member_id'];
$req_data = array();
$req_data['p_idx'] = $idx;
$req_data['title'] = $title;
$req_data['content'] = $content;
$req_data['member_id'] = $member_id;
# insert
$result1 = $this->m_bbs_question->bbs_question_reply_insert($req_data);
if(!$result1) {
gf_alert("저장에 실패했습니다. 다시시도해 주세요.", '/admin/cs/cs_question_list/7');
exit;
}
# is_reply update
$this->m_bbs_question->bbs_question_is_reply_update($idx);
gf_alert("등록되었습니다.", '/admin/cs/cs_question_list/7');
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 1:1문의 reply 삭제 - 저장
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_question_reply_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$req_date[] = $idx;
# model - update
$this->load->model('admin/cs/m_bbs_question');
$this->m_bbs_question->bbs_question_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/cs/cs_question_list/7');
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 1:1문의 reply 삭제 - 저장 (다중)
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_question_reply_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model - update
$this->load->model('admin/cs/m_bbs_question');
$this->m_bbs_question->bbs_question_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/cs/cs_question_list/7');
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 1:1문의 view
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_question_view() {
# request
$page = trim($this->input->get_post('page', TRUE));;
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_is_reply = trim($this->input->get_post('search_is_reply', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/cs/m_bbs_question');
$return_data = $this->m_bbs_question->bbs_question_select($idx);
if(count($return_data) == 0) {
gf_alert("잘못된 접근입니다.", '/admin/main');
}
# view data
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_is_reply'] = $search_is_reply;
$return_data['idx'] = $idx;
$return_data['result'] = $return_data[0];
# view
return $this->load->view('/admin/cs/cs_question_view', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 공지사항 list
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_notice_list() {
# request
$page = $this->uri->segment(5);
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_click = trim($this->input->get_post('search_click', TRUE));
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# 검색
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = addslashes($search_keyword);
$req_data['search_click'] = $search_click;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/cs/m_bbs_notice');
$total_count = $this->m_bbs_notice->bbs_notice_list_total_count($req_data);
$result = $this->m_bbs_notice->bbs_notice_list($req_data);
$new_count = $this->m_bbs_notice->bbs_notice_new_count();
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/cs/cs_notice_list/7' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
# view data
$return_data['pagination'] = $pagination;
$return_data['page'] = $page;
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_click'] = $search_click;
$return_data['list'] = $result;
$return_data['new_count'] = $new_count;
# view
return $this->load->view('/admin/cs/cs_notice_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 공지사항 select
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_notice_reg() {
# request
$mode = trim($this->input->get_post('mode', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
if($mode == '') $mode = 'add';
$return_data = array();
if($mode == 'edit') {
# model
$this->load->model('admin/cs/m_bbs_notice');
$result = $this->m_bbs_notice->bbs_notice_select($idx);
$return_data['result'] = $result[0];
}
$return_data['mode'] = $mode;
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['idx'] = $idx;
# view
return $this->load->view('/admin/cs/cs_notice_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 공지사항 - 저장
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_notice_reg_proc() {
# request
$page = trim($this->input->get_post('page', TRUE));
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$title = trim($this->input->get_post('title', TRUE));
$content = trim($this->input->get_post('content', FALSE));
$mode = trim($this->input->get_post('mode', TRUE));;
$req_data['title'] = $title;
$req_data['content'] = $content;
if($mode == 'add') {
# model - insert
$this->load->model('admin/cs/m_bbs_notice');
$result = $this->m_bbs_notice->bbs_notice_insert($req_data);
} else if($mode == 'edit') {
$req_data['idx'] = $idx;
# model - insert
$this->load->model('admin/cs/m_bbs_notice');
$result = $this->m_bbs_notice->bbs_notice_update($req_data);
}
if(!$result) {
gf_alert("저장에 실패했습니다. 다시시도해 주세요.", '/admin/cs/cs_notice_list/7/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword);
exit;
}
gf_alert("저장되었습니다.", '/admin/cs/cs_notice_list/7/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 공지사항 삭제 - 저장
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_notice_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$req_date[] = $idx;
# model - update
$this->load->model('admin/cs/m_bbs_notice');
$this->m_bbs_notice->bbs_notice_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/cs/cs_notice_list/7');
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 공지사항 삭제 (다중)
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_notice_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model - update
$this->load->model('admin/cs/m_bbs_notice');
$this->m_bbs_notice->bbs_notice_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/cs/cs_notice_list/7');
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - faq list
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function fn_cs_faq_list() {
# request
$page = $this->uri->segment(5);
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_category_code = trim($this->input->get_post('search_category_code', TRUE));
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
if($search_category_code=='') {
$search_category_code = '27';
}
$search_category1 = substr($search_category_code, 0, 2);
$search_category2 = substr($search_category_code, 2, 2);
# 검색
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = addslashes($search_keyword);
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['search_category1'] = $search_category1;
$req_data['search_category2'] = $search_category2;
# model - 카테고리 list
$this->load->model('admin/cs/m_bbs_faq');
$total_count = $this->m_bbs_faq->bbs_faq_list_total_count($req_data);
$result = $this->m_bbs_faq->bbs_faq_list($req_data);
$category_result = $this->m_bbs_faq->faq_category_all_list();
$arr_category1 = array();
$arr_category2 = array();
foreach ($category_result as $val) {
if($val['depth']=='1') {
$arr_category1[] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name']);
} else if($val['depth']=='2') {
$arr_category2[$val['p_category_code']][]= array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name']);
}
}
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/cs/cs_faq_list/7' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
# view data
$return_data['pagination'] = $pagination;
$return_data['page'] = $page;
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category1'] = $search_category1;
$return_data['search_category2'] = $search_category2;
$return_data['search_category_code']= $search_category_code;
$return_data['list'] = $result;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
# view
return $this->load->view('/admin/cs/cs_faq_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 faq - 등록 / 수정
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function fn_cs_faq_reg() {
# request
$mode = trim($this->input->get_post('mode', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$search_category_code = trim($this->input->get_post('search_category_code', TRUE));
if($mode == '') $mode = 'add';
# model - 카테고리 list
$this->load->model('admin/cs/m_bbs_faq');
$category_result = $this->m_bbs_faq->faq_category_all_list();
$arr_category1 = array();
foreach ($category_result as $val) {
if($val['depth']=='1') {
$arr_category1[] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name']);
} else if($val['depth']=='2') {
$arr_category2[]= array('p_category_code' => $val['p_category_code'], 'category_code'=>$val['category_code'], 'category_name'=>$val['category_name']);
}
}
$return_data = array();
if($mode == 'edit') {
# model
$this->load->model('admin/cs/m_bbs_faq');
$result = $this->m_bbs_faq->bbs_faq_select($idx);
$return_data['result'] = $result[0];
}
$return_data['mode'] = $mode;
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category_code']= $search_category_code;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['idx'] = $idx;
# view
return $this->load->view('/admin/cs/cs_faq_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - faq - 저장
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function fn_cs_faq_reg_proc() {
# request
$page = trim($this->input->get_post('page', TRUE));
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_category_code = trim($this->input->get_post('search_category_code', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$category1 = trim($this->input->get_post('category1', TRUE));
$category2 = trim($this->input->get_post('category2', TRUE));
$title = trim($this->input->get_post('title', TRUE));
$content = trim($this->input->get_post('content', FALSE));
$mode = trim($this->input->get_post('mode', TRUE));;
$category_code = $category1.$category2;
$req_data['title'] = $title;
$req_data['content'] = $content;
$req_data['faq_category_code1'] = $category1;
$req_data['faq_category_code2'] = $category2;
if($mode == 'add') {
# model - insert
$this->load->model('admin/cs/m_bbs_faq');
$result = $this->m_bbs_faq->bbs_faq_insert($req_data);
} else if($mode == 'edit') {
$req_data['idx'] = $idx;
# model - insert
$this->load->model('admin/cs/m_bbs_faq');
$result = $this->m_bbs_faq->bbs_faq_update($req_data);
}
if(!$result) {
gf_alert("저장에 실패했습니다. 다시시도해 주세요.", '/admin/cs/cs_faq_list/7/'.$page.'?search_category_code='.$search_category_code.'&search_type='.$search_type.'&search_keyword='.$search_keyword);
exit;
}
gf_alert("저장되었습니다.", '/admin/cs/cs_faq_list/7/'.$page.'?search_category_code='.$search_category_code.'&search_type='.$search_type.'&search_keyword='.$search_keyword);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - faq 삭제
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_faq_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$search_category_code = trim($this->input->get_post('search_category_code', TRUE));
$req_date[] = $idx;
# model - update
$this->load->model('admin/cs/m_bbs_faq');
$this->m_bbs_faq->bbs_faq_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/cs/cs_faq_list/7?search_category_code='.$search_category_code);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - 공지사항 삭제 (다중)
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_cs_faq_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
$search_category_code = trim($this->input->get_post('search_category_code', TRUE));
# model - update
$this->load->model('admin/cs/m_bbs_faq');
$this->m_bbs_faq->bbs_faq_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/cs/cs_faq_list/7?search_category_code='.$search_category_code);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 faq 카테고리별 count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function fn_ajax_cs_faq_category_code_count() {
# request
$depth = trim($this->input->get_post('depth', TRUE));
$category_code = trim($this->input->get_post('category_code', TRUE));
$req_date['depth'] = $depth;
$req_date['category_code'] = $category_code;
# model - update
$this->load->model('admin/cs/m_bbs_faq');
$count = $this->m_bbs_faq->bbs_faq_category_code_count($req_date);
$return_data['result'] = $count;
# view
return $this->load->view('/admin/cs/cs_faq_category_code_count', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 - faq 카테고리 리스트
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function fn_cs_faq_category_list() {
# request
$page = $this->uri->segment(5);
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# 검색
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = addslashes($search_keyword);
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/cs/m_bbs_faq');
$total_count = $this->m_bbs_faq->faq_category_list_total_count($req_data);
$result = $this->m_bbs_faq->faq_category_list($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/cs/cs_faq_category_list/4' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
# view data
$return_data['pagination'] = $pagination;
$return_data['page'] = $page;
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['list'] = $result;
# view
return $this->load->view('/admin/cs/cs_faq_category_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 faq 카테고리 - 저장
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function fn_ajax_cs_faq_category_reg_proc() {
# request
$mode = trim($this->input->get_post('mode', TRUE));
$category_name = trim($this->input->get_post('category_name', TRUE));
$p_category_code = trim($this->input->get_post('p_category_code', TRUE));
$category_idx = trim($this->input->get_post('category_idx', TRUE));
$req_data['category_name'] = $category_name;
if($mode == 'add') {
$depth = '1';
if($p_category_code!='') $depth = '2';
$req_data['p_category_code'] = $p_category_code;
$req_data['depth'] = $depth;
# model - insert
$this->load->model('admin/cs/m_bbs_faq');
$result = $this->m_bbs_faq->bbs_faq_category_insert($req_data);
$result_code = '0000';
if(!$result) {
$result_code = '9999';
}
} else if($mode == 'edit') {
$req_data['idx'] = $category_idx;
# model
$this->load->model('admin/cs/m_bbs_faq');
$result = $this->m_bbs_faq->bbs_faq_category_update($req_data);
$result_code = '0000';
if(!$result) {
$result_code = '9999';
}
}
$return_data['result'] = $result_code;
# view
return $this->load->view('/admin/comm/result_html', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 고객센터 faq 카테고리 삭제 - 저장
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function fn_cs_faq_category_del_proc() {
# request
$depth = trim($this->input->get_post('depth', TRUE));
$del_key = trim($this->input->get_post('del_key', TRUE));
if($depth == '1') {
$req_date['p_category_code']= $del_key;
$req_date['idx'] = '';
} else {
$req_date['p_category_code']= '';
$req_date['idx'] = $del_key;
}
# model - update
$this->load->model('admin/cs/m_bbs_faq');
$this->m_bbs_faq->bbs_faq_category_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/cs/cs_faq_category_list/7');
}
}
?>

View File

@@ -0,0 +1,118 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once (APPPATH.'core/admin/cm_controller.php');
class advertisement extends cm_controller {
var $ad_page_tb_name = 'ad_page'; // 광고 페이지 테이블 이름
var $ad_code_tb_name = ''; // 광고 코드 테이블 이름
/*
title : 광고 페이지 관리 (목록)
*/
public function fn_1($page=1) {
$this->load->database();
$query = $this->db->get($this->ad_page_tb_name);
$i = 0;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['row'][$i] = $row;
$i++;
}
return $this->load->view('/admin/advertisement/ads', $return_data, true);
}
public function fn_ad_page_arr_del_proc() {
$is_del = $this->input->post('is_del');
foreach($is_del as $v) {
if($v>0) {
$where_in[] = $v;
}
}
if(count($where_in)>0) {
$this->load->database();
$this->db->where_in('idx',$where_in);
$ret = $this->db->delete($this->ad_page_tb_name);
if($ret==TRUE) {
$message = '삭제되었습니다.';
} else {
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
}
echo "<script>alert('".$message."'); parent.location.reload();</script>";
}
exit;
}
public function fn_ad_page_edit() {
$idx = $this->input->get('idx');
if(is_numeric($idx)==TRUE) {
$this->load->database();
$query = $this->db->get_where($this->ad_page_tb_name, array('idx'=>$idx));
$row = $query->row_array();
$row['result'] = 'success';
} else {
$row['result'] = 'fail';
}
echo json_encode($row);
exit;
}
/**
* [ad_page_proc register ad page]
* @return [boolean]
*/
public function fn_ad_page_proc() {
$page_key = $this->input->post('page_key');
$page_name = $this->input->post('page_name');
$ad_pos_key = $this->input->post('ad_pos_key');
$ad_pos_name = $this->input->post('ad_pos_name');
$mode = $this->input->post('mode');
$idx = $this->input->post('idx');
$this->load->library('form_validation');
$this->form_validation->set_rules('page_key','페이지 키',array('required','regex_match[/^[a-zA-Z]+$/]'));
$this->form_validation->set_rules('page_name','페이지 이름',array('required'));
$this->form_validation->set_rules('ad_pos_key','광고 위치 키',array('required','regex_match[/^[a-zA-Z]+$/]'));
$this->form_validation->set_rules('ad_pos_name','광고 위치 이름',array('required'));
if ($this->form_validation->run() == TRUE) {
$this->load->database();
$data = ['page_key'=>$page_key,
'page_name'=>$page_name,
'ad_pos_key'=>$ad_pos_key,
'ad_pos_name'=>$ad_pos_name];
if($mode=='upt' && $idx>0) {
$this->db->where('idx',$idx);
$this->db->update($this->ad_page_tb_name,$data);
$message = '수정되었습니다';
} else {
$this->db->insert($this->ad_page_tb_name,$data);
$message = '등록되었습니다';
}
echo "<script>alert('".$message."'); parent.location.reload();</script>";
} else {
echo "<script>alert('적합한 데이터를 입력해 주십시오.');exit;</script>";
}
exit;
}
}

View File

@@ -0,0 +1,545 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* 컨텐츠관련 스케쥴
*/
class cron01 extends CI_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 언론사 등록기사 업데이트
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function press_article_count_update() {
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] press_article_count_update start'.chr(10);
# model - 뉴스 count
$this->load->model('admin/news/m_news');
$result1 = $this->m_news->news_group_by_press_idx();
# model - press update
$this->load->model('admin/etc_section/m_press');
$result2 = $this->m_press->press_article_count_update($result1);
$contents.= $result2.'개 업데이트 완료'.chr(10);
$contents.= '['.date("Y-m-d H:i:s").'] press_article_count_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 예약글 노출 - 테마도 같이 해줄까?
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function reservation_article_display_update() {
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] reservation_article_display_update start'.chr(10);
$this->load->model('admin/news/m_news');
$this->load->model('admin/life/m_life');
$this->load->model('admin/column/m_column');
$arr = array('1', '2', '3');
foreach ($arr as $content_type) {
if($content_type == '1') {
$result1 = $this->m_news->news_reservation_article_list();
if(count($result1) > 0) $this->m_news->news_is_display_update_batch($result1);
} else if($content_type == '2') {
$result1 = $this->m_column->column_reservation_article_list();
if(count($result1) > 0) $this->m_column->column_is_display_update_batch($result1);
} else if($content_type == '3') {
$result1 = $this->m_life->life_reservation_article_list();
if(count($result1) > 0) $this->m_life->life_is_display_update_batch($result1);
}
foreach ($result1 as $val) {
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $val['idx'];
$req_data['search_type'] = 'is_display';
$req_data['search_key'] = 'N';
// 테마
$this->load->library('comm_admin');
$this->comm_admin->fn_theme_change_is_display($req_data);
// 기타테마
$this->load->library('comm_admin');
$this->comm_admin->fn_etc_section_change_is_display($req_data);
}
$contents.= $content_type.'-----------------------------------------------------------------------------------'.chr(10);
ob_flush();
flush();
sleep(1);
}
$contents.= '['.date("Y-m-d H:i:s").'] reservation_article_display_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹관리 노출 - 뉴스 라이프
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function article_rank_update() {
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] article_rank_update start'.chr(10);
$this->load->model('admin/comm/m_ranking');
$this->load->model('admin/news/m_news');
$this->load->model('admin/life/m_life');
$this->m_ranking->rank_all_copy_ranking_log(1); // 로그로 이동
$this->m_ranking->rank_all_copy_ranking_log(3); // 로그로 이동
$ranking_date = date("Y-m-d");
$now_date = date("Y-m-d H:i:s");
$this->m_ranking->rank_where_ranking_date_delete($ranking_date);
# 뉴스
$arr_orderby = array('hit_count', 'comment_count', 'review_count1');
$z=1;
foreach ($arr_orderby as $val0) {
$req_data = array();
$req_data['order_by'] = $val0;
$result1 = $this->m_news->news_rank_list($req_data);
if(count($result1) > 0) {
$i=1;
foreach ($result1 as $val) {
$org_file = $val['main_img'];
$filename = '';
if($org_file!='') {
# image copy
$upload_path = './files/ranking/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$arr_new_file = explode('/', $org_file);
copy('.' . $org_file, $upload_path . '/ranking_type'.$z.$i. '_' . $arr_new_file[5]);
$filename = '/files/ranking/'.date("Y").'/'.date("m").'/ranking_type'.$z.$i. '_' . $arr_new_file[5];
}
$req_data = array();
$req_data['ranking_date'] = $ranking_date;
$req_data['ranking_type'] = $z;
$req_data['content_type'] = '1';
$req_data['rank'] = $i;
$req_data['title'] = $val['title'];
$req_data['main_img'] = $filename;
$req_data['content_idx'] = $val['idx'];
$req_data['reg_id'] = 'system';
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = 'system';
$req_data['update_date'] = $now_date;
$this->m_ranking->ranking_all_insert($req_data);
$i++;
}
}
$z++;
}
# 라이프
$arr_orderby = array('hit_count', 'comment_count', 'like_count');
$z=1;
foreach ($arr_orderby as $val0) {
$req_data = array();
$req_data['order_by'] = $val0;
$result1 = $this->m_life->life_rank_list($req_data);
if(count($result1) > 0) {
$i=1;
foreach ($result1 as $val) {
$org_file = $val['main_img'];
$filename = '';
if($org_file!='') {
# image copy
$upload_path = './files/ranking/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$arr_new_file = explode('/', $org_file);
copy('.' . $org_file, $upload_path . '/ranking_type'.$z.$i. '_' . $arr_new_file[5]);
$filename = '/files/ranking/'.date("Y").'/'.date("m").'/ranking_type'.$z.$i. '_' . $arr_new_file[5];
}
$req_data = array();
$req_data['ranking_date'] = $ranking_date;
$req_data['ranking_type'] = $z;
$req_data['content_type'] = '3';
$req_data['rank'] = $i;
$req_data['head_title'] = $val['head_title'];
$req_data['title'] = $val['title'];
$req_data['main_img'] = $filename;
$req_data['content_idx'] = $val['idx'];
$req_data['reg_id'] = 'system';
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = 'system';
$req_data['update_date'] = $now_date;
$this->m_ranking->ranking_all_insert($req_data);
$i++;
}
}
$z++;
}
$delete_date = date("Y-m-d", strtotime("-1 day"));
$this->m_ranking->rank_where_org_ranking_date_delete($delete_date);
$contents.= '['.date("Y-m-d H:i:s").'] article_rank_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function realtime_keyword_update() {
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] realtime_keyword_update start'.chr(10);
# model - realtime_keyword_setting 가져오기
$idx = 1;
# model
$this->load->model('admin/setting/m_realtime_keyword');
$result1 = $this->m_realtime_keyword->realtime_keyword_setting_select($idx);
$base_hour = $result1[0]['base_hour'];
$now_date = date("Y-m-d H:i:s");
$result2 = $this->m_realtime_keyword->realtime_keyword_max_reg_date();
if(isset($result2[0]['reg_date'])==true){
$date1 = strtotime($now_date);
$date2 = strtotime($result2[0]['reg_date']);
$diff_hour = floor(($date1 - $date2) / 3600);
} else {
$diff_hour = $base_hour;
$date1 = $now_date;
$date2 = date("Y-m-d H:i:s", strtotime ("-".$base_hour." hours"));
}
if($base_hour <= $diff_hour) {
$this->m_realtime_keyword->realtime_keyword_move_log();
$req_data = array();
$req_data['start_date'] = $date2;
$req_data['end_date'] = $date1;
$this->load->model('admin/comm/m_search_keyword_log');
$result3 = $this->m_search_keyword_log->search_keyword_log_group_by_keyword($req_data);
$i=1;
foreach ($result3 as $val) {
$arr_keyword = $this->m_realtime_keyword->realtime_keyword_where_keyword_select($val['keyword']);
$rank = 0;
if(count($arr_keyword)>0) {
$rank = $arr_keyword['rank'];
}
$req_data = array();
$req_data['keyword'] = $val['keyword'];
$req_data['search_count'] = $val['cnt'];
$req_data['reg_id'] = 'system';
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = 'system';
$req_data['update_date'] = $now_date;
$req_data['last_rank'] = $rank;
$req_data['rank'] = $i;
$this->m_realtime_keyword->realtime_keyword_insert($req_data);
$i++;
}
}
$this->m_realtime_keyword->realtime_keyword_where_reg_date_delete($date2);
$contents.= '['.date("Y-m-d H:i:s").'] realtime_keyword_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 오늘의 말씀, 영적기상도 노출
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function reservation_etc_display_update() {
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] reservation_etc_display_update start'.chr(10);
# 예약글 가져오기 - display = 'N' && display_date <= now()
$this->load->model('admin/etc_section/m_today_word');
$this->m_today_word->today_word_reservation_update();
# 예약글 가져오기 - display = 'N' && display_date <= now()
$this->load->model('admin/etc_section/m_weather');
$this->m_weather->weather_reservation_update();
$contents.= '['.date("Y-m-d H:i:s").'] reservation_etc_display_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 인기수 업데이트 - 컨텐츠
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function article_popular_count_update() {
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] article_popular_count_update start'.chr(10);
$this->load->model('admin/news/m_news');
$this->load->model('admin/life/m_life');
$this->load->model('admin/column/m_column');
$start_date = date("Y-m-d H:i:s", strtotime ("-30 day"));
$delete_date = date("Y-m-d", strtotime ("-30 day"));
$this->m_news->news_popular_count_where_display_date_update($delete_date);
$this->m_life->life_popular_count_where_display_date_update($delete_date);
$this->m_column->column_popular_count_where_display_date_update($delete_date);
$arr_news = $this->m_news->news_where_display_date_list($start_date);
foreach ($arr_news as $val) {
$hit_count = 0; $like_count = 0; $comment_count = 0;
if(isset($val['hit_count'])==true) $hit_count = (int)$val['hit_count'];
if(isset($val['like_count'])==true) $like_count = (int)$val['like_count'];
if(isset($val['comment_count'])==true) $comment_count = (int)$val['comment_count'];
$hit_count = $hit_count * 3;
$like_count = $like_count * 200;
$comment_count = $comment_count * 400;
$popular_count = $hit_count + $like_count + $comment_count;
# 인기수 업데이트
$req_data = array();
$req_data['idx'] = $val['idx'];
$req_data['popular_count'] = $popular_count;
$this->m_news->news_update($req_data);
}
$arr_column = $this->m_column->column_where_display_date_list($start_date);
foreach ($arr_column as $val) {
$hit_count = 0; $like_count = 0; $comment_count = 0;
if(isset($val['hit_count'])==true) $hit_count = (int)$val['hit_count'];
if(isset($val['like_count'])==true) $like_count = (int)$val['like_count'];
if(isset($val['comment_count'])==true) $comment_count = (int)$val['comment_count'];
$hit_count = $hit_count * 3;
$like_count = $like_count * 200;
$comment_count = $comment_count * 400;
$popular_count = $hit_count + $like_count + $comment_count;
# 인기수 업데이트
$req_data = array();
$req_data['idx'] = $val['idx'];
$req_data['popular_count'] = $popular_count;
$this->m_column->column_update($req_data);
}
$arr_life = $this->m_life->life_where_display_date_list($start_date);
foreach ($arr_life as $val) {
$hit_count = 0; $like_count = 0; $comment_count = 0;
if(isset($val['hit_count'])==true) $hit_count = (int)$val['hit_count'];
if(isset($val['like_count'])==true) $like_count = (int)$val['like_count'];
if(isset($val['comment_count'])==true) $comment_count = (int)$val['comment_count'];
$hit_count = $hit_count * 3;
$like_count = $like_count * 200;
$comment_count = $comment_count * 400;
$popular_count = $hit_count + $like_count + $comment_count;
# 인기수 업데이트
$req_data = array();
$req_data['idx'] = $val['idx'];
$req_data['popular_count'] = $popular_count;
$this->m_life->life_update($req_data);
}
$contents.= '['.date("Y-m-d H:i:s").'] article_popular_count_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 인기수 업데이트 - 채널, 에디터
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_popular_count_update() {
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] life_popular_count_update start'.chr(10);
$start_date = date("Y-m-d H:i:s", strtotime ("-30 day"));
# 채널
$this->load->model('admin/comm/m_delivery');
$this->load->model('admin/life/m_life');
$this->load->model('admin/life/m_life_channel');
$this->load->model('admin/comm/m_delivery');
$arr_channel = $this->m_life_channel->channel_all_list();
foreach ($arr_channel as $val) {
# 배달수
$req_data = array();
$req_data['start_date'] = $start_date;
$req_data['content_type'] = '3';
$req_data['main_idx'] = $val['idx'];
$delivery_count = $this->m_delivery->delivery_where_content_type_content_idx_count($req_data);
$delivery_count = $delivery_count * 700;
# 조회수, 좋아요, 댓글
$req_data = array();
$req_data['start_date'] = $start_date;
$req_data['channel_idx'] = $val['idx'];
$arr_sum_count = $this->m_life->life_where_channel_idx_sum_count($req_data);
$hit_count = 0; $like_count = 0; $comment_count = 0;
if(isset($arr_sum_count['hit_count'])==true) $hit_count = (int)$arr_sum_count['hit_count'];
if(isset($arr_sum_count['like_count'])==true) $like_count = (int)$arr_sum_count['like_count'];
if(isset($arr_sum_count['comment_count'])==true) $comment_count = (int)$arr_sum_count['comment_count'];
$hit_count = $hit_count * 3;
$like_count = $like_count * 200;
$comment_count = $comment_count * 400;
$popular_count = $delivery_count + $hit_count + $like_count + $comment_count;
# 인기수 업데이트
$req_data = array();
$req_data['idx'] = $val['idx'];
$req_data['popular_count'] = $popular_count;
$this->m_life_channel->channel_update($req_data);
}
# 에디터
# model
$this->load->model('admin/member/m_partner');
$req_data = array();
$req_data['member_group_idx'] = '6';
$arr_editor = $this->m_partner->partner_list_where_member_group_idx($req_data);
foreach ($arr_editor as $val) {
# 북마크
$req_data = array();
$req_data['content_type'] = '3';
$req_data['start_date'] = $start_date;
$req_data['partner_idx'] = $val['idx'];
$bookmark_count = $this->m_life->life_join_bookmark_editor_count($req_data);
$bookmark_count = $bookmark_count * 700;
# 조회수, 좋아요, 댓글
$req_data = array();
$req_data['start_date'] = $start_date;
$req_data['partner_idx'] = $val['idx'];
$arr_sum_count = $this->m_life->life_where_partner_idx_sum_count($req_data);
$hit_count = 0; $like_count = 0; $comment_count = 0;
if(isset($arr_sum_count['hit_count'])==true) $hit_count = (int)$arr_sum_count['hit_count'];
if(isset($arr_sum_count['like_count'])==true) $like_count = (int)$arr_sum_count['like_count'];
if(isset($arr_sum_count['comment_count'])==true) $comment_count = (int)$arr_sum_count['comment_count'];
$popular_count = $bookmark_count + $hit_count + $like_count + $comment_count;
# 인기수 업데이트
$req_data = array();
$req_data['idx'] = $val['idx'];
$req_data['popular_count'] = $popular_count;
$this->m_partner->partner_update($req_data);
}
$contents.= '['.date("Y-m-d H:i:s").'] life_popular_count_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
}
?>

View File

@@ -0,0 +1,224 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* 회원글관련 스케쥴
*/
class cron02 extends CI_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 좋아요수 셋팅해놓은 갯수 이상이면 배댓
# CREATE : 2018-05-14
#---------------------------------------------------------------------------
function best_comment_update() {
if (!is_dir('./logs/cron02/'.date("Ym"))) mkdir('./logs/cron02/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] best_comment_update start'.chr(10);
# model
$this->load->model('admin/comm/m_comment');
$this->m_comment->comment_is_best_all_update();
$this->load->model('admin/setting/m_comment_setting');
$arr_comment_setting = $this->m_comment_setting->comment_setting_list();
foreach ($arr_comment_setting as $val) {
$req_data = array();
$req_data['content_type'] = $val['setting_type'];
$req_data['like_count'] = $val['best_comment_like_count'];
$req_data['limit'] = $val['max_best_comment_count'];
$this->m_comment->comment_is_best_update($req_data);
}
$contents.= '['.date("Y-m-d H:i:s").'] best_comment_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron02/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 블라인드 처리
# CREATE : 2018-05-14
#---------------------------------------------------------------------------
function blind_update() {
if (!is_dir('./logs/cron02/'.date("Ym"))) mkdir('./logs/cron02/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] blind_update start'.chr(10);
$now_date = date("Y-m-d H:i:s");
$this->load->model('admin/setting/m_comment_setting');
$this->load->model('admin/setting/m_blind');
$this->load->model('admin/comm/m_comment');
$this->load->model('admin/comm/m_spam');
$arr_comment_setting = $this->m_comment_setting->comment_setting_list();
foreach ($arr_comment_setting as $val) {
if($val['block_call_type']=='1'){ // 블라인드
$blind_comment = $val['block_blind_conent'];
$blind_code ='2';
} else if($val['block_call_type']=='2'){ // 자동삭제
$blind_comment = $val['block_del_conent'];
$blind_code ='3';
}
$req_data = array();
$req_data['content_type'] = $val['setting_type'];
$req_data['block_call_count'] = $val['block_call_count'];
$arr_blind_list = $this->m_spam->spam_where_block_list($req_data);
if(count($arr_blind_list) > 0) {
foreach ($arr_blind_list as $val2) {
$arr_comment = $this->m_comment->comment_select($val2['comment_idx']);
if($arr_comment['comment_status']!='1') continue;
$req_data = array();
$req_data['comment_status'] = $blind_code;
$req_data['comment'] = $blind_comment;
$req_data['comment_org'] = $arr_comment['comment'];
$req_data['update_id'] = 'system';
$req_data['update_date'] = $now_date;
$req_data['del_date'] = $now_date;
$req_data['idx'] = $val2['comment_idx'];
$this->m_comment->comment_update($req_data);
$req_data = array();
$req_data['blind_type'] = '1';
$req_data['content_type'] = $val['setting_type'];
$req_data['content_idx'] = $arr_comment['content_idx'];
$req_data['comment_idx'] = $val2['comment_idx'];
$req_data['blind_id'] = $arr_comment['write_id'];
$req_data['blind_name'] = $arr_comment['write_name'];
$req_data['blind_comment'] = $arr_comment['comment'];
$req_data['blind_status'] = '1';
$req_data['reg_id'] = 'system';
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = 'system';
$req_data['update_date'] = $now_date;
$this->m_blind->blind_insert($req_data);
$this->m_spam->spam_is_blind_where_comment_idx_update($val2['comment_idx']);
}
}
}
$contents.= '['.date("Y-m-d H:i:s").'] blind_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron02/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 블라인드 제재처리
# CREATE : 2018-05-14
#---------------------------------------------------------------------------
function blind_limit_update() {
if (!is_dir('./logs/cron02/'.date("Ym"))) mkdir('./logs/cron02/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] blind_limit_update start'.chr(10);
$this->load->model('admin/setting/m_blind');
$this->load->model('admin/member/m_member');
$this->load->model('admin/setting/m_blind_setting');
$this->load->model('admin/setting/m_blind_limit');
$arr_blind_setting = $this->m_blind_setting->blind_setting_list();
foreach ($arr_blind_setting as $val) {
if($val['limit_count']==0) continue;
$req_data = array();
$req_data['cnt'] = $val['limit_count'];
$arr_blind_list = $this->m_blind->blind_group_by_count_list($req_data);
if(count($arr_blind_list)>0) {
foreach ($arr_blind_list as $val2){
$arr_member = $this->m_member->member_where_member_id_select($val2['blind_id']);
$member_name = ''; $member_email = '';
if(isset($arr_member['member_name'])==true) {
$member_name = $arr_member['member_name'];
$member_email = $arr_member['member_email'];
}
$now_date = date("Y-m-d H:i:s");
if($val['limit_status'] == '2') {
$end_date = $now_date;
} else {
$end_date = date("Y-m-d H:i:s", strtotime("+".$val['limit_day']." days"));
}
$req_data = array();
$req_data['member_id'] = $val2['blind_id'];
$req_data['member_name'] = $member_name;
$req_data['limit_type'] = $val['limit_type'];
$req_data['limit_status'] = $val['limit_status'];
$req_data['limit_day'] = $val['limit_day'];
$req_data['start_date'] = $now_date;
$req_data['end_date'] = $end_date;
$req_data['reg_id'] = 'system';
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = 'system';
$req_data['update_date'] = $now_date;
$req_data['blind_setting_idx'] = $val['idx'];
$this->m_blind_limit->blind_limit_insert($req_data);
// 제제 완료 처리 update
$req_data = array();
$req_data['member_id'] = $val2['blind_id'];
$req_data['cnt'] = $val['limit_count'];
$this->m_blind->blind_group_by_count_update($req_data);
$req_data = array();
$req_data['limit_content'] = $val['limit_content'];
$req_data['limit_count'] = $val['limit_count'];
$req_data['member_email'] = $member_email;
$req_data['member_id'] = $val2['blind_id'];
$req_data['limit_type'] = $val['limit_type'];
$req_data['end_date'] = $end_date;
$req_data['member_name'] = $member_name;
$this->load->library('comm_admin');
$this->comm_admin->fn_blind_limit_proc($req_data);
}
}
}
$contents.= '['.date("Y-m-d H:i:s").'] blind_limit_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron02/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
}
?>

View File

@@ -0,0 +1,96 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* 그외 스케쥴
*/
class cron03 extends CI_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 티날씨 스케쥴
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function t_weather_proc() {
if (!is_dir('./logs/cron03/'.date("Ym"))) mkdir('./logs/cron03/'.date("Ym"), 0777, TRUE);
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] t_weather_proc start'.chr(10);
# t 날씨 가져오기
require_once ("./static_data/main_code.php");
$arr_public_weather = array();
foreach ($def_arr_position as $val) {
$latitude = $val['latitude'];
$longitude = $val['longitude'];
$url = 'https://apis.sktelecom.com/v1/weather/status?latitude='.$latitude.'&longitude='.$longitude;
$ch = curl_init(); //curl 사용 전 초기화 필수(curl handle)
curl_setopt($ch, CURLOPT_URL, $url); //URL 지정하기
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json', 'TDCProjectKey: 5cceabfc-f5a3-4a1c-a2c6-3e98e72c90bd')); //header 지정하기
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec ($ch);
if($response!='') {
$result = json_decode($response, true);
if(isset($result['weatherStatusCode'])==true){
switch ($result['weatherModifyCode']) {
case '0': $temperatures = '-'; break;
case '1': $temperatures = '한파'; break;
case '2': $temperatures = '추움'; break;
case '3': $temperatures = '쌀쌀'; break;
case '4': $temperatures = '포근'; break;
case '5': $temperatures = '따뜻'; break;
case '6': $temperatures = '선선'; break;
case '7': $temperatures = '더움'; break;
case '8': $temperatures = '폭염'; break;
default : $temperatures = ''; break;
}
if($result['weatherStatusDescription']=='알수없음') $result['weatherStatusDescription'] = '-';
$weather_img = '/img/web/pweather_icon_'.$result['weatherStatusCode'].'.png';
$arr_public_weather[] = array('location'=>$val['position_name'], 'weather_img'=>$weather_img, 'weather_status'=>$result['weatherStatusDescription'], 'temperatures'=>$temperatures);
}
}
curl_close($ch);
}
$now_date = date("Y-m-d H:i:s");
if(count($arr_public_weather) > 0) {
$this->load->model('admin/comm/m_t_weather');
$this->m_t_weather->t_weather_tuncate();
foreach ($arr_public_weather as $val) {
$req_data = array();
$req_data['location'] = $val['location'];
$req_data['weather_img'] = $val['weather_img'];
$req_data['weather_status'] = $val['weather_status'];
$req_data['temperatures'] = $val['temperatures'];
$req_data['reg_id'] = 'system';
$req_data['reg_date'] = $now_date;
$this->m_t_weather->t_weather_insert($req_data);
}
}
$contents.= '['.date("Y-m-d H:i:s").'] t_weather_proc end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron03/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
}
?>

View File

@@ -0,0 +1,146 @@
<?php
error_reporting(0);
ini_set('display_errors',0);
defined('BASEPATH') OR exit('No direct script access allowed');
//header("Content-Type: text/html; charset=UTF-8");
#include_once(APPPATH.'core/web/cm_exceptions.php');
class cron_cd extends CI_Controller{
var $tb_name = 'news_from_christiandaily'; // db table name
var $news_tb_name = 'news';
var $limit = 10; // max # of crawled article to migrate data into news table.
function get_file_name($fname) {
if(trim($fname)!='') {
$tmp = explode('/',$fname);
$fname = trim(array_pop($tmp));
return $fname;
}
}
/*
* cd article crawler from rss link
*/
function index() {
$rss_link = 'http://kr.christianitydaily.com/rss/articles/topnews/all.rss';
$rss = file_get_contents($rss_link);
if($rss==false) {
echo date("Y-m-d H:i:s")." can not crawl rss feed.\n";
exit;
}
$this->load->database();
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
$dom->loadXML($rss);
$i = 0;
$cnt = 0;
$fail_cnt = 0;
$ret = [];
while(is_object($row = $dom->getElementsByTagName('item')->item($i))) {
foreach($row->childNodes as $nodename) {
$retdate = date("Y-m-d H:i:s");
if($nodename->nodeName=='title') {
$ret[$i]['title'] = $nodename->nodeValue;
} else if($nodename->nodeName=='description') {
$ret[$i]['description'] = $nodename->nodeValue;
} else if($nodename->nodeName=='link') {
$ret[$i]['link'] = $nodename->nodeValue;
} else if($nodename->nodeName=='media:content') {
$ret[$i]['image'] = $nodename->getAttribute('url');
} else if($nodename->nodeName=='pubDate') {
$ret[$i]['pubdate'] = $nodename->nodeValue;
$regdate = strtotime($ret[$i]['pubdate']);
if($regdate>0) {
$regdate = date("Y-m-d H:i:s",$regdate);
}
}
}
//upload main image
$dest_file_name = '';
if($ret[$i]['image']!='') {
$upload_path = '/home/crossmap/files/news/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$fname = date("Ymd-His-").$this->get_file_name($ret[$i]['image']);
$dest_file_name = $upload_path.'/'.$fname;
if(file_put_contents($dest_file_name, file_get_contents($ret[$i]['image']))==false) {
echo "\nfile not restored\n";
$dest_file_name = '';
}
}
$dest_file_name = ($dest_file_name!='') ? str_replace('/home/crossmap','',$dest_file_name) : '';
$sql = "INSERT IGNORE INTO ".$this->tb_name." (".
"title, content, main_img, ".
"origin_url, regdate) VALUES (".
"'".addslashes($ret[$i]['title'])."', '".addslashes($ret[$i]['description'])."', '".$dest_file_name."', ".
"'".$ret[$i]['link']."', '$regdate')";
$return = $this->db->query($sql);
if($return==true) {
$cnt++;
} else {
$fail_cnt++;
}
$i++;
}
echo date("Y-m-d H:i:s").' / success : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
}
function migrate_cd_article_to_news() {
$this->load->database();
$ten_days_before = date("Y-m-d",(time()-(60*60*24*10))).' 00:00:00';
$sql = "SELECT idx, title, content, main_img, origin_url, regdate FROM ".$this->tb_name." ".
"WHERE registered_tf=0 AND crawldate>='$ten_days_before' ".
"ORDER BY idx ASC LIMIT ".$this->limit;
$query = $this->db->query($sql);
$cnt = 0;
$fail_cnt = 0;
foreach($query->result_array() as $row) {
if($row['main_img']!='') {
$row['content'] = nl2br(addslashes('<p style="line-height: 1.8;"><span style="font-family: 나눔고딕코딩, NanumGothicCoding, sans-serif; font-size: 9pt;"><img src="'.$row['main_img'].'" /></span></p><br style="clear:both;">'.$row['content']));
}
$sql = "INSERT INTO ".$this->news_tb_name." (".
"category_code, news_type, title, ".
"sub_title, main_img, press_idx, ".
"press_name, content, org_url, ".
"is_del, is_display) VALUES (".
"'12', 1, '".addslashes($row['title'])."', ".
"'".addslashes($row['title'])."', '".addslashes($row['main_img'])."', 30, ".
"'기독일보', '".addslashes($row['content'])."', '".$row['origin_url']."', ".
"'N', 'N')";
echo $sql."\n";
$ret = $this->db->query($sql);
if($ret==true) {
$idx = $row['idx'];
$sql = "UPDATE ".$this->tb_name." SET ".
"registered_tf=1 WHERE idx='$idx'";
$this->db->query($sql);
$cnt++;
}else{
$fail_cnt++;
//echo $sql."\n";
exit;
}
}
echo date("Y-m-d H:i:s").' / succeess : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
}
}
?>

View File

@@ -0,0 +1,148 @@
<?php
error_reporting(0);
ini_set('display_errors',0);
defined('BASEPATH') OR exit('No direct script access allowed');
//header("Content-Type: text/html; charset=UTF-8");
#include_once(APPPATH.'core/web/cm_exceptions.php');
class cron_cd_kr extends CI_Controller{
var $tb_name = 'news_from_christiandaily_kr'; // db table name
var $news_tb_name = 'news';
var $limit = 10; // max # of crawled article to migrate data into news table.
function get_file_name($fname) {
if(trim($fname)!='') {
$tmp = explode('/',$fname);
$fname = trim(array_pop($tmp));
return $fname;
}
}
/*
* cd article crawler from rss link
*/
function index() {
$rss_link = 'http://www.christiandaily.co.kr/rss/articles/topnews/all.rss';
$rss = file_get_contents($rss_link);
if($rss==false) {
echo date("Y-m-d H:i:s")." can not crawl rss feed.\n";
exit;
}
$this->load->database();
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
$dom->loadXML($rss);
$i = 0;
$cnt = 0;
$fail_cnt = 0;
$ret = [];
while(is_object($row = $dom->getElementsByTagName('item')->item($i))) {
foreach($row->childNodes as $nodename) {
$retdate = date("Y-m-d H:i:s");
if($nodename->nodeName=='title') {
$ret[$i]['title'] = $nodename->nodeValue;
} else if($nodename->nodeName=='description') {
$ret[$i]['description'] = $nodename->nodeValue;
} else if($nodename->nodeName=='link') {
$ret[$i]['link'] = $nodename->nodeValue;
} else if($nodename->nodeName=='media:content') {
$ret[$i]['image'] = $nodename->getAttribute('url');
} else if($nodename->nodeName=='pubDate') {
$ret[$i]['pubdate'] = $nodename->nodeValue;
$regdate = strtotime($ret[$i]['pubdate']);
if($regdate>0) {
$regdate = date("Y-m-d H:i:s",$regdate);
}
}
}
//upload main image
$dest_file_name = '';
if($ret[$i]['image']!='') {
$upload_path = '/home/crossmap/files/news/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$fname = date("Ymd-His-").$this->get_file_name($ret[$i]['image']);
$dest_file_name = $upload_path.'/'.$fname;
if(file_put_contents($dest_file_name, file_get_contents($ret[$i]['image']))==false) {
echo "\nfile not restored\n";
$dest_file_name = '';
}
}
$dest_file_name = ($dest_file_name!='') ? str_replace('/home/crossmap','',$dest_file_name) : '';
$sql = "INSERT IGNORE INTO ".$this->tb_name." (".
"title, content, main_img, ".
"origin_url, regdate) VALUES (".
"'".addslashes($ret[$i]['title'])."', '".addslashes($ret[$i]['description'])."', '".$dest_file_name."', ".
"'".$ret[$i]['link']."', '$regdate')";
$return = $this->db->query($sql);
if($return==true) {
$cnt++;
} else {
$fail_cnt++;
}
$i++;
}
echo date("Y-m-d H:i:s").' / success : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
}
function migrate_cd_article_to_news() {
$this->load->database();
$ten_days_before = date("Y-m-d",(time()-(60*60*24*10))).' 00:00:00';
$sql = "SELECT idx, title, content, main_img, origin_url, regdate FROM ".$this->tb_name." ".
"WHERE registered_tf=0 AND crawldate>='$ten_days_before' ".
"ORDER BY idx ASC LIMIT ".$this->limit;
$query = $this->db->query($sql);
$cnt = 0;
$fail_cnt = 0;
foreach($query->result_array() as $row) {
if($row['main_img']!='') {
$row['content'] = nl2br(addslashes('<p style="line-height: 1.8;"><span style="font-family: 나눔고딕코딩, NanumGothicCoding, sans-serif; font-size: 9pt;"><img src="'.$row['main_img'].'" /></span></p><br style="clear:both;">'.$row['content']));
}
$sql = "INSERT INTO ".$this->news_tb_name." (".
"category_code, news_type, title, ".
"sub_title, main_img, press_idx, ".
"press_name, content, org_url, ".
"is_del, is_display) VALUES (".
"'12', 1, '".addslashes($row['title'])."', ".
"'".addslashes($row['title'])."', '".addslashes($row['main_img'])."', 30, ".
"'기독일보', '".addslashes($row['content'])."', '".$row['origin_url']."', ".
"'N', 'N')";
echo $sql."\n";
$ret = $this->db->query($sql);
if($ret==true) {
$idx = $row['idx'];
$sql = "UPDATE ".$this->tb_name." SET ".
"registered_tf=1 WHERE idx='$idx'";
$this->db->query($sql);
$cnt++;
}else{
$fail_cnt++;
//echo $sql."\n";
exit;
}
}
echo date("Y-m-d H:i:s").' / succeess : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
}
}
?>

View File

@@ -0,0 +1,138 @@
<?php
error_reporting(0);
ini_set('display_errors',0);
defined('BASEPATH') OR exit('No direct script access allowed');
//header("Content-Type: text/html; charset=UTF-8");
#include_once(APPPATH.'core/web/cm_exceptions.php');
class cron_ct extends CI_Controller{
var $tb_name = 'news_from_christiantoday'; // db table name
var $news_tb_name = 'news';
var $limit = 10; // max # of crawled article to migrate data into news table.
function get_file_name($fname) {
if(trim($fname)!='') {
$tmp = explode('/',$fname);
$fname = trim(array_pop($tmp));
return $fname;
}
}
/*
* ct article crawler from rss link
*/
function index() {
$rss_link = 'http://www.christiantoday.co.kr/rss/articles/topnews/all.rss';
$rss = file_get_contents($rss_link);
if($rss==false) {
echo date("Y-m-d H:i:s")." can not crawl rss feed.\n";
exit;
}
$this->load->database();
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
$dom->loadXML($rss);
$i = 0;
$cnt = 0;
$fail_cnt = 0;
$ret = [];
while(is_object($row = $dom->getElementsByTagName('item')->item($i))) {
foreach($row->childNodes as $nodename) {
$retdate = date("Y-m-d H:i:s");
if($nodename->nodeName=='title') {
$ret[$i]['title'] = $nodename->nodeValue;
} else if($nodename->nodeName=='description') {
$ret[$i]['description'] = $nodename->nodeValue;
} else if($nodename->nodeName=='link') {
$ret[$i]['link'] = $nodename->nodeValue;
} else if($nodename->nodeName=='media:content') {
$ret[$i]['image'] = $nodename->getAttribute('url');
} else if($nodename->nodeName=='pubDate') {
$ret[$i]['pubdate'] = $nodename->nodeValue;
$regdate = strtotime($ret[$i]['pubdate']);
if($regdate>0) {
$regdate = date("Y-m-d H:i:s",$regdate);
}
}
}
// upload main image
$dest_file_name = '';
if($ret[$i]['image']!='') {
$upload_path = '/home/crossmap/files/news/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$fname = date("Ymd-His-").$this->get_file_name($ret[$i]['image']);
$dest_file_name = $upload_path.'/'.$fname;
if(file_put_contents($dest_file_name, file_get_contents($ret[$i]['image']))==false) {
echo "\nfile not restored\n";
$dest_file_name = '';
}
}
$dest_file_name = ($dest_file_name!='') ? str_replace('/home/crossmap','',$dest_file_name) : '';
$sql = "INSERT IGNORE INTO ".$this->tb_name." (".
"title, content, main_img, ".
"origin_url, regdate) VALUES (".
"'".addslashes($ret[$i]['title'])."', '".addslashes($ret[$i]['description'])."', '".$dest_file_name."', ".
"'".$ret[$i]['link']."', '$regdate')";
$return = $this->db->query($sql);
if($return==true) {
$cnt++;
} else {
$fail_cnt++;
}
$i++;
}
echo date("Y-m-d H:i:s").' / success : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
}
function migrate_ct_article_to_news() {
$this->load->database();
$ten_days_before = date("Y-m-d",(time()-(60*60*24*10))).' 00:00:00';
$sql = "SELECT idx, title, content, main_img, origin_url, regdate FROM ".$this->tb_name." ".
"WHERE registered_tf=0 AND crawldate>='$ten_days_before' ".
"ORDER BY idx ASC LIMIT ".$this->limit;
$query = $this->db->query($sql);
$cnt = 0;
$fail_cnt = 0;
foreach($query->result_array() as $row) {
if($row['main_img']!='') {
$row['content'] = nl2br(addslashes('<p style="line-height: 1.8;"><span style="font-family: 나눔고딕코딩, NanumGothicCoding, sans-serif; font-size: 9pt;"><img src="'.$row['main_img'].'" /></span></p><br style="clear:both;">'.$row['content']));
}
$sql = "INSERT INTO ".$this->news_tb_name." (".
"category_code, news_type, title, ".
"sub_title, main_img, press_idx, ".
"press_name, content, org_url, ".
"is_del, is_display) VALUES (".
"'12', 1, '".$row['title']."', ".
"'".$row['title']."', '".$row['main_img']."', 29, ".
"'크리스천투데이', '".$row['content']."', '".$row['origin_url']."', ".
"'N', 'N')";
//echo $sql."\n";
$ret = $this->db->query($sql);
if($ret==true) {
$idx = $row['idx'];
$sql = "UPDATE ".$this->tb_name." SET ".
"registered_tf=1 WHERE idx='$idx'";
$this->db->query($sql);
$cnt++;
}
else {
$fail_cnt++;
//echo $sql."\n";
exit;
}
}
echo date("Y-m-d H:i:s").' / succeess : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
}
}
?>

View File

@@ -0,0 +1,110 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class cron_ep_view_ranking extends CI_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 실시간 맵툰 에피소드 조회 순위 등록
# CREATE : 2019-03-26
# 실행주기 : 1시간
#---------------------------------------------------------------------------
function maptoon_view_rank_update() {
if (!is_dir('./logs/cron_mt_ep_ranking/'.date("Ym"))) mkdir('./logs/cron_mt_ep_ranking/'.date("Ym"), 0777, TRUE); //log file 생성
$contents = 'log description';
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] mt_ep_ranking_work start'.chr(10);
# model -create rank array
$this->load->database();
$num=0;
$_time=1;
$result;
while($num==0){
$result=$this->db->query("SELECT * FROM mt_ep_hit_log WHERE reg_date>=\"".date("Y-m-d H:i:s",strtotime ("-$_time hours"))."\" Order by ep_idx");
$num=$result->num_rows();
$_time++;
}
$row=$result->result_array();
$rank_list=array();
$y=0;
$ep_idx=0;
foreach($row as $val){
if($ep_idx!=$val['ep_idx']){
$ep_idx=$val['ep_idx'];
$y=0;
}
array_push($rank_list,$ep_idx);
}
$rank_list=array_count_values($rank_list);
arsort($rank_list); //ep_idx view count sort
$ep_idx_rank_list=array_keys($rank_list); // only ep_idx array;
$insert_date=array();
$rank=1;//순위
foreach($ep_idx_rank_list as $val){
array_push($insert_date,array('ep_idx'=>$val,'rank'=>$rank));
$rank++;
}
if(count($ep_idx_rank_list)<10){
$result=$this->db->query("SELECT * FROM mt_episodes ORDER BY reg_date DESC limit 10");
$row = $result->result_array();
foreach($row as $val){
$is_same=false;
foreach($ep_idx_rank_list as $val2){
if($val['idx']==$val2){
$is_same=true;
}
}
if(!$is_same){ array_push($insert_date,array('ep_idx'=>$val['idx'],'rank'=>$rank)); $rank++;}
if(count($insert_date)==10){break;}
}
};
print_r($row);
# insert_data;
$this->db->insert_batch("mt_ep_view_rank",$insert_date);
$contents.= date("Y-m-d H:i:s",strtotime ("-$_time hours")).' 업데이트 완료'.chr(10);
$contents.= '['.date("Y-m-d H:i:s").'] episode veiw count ranking end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron_mt_ep_ranking/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 예약 조회 후 업데이트
# CREATE : 2019-04-09
# 실행주기 : 매분
#---------------------------------------------------------------------------
function epsiode_reservation(){
if (!is_dir('./logs/cron_maptoon/'.date("Ym"))) mkdir('./logs/cron_maptoon/'.date("Ym"), 0777, TRUE); //log file 생성
$contents = 'log description';
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] reservation_article_display_update start'.chr(10);
$this->load->model('maptoon/m_maptoon');
$result = $this->m_maptoon->get_epsiodes_reservation_list();
if(count($result)>0){
$num =$this->m_maptoon->episodes_is_display_update_batch($result);
}
$num>0?$contents.= $content_type.$num.'개 업데이트-----------------------------------------------------------------------------'.chr(10):$contents.= $content_type.'-----------------------------------------------------------------------------'.chr(10);
ob_flush();
flush();
sleep(1);
$contents.= '['.date("Y-m-d H:i:s").'] reservation_article_display_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron_maptoon/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
}
?>

View File

@@ -0,0 +1,89 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* 맵툰 스케줄 1시간 마다 실행 됨
*/
class cron_ep_view_ranking extends CI_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 실시간 맵툰 에피소드 조회 순위 등록
# CREATE : 2019-03-26
#---------------------------------------------------------------------------
// function maptoon_view_rank_update() {
function index() {
if (!is_dir('./logs/cron_mt_ep_ranking/'.date("Ym"))) mkdir('./logs/cron_mt_ep_ranking/'.date("Ym"), 0777, TRUE); //log file 생성
$contents = 'log description';
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] mt_ep_ranking_work start'.chr(10);
# model -create rank array
$this->load->database();
$num=0;
$_time=1;
$result;
while($num==0){
$result=$this->db->query("SELECT * FROM mt_ep_hit_log WHERE reg_date>=\"".date("Y-m-d H:i:s",strtotime ("-$_time hours"))."\" Order by ep_idx");
$num=$result->num_rows();
$_time++;
}
$row=$result->result_array();
$rank_list=array();
$y=0;
$ep_idx=0;
foreach($row as $val){
if($ep_idx!=$val['ep_idx']){
$ep_idx=$val['ep_idx'];
$y=0;
}
array_push($rank_list,$ep_idx);
}
$rank_list=array_count_values($rank_list);
arsort($rank_list); //ep_idx view count sort
$ep_idx_rank_list=array_keys($rank_list); // only ep_idx array;
$insert_date=array();
$rank=1;//순위
foreach($ep_idx_rank_list as $val){
array_push($insert_date,array('ep_idx'=>$val,'rank'=>$rank));
$rank++;
}
if(count($ep_idx_rank_list)<10){
$result=$this->db->query("SELECT * FROM mt_episodes ORDER BY reg_date DESC limit 10");
$row = $result->result_array();
foreach($row as $val){
$is_same=false;
foreach($ep_idx_rank_list as $val2){
if($val['idx']==$val2){
$is_same=true;
}
}
if(!$is_same){ array_push($insert_date,array('ep_idx'=>$val['idx'],'rank'=>$rank)); $rank++;}
if(count($insert_date)==10){break;}
}
};
print_r($row);
# insert_data;
$this->db->insert_batch("mt_ep_view_rank",$insert_date);
$contents.= date("Y-m-d H:i:s",strtotime ("-$_time hours")).' 업데이트 완료'.chr(10);
$contents.= '['.date("Y-m-d H:i:s").'] episode veiw count ranking end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron_mt_ep_ranking/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
function epsiode_reservation(){
$this->load->model('maptoon/m_maptoon');
$result = $this->m_maptoon->get_epsiode_reservation_list();
print_r($result);
}
}
?>

View File

@@ -0,0 +1,157 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class cron_maptoon extends CI_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 실시간 맵툰 에피소드 조회 순위 등록
# CREATE : 2019-03-26
# 실행주기 : 1시간
#---------------------------------------------------------------------------
function maptoon_view_rank_update() {
if (!is_dir('./logs/cron_mt_ep_ranking/'.date("Ym"))) mkdir('./logs/cron_mt_ep_ranking/'.date("Ym"), 0777, TRUE); //log file 생성
$contents = 'log description';
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] mt_ep_ranking_work start'.chr(10);
# model -create rank array
$this->load->database();
$num=0;
$_time=1;
$result;
while($num==0){
$result=$this->db->query("SELECT * FROM mt_ep_hit_log WHERE reg_date>=\"".date("Y-m-d H:i:s",strtotime ("-$_time hours"))."\" Order by ep_idx");
$num=$result->num_rows();
$_time++;
}
$row=$result->result_array();
$rank_list=array();
$y=0;
$ep_idx=0;
foreach($row as $val){
if($ep_idx!=$val['ep_idx']){
$ep_idx=$val['ep_idx'];
$y=0;
}
array_push($rank_list,$ep_idx);
}
$rank_list=array_count_values($rank_list);
arsort($rank_list); //ep_idx view count sort
$ep_idx_rank_list=array_keys($rank_list); // only ep_idx array;
$insert_date=array();
$rank=1;//순위
foreach($ep_idx_rank_list as $val){
array_push($insert_date,array('ep_idx'=>$val,'rank'=>$rank));
$rank++;
}
if(count($ep_idx_rank_list)<10){
$result=$this->db->query("SELECT * FROM mt_episodes ORDER BY reg_date DESC limit 10");
$row = $result->result_array();
foreach($row as $val){
$is_same=false;
foreach($ep_idx_rank_list as $val2){
if($val['idx']==$val2){
$is_same=true;
}
}
if(!$is_same){ array_push($insert_date,array('ep_idx'=>$val['idx'],'rank'=>$rank)); $rank++;}
if(count($insert_date)==10){break;}
}
};
print_r($row);
# insert_data;
$this->db->insert_batch("mt_ep_view_rank",$insert_date);
$contents.= date("Y-m-d H:i:s",strtotime ("-$_time hours")).' 업데이트 완료'.chr(10);
$contents.= '['.date("Y-m-d H:i:s").'] episode veiw count ranking end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron_mt_ep_ranking/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
#---------------------------------------------------------------------------
# PURPOSE : 예약 조회 후 업데이트
# CREATE : 2019-04-09
# 실행주기 : 매분
#---------------------------------------------------------------------------
function episode_reservation_update(){
if (!is_dir('./logs/cron_maptoon/'.date("Ym"))) mkdir('./logs/cron_maptoon/'.date("Ym"), 0777, TRUE); //log file 생성
$contents = 'log description';
# file helper
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] reservation_article_display_update start'.chr(10);
$num=0;
$this->load->model('maptoon/m_maptoon');
$result = $this->m_maptoon->get_epsiodes_reservation_list();
if(count($result)>0){
$num =$this->m_maptoon->episodes_is_display_update_batch($result);
}
$num>0?$contents.= $num.'개 업데이트-----------------------------------------------------------------------------'.chr(10):$contents.= '-----------------------------------------------------------------------------'.chr(10);
ob_flush();
flush();
sleep(1);
$contents.= '['.date("Y-m-d H:i:s").'] reservation_article_display_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron_maptoon/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
}
public function episode_in_category_update_caching() {
ini_set('display_errors', 1);
error_reporting(E_ALL);
if (!is_dir('./logs/cron_maptoon/'.date("Ym"))) mkdir('./logs/cron_maptoon/'.date("Ym"), 0777, TRUE); //log file 생성
$contents = 'log description';
$this->load->helper('file');
$contents = '['.date("Y-m-d H:i:s").'] episode_in_category_update_caching start'.chr(10);
$this->load->database();
$query = "SELECT idx,mt_episodes_idx FROM mt_categories";
$result = $this->db->query($query);
foreach ($result->result_array() as $row){
$episodes_idx = explode(",",$row['mt_episodes_idx']);
$str = $row['mt_episodes_idx'];
$idx = $row['idx'];
$len = count($episodes_idx);
if(is_array($episodes_idx)==TRUE && is_numeric($idx)==TRUE
&& $idx>0 && $len>0) {
$this->load->model('maptoon/m_maptoon');
$ret = $this->m_maptoon->update_episodes_by_category($idx,$str);
$this->config->load('filecache',TRUE);
$file_cache_path = $this->config->item('file_cache_path','filecache');
$params = array('file_cache_path'=>$file_cache_path);
$this->load->library('maptoon_lib',$params);
// get episode data to write cache
$json_data = $this->m_maptoon->get_widget_info_by_episode_idx($episodes_idx,'json');
if($json_data!=FALSE) {
if($this->maptoon_lib->write_category_cache($idx,$json_data)) {
$contents.=$idx.'번 카테고리내 에피소드 등록이 완료되었습니다.'.chr(10);
}else {
$contents.=$idx.'번 카테고리내 에피소드 등록이 실패습니다.'.chr(10);
}
}
}
}
$contents.= '['.date("Y-m-d H:i:s").'] episode_in_category_update_caching end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron_maptoon/'.date("Ym").'/caching'.date("Ymd").'.php', $contents, 'a+');
}
}
?>

View File

@@ -0,0 +1,89 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* 컨텐츠관련 스케쥴
*/
class cron_test extends CI_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 실시간 조회 순위 등록
# CREATE : 2019-03-26
#---------------------------------------------------------------------------
// function maptoon_view_rank_update() {
function index() {
// if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE); //log file 생성
// $contents = log description
# file helper
// $this->load->helper('file');
// $contents = '['.date("Y-m-d H:i:s").'] press_article_count_update start'.chr(10);
# model -create rank array
$this->load->database();
$num=0;
$_time=1;
$result;
while($num==0){
$result=$this->db->query("SELECT * FROM mt_ep_hit_log WHERE reg_date>=\"".date("Y-m-d H:i:s",strtotime ("-$_time hours"))."\" Order by ep_idx");
$num=$result->num_rows();
$_time++;
}
$row=$result->result_array();
$rank_list=array();
$y=0;
$ep_idx=0;
foreach($row as $val){
if($ep_idx!=$val['ep_idx']){
$ep_idx=$val['ep_idx'];
$y=0;
}
array_push($rank_list,$ep_idx);
}
$rank_list=array_count_values($rank_list);
arsort($rank_list); //ep_idx view count sort
$ep_idx_rank_list=array_keys($rank_list); // only ep_idx array;
$insert_date=array();
$rank=1;//순위
foreach($ep_idx_rank_list as $val){
array_push($insert_date,array('ep_idx'=>$val,'rank'=>$rank));
$rank++;
}
if(count($ep_idx_rank_list)<10){
$result=$this->db->query("SELECT * FROM mt_episodes ORDER BY reg_date DESC limit 10");
$row = $result->result_array();
foreach($row as $val){
$is_same=false;
foreach($ep_idx_rank_list as $val2){
if($val['idx']==$val2){
$is_same=true;
}
}
if(!$is_same){ array_push($insert_date,array('ep_idx'=>$val['idx'],'rank'=>$rank)); $rank++;}
if(count($insert_date)==10){break;}
}
};
# insert_data;
$this->db->insert_batch("mt_ep_view_rank",$insert_date);
/*
# model - press update
$this->load->model('admin/etc_section/m_press');
$result2 = $this->m_press->press_article_count_update($result1);
$contents.= $result2.'개 업데이트 완료'.chr(10);
$contents.= '['.date("Y-m-d H:i:s").'] press_article_count_update end'.chr(10);
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
*/
}
}
?>

View File

@@ -0,0 +1,427 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include_once (APPPATH.'core/admin/cm_controller.php');
class maptoon extends cm_controller {
var $tb_name_category = 'mt_categories';
var $tb_name_episode = 'mt_episodes';
var $tb_name_maptoon_list = 'mt_list';
var $tb_name_notice = 'mt_notices';
var $tb_name_cartoonist = 'mt_cartoonists';
var $total_count = 20; // total # of list
var $list_limit = 10; // total # of pages
function __construct() {
parent::__construct();
$this->load->library('util');
}
/*
@desc : list all the maptoon categories
*/
public function fn_category() {
$idx = $this->input->get('idx');
$this->load->database();
if(is_numeric($idx)==TRUE && $idx>0) {
$query = $this->db->get_where($this->tb_name_category,['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_category);
$i = 0;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['list'][$i] = $row;
$i++;
}
return $this->load->view('/admin/maptoon/category_list', $return_data, true);
}
}
/*
@desc : register category
*/
public function fn_category_proc() {
$c_name = $this->input->post('c_name');
$mode = $this->input->post('mode');
$idx = $this->input->post('idx');
$c_name = trim($c_name);
if($c_name!='') {
if($mode=='upt') {
if(is_numeric($idx)==TRUE && $idx>0) {
$data = ['c_name'=>$c_name];
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_category, $data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data = ['c_name' => $c_name];
$ret = $this->db->insert($this->tb_name_category,$data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
} else {
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
}
exit;
}
public function fn_category_detail($idx) {
if(is_numeric($idx)==TRUE && $idx>0) {
$return_data = ['c_name' => ''];
$this->load->model('admin/maptoon/m_maptoon');
$data_category = $this->m_maptoon->get_category($idx);
if($data_category!=FALSE && isset($data_category['c_name'])==TRUE) {
$return_data['c_name'] = $data_category['c_name'];
}
// get episodes in chosen category
$data_episodes = $this->m_maptoon->get_episodes_by_category($idx);
if($data_episodes!=FALSE) {
$return_data['data'] = $data_episodes;
} else {
$return_data['data'] = '';
}
return $this->load->view('/admin/maptoon/category_detail', $return_data, true);
} else {
$this->util->js_alert_back('잘못된 접근입니다.'); exit;
}
}
/*
title: get list of maptoon episodes
*/
public function fn_get_episodes($str) {
$str = trim($str);
if($str!='') {
}
}
/*
@desc : delete category
*/
public function fn_category_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_category);
if($ret==TRUE) {
$this->db->where('mt_categories_idx',$idx);
$data = ['mt_categories_idx' => 0];
$ret = $this->db->update($this->tb_name_episode,$data);
//echo $this->db->last_query();
$this->util->js_alert_parent_reload('삭제되었습니다.');
}
} else {
$this->util->js_alert('키값이 전달되지 않았습니다.');
}
exit;
}
/*
@desc : list all maptoons
*/
public function fn_maptoon_list() {
$page = $this->input->get('page',TRUE);
$this->load->model('admin/maptoon/m_maptoon');
$query_string = ['status'=>1, 'mt_cartoonists_idx'=>1];
$data = $this->m_maptoon->get_maptoon_list($query_string);
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# pagination
$req_data = array();
$req_data['total_count'] = $this->total_count;
$req_data['limit'] = $this->list_limit;
$req_data['base_url'] = '/admin/maptoon/maptoon_list/10/' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
$return_data['list'] = $result = array();
return $this->load->view('/admin/maptoon/list', $return_data, true);
}
public function fn_maptoon_detail() {
$idx = $this->input->get('idx');
$this->load->model('/admin/maptoon/m_maptoon');
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
$return_data['cartoonist'] = $arr_cartoonist;
if(is_numeric($idx)==TRUE && $idx>0) {
} else {
$return_data['data'] = [];
}
return $this->load->view('/admin/maptoon/maptoon_detail', $return_data, true);
}
/*
@desc : register maptoon
*/
public function fn_maptoon_proc() {
$idx = $this->input->post('idx');
$mode = $this->input->post('mode');
$mt_cartoonists_idx = $this->input->post('mt_cartoonists_idx'); //
$name = $this->input->post('name'); //
$status = $this->input->post('status');
$date_sun = $this->input->post('date_sun');
$date_mon = $this->input->post('date_mon');
$date_tue = $this->input->post('date_tue');
$date_wed = $this->input->post('date_wed');
$date_thu = $this->input->post('date_thu');
$date_fri = $this->input->post('date_fri');
$date_sat = $this->input->post('date_sat');
$description = $this->input->post('mode');
if($name=='') {
$this->util->js_alert_back('맵툰명을 입력해주십시오'); exit;
}
if($mt_cartoonists_idx=='') {
$this->util->js_alert_back('맵툰작가를 입력해주십시오'); exit;
}
//이미지 업로드
if($_FILES['main_img']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
} else {
$img_data = '';
}
if(is_numeric($idx)==TRUE && $idx>0) { // update data
echo 'asdf'; exit;
} else { // insert data
$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"),
'mt_cartoonists_idx' => $mt_cartoonists_idx];
$this->load->model('admin/maptoon/m_maptoon');
$ret = $this->m_maptoon->insert_maptoon($data);
if($ret==TRUE) {
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/list');exit;
} else {
$this->util->js_alert_back('등록되지 않았습니다. 다시 시도해 주세요');exit;
}
}
}
/*
@desc : delete maptoon
*/
public function fn_maptoon_del_proc() {
}
/*
@desc : show list of maptoon episodes
*/
public function fn_episode() {
$return_data['list'] = $result = array();
return $this->load->view('/admin/maptoon/episode_list', $return_data, true);
}
/*
@desc : register maptoon episode
*/
public function fn_episode_reg_proc() {
}
/*
@desc : update maptoon episode
*/
public function fn_episode_upd_proc() {
}
/*
@desc : delete maptoon episode
*/
public function fn_episode_del_proc() {
}
/*
@desc : show list of maptoon announcement
@param: numeric; idx of announcement table
*/
public function fn_announcement() {
$idx = $this->input->get('idx');
if(is_numeric($idx)==TRUE && $idx>0) { // show one of announcement by idx; called by ajax
} else { // show list of announcement
}
}
/*
@desc : register announcement
*/
public function fn_announcement_reg_proc() {
}
/*
@desc : update maptoon announcement
*/
public function fn_announcement_upd_proc() {
}
/*
@desc : delete maptoon announcement
*/
public function fn_announcement_del_proc() {
}
/*
@desc : list all cartoonists
*/
public function fn_cartoonist() {
$idx = $this->input->get('idx');
$this->load->database();
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;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['list'][$i] = $row;
$i++;
}
return $this->load->view('/admin/maptoon/cartoonist', $return_data, true);
}
}
/*
@desc : register & modify cartoonist info
*/
public function fn_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($mode=='upt') {
if(is_numeric($idx)==TRUE && $idx>0) {
$data = ['name' => $name,
'website' => $website];
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_cartoonist, $data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data = ['name' => $name,
'website' => $website];
$ret = $this->db->insert($this->tb_name_cartoonist,$data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
} else {
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
}
exit;
}
/*
@desc : delete cartoonist info
*/
public function fn_cartoonist_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_cartoonist);
if($ret==TRUE) {
$this->db->where('mt_cartoonists_idx',$idx);
$data = ['mt_cartoonists_idx' => 0];
$ret = $this->db->update($this->tb_name_maptoon_list,$data);
//echo $this->db->last_query();
$this->util->js_alert_parent_reload('삭제되었습니다.');
}
} else {
$this->util->js_alert('키값이 전달되지 않았습니다.');
}
exit;
}
}

View File

@@ -0,0 +1,825 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include_once (APPPATH.'core/admin/cm_controller.php');
class maptoon extends cm_controller {
var $tb_name_category = 'mt_categories';
var $tb_name_episode = 'mt_episodes';
var $tb_name_maptoon_list = 'mt_list';
var $tb_name_notice = 'mt_notices';
var $tb_name_cartoonist = 'mt_cartoonists';
var $total_count = 20; // total # of list
var $list_limit = 10; // total # of pages
function __construct() {
parent::__construct();
$this->load->library('util');
}
/*
@desc : list all the maptoon categories
*/
public function fn_category() {
$idx = $this->input->get('idx');
$this->load->database();
if(is_numeric($idx)==TRUE && $idx>0) {
$query = $this->db->get_where($this->tb_name_category,['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_category);
$i = 0;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['list'][$i] = $row;
$i++;
}
return $this->load->view('/admin/maptoon/category_list', $return_data, true);
}
}
/*
@desc : register category
*/
public function fn_category_proc() {
$c_name = $this->input->post('c_name');
$mode = $this->input->post('mode');
$idx = $this->input->post('idx');
$c_name = trim($c_name);
if($c_name=='') {
$this->util->js_alert('카테고리 이름을 입력해 주십시오'); exit;
}
if($mode=='upt') {
if(is_numeric($idx)==TRUE && $idx>0) {
$data = ['c_name'=>$c_name];
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_category, $data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data = ['c_name' => $c_name];
$ret = $this->db->insert($this->tb_name_category,$data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
exit;
}
public function fn_register_episode_in_category() {
$episodes_idx = $this->input->post('episodes_idx');
$idx = $this->input->post('idx');
$len = count($episodes_idx);
if(is_array($episodes_idx)==TRUE && is_numeric($idx)==TRUE
&& $idx>0 && $len>0) {
$str = implode(',',$episodes_idx);
$this->load->model('maptoon/m_maptoon');
$ret = $this->m_maptoon->update_episodes_by_category($idx,$str);
$this->config->load('filecache',TRUE);
$file_cache_path = $this->config->item('file_cache_path','filecache');
$params = array('file_cache_path'=>$file_cache_path);
$this->load->library('maptoon_lib',$params);
// get episode data to write cache
$json_data = $this->m_maptoon->get_widget_info_by_episode_idx($episodes_idx,'json');
if($json_data!=FALSE) {
$this->maptoon_lib->write_category_cache($idx,$json_data);
}
}
$this->util->js_alert_go('카테고리내 에피소드 등록이 완료되었습니다.','/admin/maptoon/category/10');
}
public function fn_category_detail() {
$idx = $this->input->get('idx');
$search_keyword = $this->input->get('search_keyword');
if(is_numeric($idx)==FALSE || $idx<=0) {
$this->util->js_alert_back('잘못된 접근입니다.'); exit;
}
// get maptoon list in chosen category
$this->load->model('maptoon/m_maptoon');
$return_data = ['c_name' => ''];
$data_category = $this->m_maptoon->get_category($idx);
if($data_category!=FALSE && isset($data_category['c_name'])==TRUE) {
$return_data['c_name'] = $data_category['c_name'];
}
if($data_category['mt_episodes_idx']=='') {// get episodes from episode category
$data_episodes = $this->m_maptoon->get_episodes_by_category($idx);
} else { // get episodes in chosen category
$data_episodes = $this->m_maptoon->get_episodes_by_category($data_category['mt_episodes_idx']);
}
if($data_episodes!=FALSE) {
$return_data['list'] = $data_episodes;
} else {
$return_data['list'] = '';
}
$return_data['idx'] = $idx;
return $this->load->view('/admin/maptoon/category_detail', $return_data, true);
}
/*
@desc : delete category
*/
public function fn_category_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_category);
if($ret==TRUE) {
$this->db->where('mt_categories_idx',$idx);
$data = ['mt_categories_idx' => 0];
$ret = $this->db->update($this->tb_name_episode,$data);
//echo $this->db->last_query();
$this->util->js_alert_parent_reload('삭제되었습니다.');
}
} else {
$this->util->js_alert('키값이 전달되지 않았습니다.');
}
exit;
}
/*
get list of maptoon episodes
@return json string
*/
public function fn_get_episodes_by_search_keyword() {
$keyword = $this->input->get('keyword');
if($keyword!='') {
$this->load->model('maptoon/m_maptoon');
$row = $this->m_maptoon->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;
}
}
/*
@desc : list all maptoons
*/
public function fn_maptoon_list() {
$page = $this->input->get('page',TRUE);
$this->load->model('maptoon/m_maptoon');
//$query_string = ['status'=>1, 'mt_cartoonists_idx'=>1];
$query_string = [];
$data = $this->m_maptoon->get_maptoon_list($query_string);
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# pagination
$req_data = array();
$req_data['total_count'] = $this->total_count;
$req_data['limit'] = $this->list_limit;
$req_data['base_url'] = '/admin/maptoon/maptoon_list/10/' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
$return_data = $req_data;
for($i=0; $i<count($data); $i++) {
$data[$i]['num_of_episodes'] = $this->m_maptoon->get_num_of_episodes($data[$i]['idx']);
}
$return_data['list'] = $data;
$return_data['page'] = $page;
$return_data['cartoonist'] = $arr_cartoonist;
return $this->load->view('/admin/maptoon/list', $return_data, true);
}
public function fn_maptoon_list_del() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
//1.check num of episode in maptoon
$this->load->model('maptoon/m_maptoon');
$num = $this->m_maptoon->get_num_of_episodes($idx);
$num_of_announcement = $this->m_maptoon->get_num_of_announcement_by_maptoon($idx);
if($num>0) {
$ret = ['result'=>"이미 등록되어 있는 에피소드가 있어서 삭제가 불가능합니다.\n해당 에피소드 삭제후 웹툰 삭제가 가능합니다."];
echo json_encode($ret); exit;
}
if($num_of_announcement>0) {
$ret = ['result'=>"이미 웹툰에 등록되어 있는 공지사항이 있어서 삭제가 불가능합니다.\n해당 공지사항 삭제후 웹툰 삭제가 가능합니다."];
echo json_encode($ret); exit;
}
$result = $this->m_maptoon->delete_maptoon($idx);
$ret = ['result'=>$result];
if($result==TRUE) {
$ret = ['result'=>'success'];
} else {
$ret = ['result'=>'DB error, 개발자에게 문의 바랍니다.'];
}
} else {
$ret = ['result'=>'wrong parameter'];
}
exit;
}
public function fn_maptoon_detail() {
$idx = $this->input->get('idx');
$this->load->model('maptoon/m_maptoon');
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
$return_data['cartoonist'] = $arr_cartoonist;
if(is_numeric($idx)==TRUE && $idx>0) {
$num_of_episodes = $this->m_maptoon->get_num_of_episodes($idx);
$return_data['num_of_episodes'] = $num_of_episodes;
$row = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
if(isset($row[0])==TRUE) {
$return_data['data'] = $row[0];
}
$return_data['maptoon_idx'] = $idx;
} else {
$return_data['data'] = [];
}
return $this->load->view('/admin/maptoon/maptoon_detail', $return_data, true);
}
/*
@desc : register maptoon
*/
public function fn_maptoon_proc() {
$idx = $this->input->post('idx');
$mode = $this->input->post('mode');
$mt_cartoonists_idx = $this->input->post('mt_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($mt_cartoonists_idx=='') {
$this->util->js_alert_back('맵툰작가를 입력해주십시오'); exit;
}
$this->load->model('maptoon/m_maptoon');
$maptoon_info = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
//이미지 업로드
if($_FILES['main_img']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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) ? MAPTOON_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"),
'mt_cartoonists_idx' => $mt_cartoonists_idx];
if(is_numeric($idx)==TRUE && $idx>0) { // update data
$ret = $this->m_maptoon->update_maptoon($idx, $data);
if($ret==TRUE) {
$this->util->js_alert_go('수정되었습니다','/admin/maptoon/maptoon_list/10');exit;
} else {
$this->util->js_alert_back('수정되지 않았습니다. 다시 시도해 주세요');exit;
}
} else { // insert data
$ret = $this->m_maptoon->insert_maptoon($data);
if($ret==TRUE) {
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/maptoon_list/10');exit;
} else {
$this->util->js_alert_back('등록되지 않았습니다. 다시 시도해 주세요');exit;
}
}
}
/*
@desc : delete maptoon
*/
public function fn_maptoon_del_proc() {
}
/*
@desc : show list of maptoon episodes
*/
public function fn_episode() {
$return_data['list'] = $result = array();
$this->load->model('maptoon/m_maptoon');
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list(); //작가 이름
$arr_mt_title = $this->m_maptoon->get_mt_title(); //맵툰 이름 리스트
$cartoonist_list=array();
foreach($arr_cartoonist as $val){
$cartoonist_list[$val['idx']]=$val['name'];
}
$query = $this->db->get($this->tb_name_category);
$arr_category = $query->result_array(); //카테고리 리스트
$category_list=array();
foreach($arr_category as $val){
$category_list[$val['idx']]=$val['c_name'];
}
$page = $this->input->get('page',TRUE);
$query_string = $_SERVER['QUERY_STRING'];
parse_str($query_string);
if(isset($author)) $arr_cartoonist_idx = $this->m_maptoon->get_cartoonist_idx_by_name(urldecode($author));
# 검색
$req_data = array();
isset($sort_list)? $req_data['sort_list']=$sort_list :$req_data['sort_list']=""; // 최신 조회
isset($date_reg)? $req_data['date_reg']=$date_reg :$req_data['date_reg']=""; // 등록 날짜별
isset($ca)? $req_data['category']=$ca :$req_data['category']=""; // 카테고리
isset($sdate)? $req_data['sdate']=$sdate :$req_data['sdate']=""; // 시작일
isset($edate)? $req_data['edate']=$edate :$req_data['edate']=""; // 종료일
isset($mt_name)? $req_data['mt_name']= urldecode($mt_name) :$req_data['mt_name']=""; // 맵툰 이름
isset($ep_title)? $req_data['ep_title']= urldecode($ep_title) :$req_data['ep_title']=""; // 맵툰 제목
isset($arr_cartoonist_idx)? $req_data['author']= $arr_cartoonist_idx :$req_data['author']=""; // 작가 번호
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
//list 가져오기
$data = $this->m_maptoon->get_episode_list($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $this->total_count;
$req_data['limit'] = $this->list_limit;
$req_data['base_url'] = '/admin/maptoon/episode/10/' ;
$req_data['suffix'] = '?'.$query_string;
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
$return_data = $req_data;
$return_data['list'] = $data;
$return_data['page'] = $page;
$return_data['pagination' ] = $pagination;
$return_data['cartoonist'] = $arr_cartoonist; // 작가 이름
$return_data['cartoonist_list'] = $cartoonist_list; // 작가 이름2
$return_data['mt_title' ] = $arr_mt_title; // 맵툰 이름
$return_data['category'] = $arr_category; // 카테고리 리스트
$return_data['category_list'] = $category_list; // 카테고리 리스트2
return $this->load->view('/admin/maptoon/episode_list', $return_data, true);
}
/*
@desc : register form for maptoon episode
*/
public function fn_episode_reg() {
$this->load->model('maptoon/m_maptoon');
$return_data['cartoonist'] = $this->m_maptoon->get_cartoonist_list();
$return_data['mt_title' ] = $this->m_maptoon->get_mt_title();
if(empty($this->input->post('idx')==FALSE)){
$idx= $this->input->post('idx');
$query = $this->db->get_where($this->tb_name_episode,['idx'=>$idx]);
$row = $query->row_array();
$return_data['modify_data'] = $row;
}
$query = $this->db->get($this->tb_name_category);
$arr_category = $query->result_array();
$return_data['category']=$arr_category;
return $this->load->view('/admin/maptoon/episode_reg', $return_data, true);
}
/*
@desc : register maptoon episode
*/
public function fn_episode_reg_proc() {
echo $this->input->get_post("idx");
var_dump($_FILES);
exit;
$mode = $this->input->get_post("mode");// edit 이면 수정
$idx = $this->input->get_post("idx"); // 수정시 사용
$this->input->get_post("mt_categories_idx")!="n"?$mt_categories_idx = $this->input->get_post("mt_categories_idx"):$mt_categories_idx=null;
$mt_list_idx = $this->input->get_post("mt_list_idx");
$title = $this->input->get_post("title");
$display_date = $this->input->get_post("display_date");
$is_display = $this->input->get_post("is_display"); //0: NO 1:YES
$ep_no = $this->input->get_post("ep_no");
//메인이미지 업로드
$main_img = '';
if(isset($_FILES['main_img']['name'])) {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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();
$main_img = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
}
//맵툰이미지 업로드
$data = array();
$filesCount = count($_FILES['webtoon_images']['name']);
$webtoon_images = '';
if($filesCount>0 && $_FILES['webtoon_images']['name']!=''){
for($i =0; $i<$filesCount;$i++){
$_FILES['webtoon_images'.$i]['name'] = $_FILES['webtoon_images']['name'][$i];
$_FILES['webtoon_images'.$i]['type'] = $_FILES['webtoon_images']['type'][$i];
$_FILES['webtoon_images'.$i]['tmp_name'] = $_FILES['webtoon_images']['tmp_name'][$i];
$_FILES['webtoon_images'.$i]['error'] = $_FILES['webtoon_images']['error'][$i];
$_FILES['webtoon_images'.$i]['size'] = $_FILES['webtoon_images']['size'][$i];
//이미지 업로드
if($_FILES['webtoon_images'.$i]['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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= 'webtoon_images'.$i.date("H").date("i").date("s");
if ( ! $this->upload->do_upload('webtoon_images'.$i)) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다1.", 'back');
}
$arr_upload_data = $this->upload->data();
$webtoon_images[$i] = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
}
}
}
if($mode!="edit"){
$data=[
'mt_categories_idx' => $mt_categories_idx,
'mt_list_idx' => $mt_list_idx,
'title' => $title,
'main_img' => $main_img,
'display_date' => $display_date,
'is_display' => $is_display,
'ep_no' => $ep_no,
'webtoon_images' => json_encode($webtoon_images),
'reg_date' => date("Y-m-d H:i:s")
];
$ret = $this->db->insert($this->tb_name_episode,$data);
if($ret==TRUE) {
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/episode/10');exit;
} else {
$this->util->js_alert('DB error');
}
}else if($mode=="edit"){
$data=[
'mt_categories_idx' => $mt_categories_idx,
'mt_list_idx' => $mt_list_idx,
'title' => $title,
'display_date' => $display_date,
'ep_no' => $ep_no,
'is_display' => $is_display,
'reg_date' => date("Y-m-d H:i:s")
];
if($main_img!='')$data['main_img']= $main_img;
if($webtoon_images!='') $data['webtoon_images'] = json_encode($webtoon_images);
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_episode,$data);
if($ret==TRUE) {
$this->util->js_alert_go('수정되었습니다','/admin/maptoon/episode/10');exit;
} else {
$this->util->js_alert('DB error');
}
}
}
/*
@desc : update maptoon episode
*/
public function fn_episode_upd_proc() {
}
/*
@desc : delete maptoon episode
*/
public function fn_episode_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>=0) {
$this->load->database();
$this->db->query("SET FOREIGN_KEY_CHECKS=0;");
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_episode);
if($ret==TRUE) {
$message = '삭제되었습니다.';
} else {
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
}
}else{
$message = '인덱스 값이 잘못 입력되었습니다';
exit;
}
// $this->util->js_alert_back($message);exit;
echo "<script>alert('".$message."');</script>";
Header("Location:/admin/maptoon/episode/10");
}
/*
@desc : show list of maptoon announcement
@param: numeric; idx of announcement table
*/
public function fn_announcement() {
$this->load->model('maptoon/m_maptoon');
$mt_idx=0; //all data
$return_data['list']=$this->m_maptoon->get_announcement_list($mt_idx);
$return_data['mt_title' ]=$this->m_maptoon->get_mt_title();
return $this->load->view('/admin/maptoon/notice_list',$return_data,true);
}
/*
@desc : register announcement
*/
public function fn_announcement_reg_proc() {
$mt_list_idx = $this->input->post('mt_title');
$mode = $this->input->post('mode');
$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($mode=='modify') {
if(is_numeric($idx)==TRUE && $idx>0) {
$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) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data=[ 'mt_list_idx' => $mt_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) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
// $this->util->js_alert('존재하지 않는 웹툰 제목입니다.');
}
exit;
}
/*
@desc : update maptoon announcement NOT USE
public function fn_announcement_upd_proc() {
$idx= $this->input->post('idx');
$contents= $this->input->post('contentes');
$idx= $this->input->post('s_date');
$idx= $this->input->post('e_date');
$mode= $this->input->post('mode');
if($mode==""){
exit;
}else{
$data = [
'contentes' => $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) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
}
*/
/*
@desc : delete maptoon announcement
*/
public function fn_announcement_del_proc() {
$idx = $this->input->get_post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->load->database();
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_notice);
echo $ret;
if($ret==TRUE) {
$message = '삭제되었습니다.';
} else {
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
}
}else{
$message = '인덱스 값이 잘못 입력되었습니다';
exit;
}
echo "<script>alert('".$message."'); parent.location.reload();</script>";
}
/*
@desc : list all cartoonists
*/
public function fn_cartoonist() {
$idx = $this->input->get('idx');
$this->load->database();
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;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['list'][$i] = $row;
$i++;
}
return $this->load->view('/admin/maptoon/cartoonist', $return_data, true);
}
}
/*
@desc : register & modify cartoonist info
*/
public function fn_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($mode=='upt') {
if(is_numeric($idx)==TRUE && $idx>0) {
$data = ['name' => $name,
'website' => $website];
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_cartoonist, $data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data = ['name' => $name,
'website' => $website];
$ret = $this->db->insert($this->tb_name_cartoonist,$data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
} else {
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
}
exit;
}
/*
@desc : delete cartoonist info
*/
public function fn_cartoonist_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_cartoonist);
if($ret==TRUE) {
$this->db->where('mt_cartoonists_idx',$idx);
$data = ['mt_cartoonists_idx' => 0];
$ret = $this->db->update($this->tb_name_maptoon_list,$data);
//echo $this->db->last_query();
$this->util->js_alert_parent_reload('삭제되었습니다.');
}
} else {
$this->util->js_alert('키값이 전달되지 않았습니다.');
}
exit;
}
}

View File

@@ -0,0 +1,719 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include_once (APPPATH.'core/admin/cm_controller.php');
class maptoon_test extends cm_controller {
var $tb_name_category = 'mt_categories';
var $tb_name_episode = 'mt_episodes';
var $tb_name_maptoon_list = 'mt_list';
var $tb_name_notice = 'mt_notices';
var $tb_name_cartoonist = 'mt_cartoonists';
var $total_count = 20; // total # of list
var $list_limit = 10; // total # of pages
function __construct() {
parent::__construct();
$this->load->library('util');
}
/*
@desc : list all the maptoon categories
*/
public function fn_category() {
$idx = $this->input->get('idx');
$this->load->database();
if(is_numeric($idx)==TRUE && $idx>0) {
$query = $this->db->get_where($this->tb_name_category,['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_category);
$i = 0;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['list'][$i] = $row;
$i++;
}
return $this->load->view('/admin/maptoon/category_list', $return_data, true);
}
}
/*
@desc : register category
*/
public function fn_category_proc() {
$c_name = $this->input->post('c_name');
$mode = $this->input->post('mode');
$idx = $this->input->post('idx');
$c_name = trim($c_name);
if($c_name!='') {
if($mode=='upt') {
if(is_numeric($idx)==TRUE && $idx>0) {
$data = ['c_name'=>$c_name];
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_category, $data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data = ['c_name' => $c_name];
$ret = $this->db->insert($this->tb_name_category,$data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
} else {
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
}
exit;
}
public function fn_category_detail($idx) {
if(is_numeric($idx)==TRUE && $idx>0) {
$return_data = ['c_name' => ''];
$this->load->model('admin/maptoon/m_maptoon');
$data_category = $this->m_maptoon->get_category($idx);
if($data_category!=FALSE && isset($data_category['c_name'])==TRUE) {
$return_data['c_name'] = $data_category['c_name'];
}
// get episodes in chosen category
$data_episodes = $this->m_maptoon->get_episodes_by_category($idx);
if($data_episodes!=FALSE) {
$return_data['data'] = $data_episodes;
} else {
$return_data['data'] = '';
}
return $this->load->view('/admin/maptoon/category_detail', $return_data, true);
} else {
$this->util->js_alert_back('잘못된 접근입니다.'); exit;
}
}
/*
title: get list of maptoon episodes
*/
public function fn_get_episodes($str) {
$str = trim($str);
if($str!='') {
}
}
/*
@desc : delete category
*/
public function fn_category_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_category);
if($ret==TRUE) {
$this->db->where('mt_categories_idx',$idx);
$data = ['mt_categories_idx' => 0];
$ret = $this->db->update($this->tb_name_episode,$data);
//echo $this->db->last_query();
$this->util->js_alert_parent_reload('삭제되었습니다.');
}
} else {
$this->util->js_alert('키값이 전달되지 않았습니다.');
}
exit;
}
/*
@desc : list all maptoons
*/
public function fn_maptoon_list() {
$page = $this->input->get('page',TRUE);
$this->load->model('admin/maptoon/m_maptoon');
//$query_string = ['status'=>1, 'mt_cartoonists_idx'=>1];
$query_string = [];
$data = $this->m_maptoon->get_maptoon_list($query_string);
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# pagination
$req_data = array();
$req_data['total_count'] = $this->total_count;
$req_data['limit'] = $this->list_limit;
$req_data['base_url'] = '/admin/maptoon/maptoon_list/10/' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
$return_data = $req_data;
$return_data['list'] = $data;
$return_data['page'] = $page;
$return_data['cartoonist'] = $arr_cartoonist;
return $this->load->view('/admin/maptoon/list', $return_data, true);
}
public function fn_maptoon_detail() {
$idx = $this->input->get('idx');
$this->load->model('/admin/maptoon/m_maptoon');
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
$return_data['cartoonist'] = $arr_cartoonist;
if(is_numeric($idx)==TRUE && $idx>0) {
$row = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
if(isset($row[0])==TRUE) {
$return_data['data'] = $row[0];
}
} else {
$return_data['data'] = [];
}
return $this->load->view('/admin/maptoon/maptoon_detail', $return_data, true);
}
/*
@desc : register maptoon
*/
public function fn_maptoon_proc() {
$idx = $this->input->post('idx');
$mode = $this->input->post('mode');
$mt_cartoonists_idx = $this->input->post('mt_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($mt_cartoonists_idx=='') {
$this->util->js_alert_back('맵툰작가를 입력해주십시오'); exit;
}
//이미지 업로드
if($_FILES['main_img']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
} else {
$img_data = '';
}
if(is_numeric($idx)==TRUE && $idx>0) { // update data
echo 'asdf'; exit;
} else { // insert data
$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"),
'mt_cartoonists_idx' => $mt_cartoonists_idx];
$this->load->model('admin/maptoon/m_maptoon');
$ret = $this->m_maptoon->insert_maptoon($data);
if($ret==TRUE) {
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/maptoon_list/10');exit;
} else {
$this->util->js_alert_back('등록되지 않았습니다. 다시 시도해 주세요');exit;
}
}
}
/*
@desc : delete maptoon
*/
public function fn_maptoon_del_proc() {
}
/*
@desc : show list of maptoon episodes
*/
public function fn_episode() {
$return_data['list'] = $result = array();
$this->load->model('/admin/maptoon/m_maptoon');
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list(); //작가 이름
$arr_mt_title = $this->m_maptoon->get_mt_title(); //맵툰 이름 리스트
$query = $this->db->get($this->tb_name_category);
$arr_category = $query->result_array(); //카테고리 리스트
$page = $this->input->get('page',TRUE);
$query_string = $_SERVER['QUERY_STRING'];
parse_str($query_string);
if(isset($author)) $arr_cartoonist_idx = $this->get_cartoonist_idx_by_name(urldecode($author));
# 검색
$req_data = array();
isset($sort_list)? $req_data['sort_list']=$sort_list :$req_data['sort_list']=""; // 최신 조회
isset($date_reg)? $req_data['date_reg']=$date_reg :$req_data['date_reg']=""; // 등록 날짜별
isset($ca)? $req_data['category']=$ca :$req_data['category']=""; // 카테고리
isset($sdate)? $req_data['sdate']=$sdate :$req_data['sdate']=""; // 시작일
isset($edate)? $req_data['edate']=$edate :$req_data['edate']=""; // 종료일
isset($mt_name)? $req_data['mt_name']= urldecode($mt_name) :$req_data['mt_name']=""; // 맵툰 이름
isset($ep_title)? $req_data['ep_title']= urldecode($ep_title) :$req_data['ep_title']=""; // 맵툰 제목
isset($arr_cartoonist_idx)? $req_data['author']= urldecode($author) :$req_data['author']=""; // 작가 번호
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
//list 가져오기
$this->load->model('/admin/maptoon/m_maptoon_test');
$data = $this->m_maptoon_test->get_episode_list($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $this->total_count;
$req_data['limit'] = $this->list_limit;
$req_data['base_url'] = '/admin/maptoon/episode/10/' ;
$req_data['suffix'] = '?'.$query_string;
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
$return_data = $req_data;
$return_data['list'] = $data;
$return_data['page'] = $page;
$return_data['mt_title' ] = $pagination;
$return_data['cartoonist'] = $arr_cartoonist; // 작가 이름
$return_data['mt_title' ] = $arr_mt_title; // 맵툰 이름
$return_data['category'] = $arr_category; // 카테고리 리스트
return $this->load->view('/admin/maptoon/episode_list', $return_data, true);
}
/*
@desc : register form for maptoon episode
*/
public function fn_episode_reg() {
$this->load->model('admin/maptoon/m_maptoon');
$return_data['cartoonist'] = $this->m_maptoon->get_cartoonist_list();
$return_data['mt_title' ] = $this->m_maptoon->get_mt_title();
if(empty($this->input->post('idx')==FALSE)){
$query = $this->db->get_where($this->tb_name_episode,['idx'=>$idx]);
$row = $query->row_array();
$return_data['modify_data'] = $row;
}
$query = $this->db->get($this->tb_name_category);
$arr_category = $query->result_array();
$return_data['category']=$arr_category;
return $this->load->view('/admin/maptoon/episode_reg', $return_data, true);
}
/*
@desc : register maptoon episode
*/
public function fn_episode_reg_proc() {
$mt_categories_idx = $this->input->post("mt_categories_idx");
$mt_list_idx = $this->input->post("mt_list_idx");
$title = $this->input->post("title");
$display_date = $this->input->post("display_date");
$is_display = $this->input->post("is_display"); //0: NO 1:YES
//메인이미지 업로드
if($_FILES['main_img']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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();
$main_img = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
} else {
$main_img = '';
}
//맵툰이미지 업로드
$data = array();
$filesCount = count($_FILES['webtoon_images']['name']);
if($filesCount>1){
for($i =0; $i<$filesCount;$i++){
$_FILES['webtoon_images'.$i]['name'] = $_FILES['webtoon_images']['name'][$i];
$_FILES['webtoon_images'.$i]['type'] = $_FILES['webtoon_images']['type'][$i];
$_FILES['webtoon_images'.$i]['tmp_name'] = $_FILES['webtoon_images']['tmp_name'][$i];
$_FILES['webtoon_images'.$i]['error'] = $_FILES['webtoon_images']['error'][$i];
$_FILES['webtoon_images'.$i]['size'] = $_FILES['webtoon_images']['size'][$i];
//이미지 업로드
if($_FILES['webtoon_images'.$i]['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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= 'webtoon_images'.$i.date("H").date("i").date("s");
if ( ! $this->upload->do_upload('webtoon_images'.$i)) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
}
$arr_upload_data = $this->upload->data();
$webtoon_images[$i] = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
} else {
$webtoon_images = '';
}
}
}else if($filesCount==1){
if($_FILES['webtoon_images']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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('webtoon_images')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
}
$arr_upload_data = $this->upload->data();
$webtoon_images = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
} else {
$webtoon_images = '';
}
}
$data=[
'mt_categories_idx' => $mt_categories_idx,
'mt_list_idx' => $mt_list_idx,
'title' => $title,
'main_img' => $main_img,
'display_date' => $display_date,
'is_display' => $is_display,
'display_date' => $display_date,
'webtoon_images' => json_encode($webtoon_images),
'reg_date' => date("Y-m-d H:i:s")
];
$ret = $this->db->insert($this->tb_name_episode,$data);
if($ret==TRUE) {
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/episode/10');exit;
} else {
$this->util->js_alert('DB error');
}
}
/*
@desc : update maptoon episode
*/
public function fn_episode_upd_proc() {
}
/*
@desc : delete maptoon episode
*/
public function fn_episode_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>=0) {
$this->load->database();
$this->db->where_in('idx',$where_in);
$ret = $this->db->delete($this->tb_name_episode);
if($ret==TRUE) {
$message = '삭제되었습니다.';
} else {
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
}
}else{
$message = '인덱스 값이 잘못 입력되었습니다';
exit;
}
echo "<script>alert('".$message."'); parent.location.reload();</script>";
}
/*
@desc : show list of maptoon announcement
@param: numeric; idx of announcement table
*/
public function fn_announcement() {
$this->load->model('admin/maptoon/m_maptoon');
$return_data['list']=$this->m_maptoon->get_announcement_list();
$return_data['mt_title' ]=$this->m_maptoon->get_mt_title();
return $this->load->view('/admin/maptoon/notice_list',$return_data,true);
}
/*
@desc : register announcement
*/
public function fn_announcement_reg_proc() {
$mt_list_idx = $this->input->post('mt_title');
$mode = $this->input->post('mode');
$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($mode=='modify') {
if(is_numeric($idx)==TRUE && $idx>0) {
$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) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data=[ 'mt_list_idx' => $mt_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) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
// $this->util->js_alert('존재하지 않는 웹툰 제목입니다.');
}
exit;
}
/*
@desc : update maptoon announcement NOT USE
public function fn_announcement_upd_proc() {
$idx= $this->input->post('idx');
$contents= $this->input->post('contentes');
$idx= $this->input->post('s_date');
$idx= $this->input->post('e_date');
$mode= $this->input->post('mode');
if($mode==""){
exit;
}else{
$data = [
'contentes' => $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) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
}
*/
/*
@desc : delete maptoon announcement
*/
public function fn_announcement_del_proc() {
$idx = $this->input->get_post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->load->database();
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_notice);
echo $ret;
if($ret==TRUE) {
$message = '삭제되었습니다.';
} else {
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
}
}else{
$message = '인덱스 값이 잘못 입력되었습니다';
exit;
}
echo "<script>alert('".$message."'); parent.location.reload();</script>";
}
/*
@desc : list all cartoonists
*/
public function fn_cartoonist() {
$idx = $this->input->get('idx');
$this->load->database();
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;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['list'][$i] = $row;
$i++;
}
return $this->load->view('/admin/maptoon/cartoonist', $return_data, true);
}
}
/*
@desc : register & modify cartoonist info
*/
public function fn_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($mode=='upt') {
if(is_numeric($idx)==TRUE && $idx>0) {
$data = ['name' => $name,
'website' => $website];
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_cartoonist, $data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data = ['name' => $name,
'website' => $website];
$ret = $this->db->insert($this->tb_name_cartoonist,$data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
} else {
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
}
exit;
}
/*
@desc : delete cartoonist info
*/
public function fn_cartoonist_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_cartoonist);
if($ret==TRUE) {
$this->db->where('mt_cartoonists_idx',$idx);
$data = ['mt_cartoonists_idx' => 0];
$ret = $this->db->update($this->tb_name_maptoon_list,$data);
//echo $this->db->last_query();
$this->util->js_alert_parent_reload('삭제되었습니다.');
}
} else {
$this->util->js_alert('키값이 전달되지 않았습니다.');
}
exit;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,230 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/admin/cm_controller.php');
class design extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 리스트
# CREATE : 2018-02-22
#---------------------------------------------------------------------------
function fn_design_popup_list() {
# request
$page = $this->uri->segment(5);
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_menu_code = trim($this->input->get_post('search_menu_code', TRUE));
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# 검색
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = addslashes($search_keyword);
$req_data['search_menu_code'] = $search_menu_code;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/design/m_design');
$total_count = $this->m_design->popup_list_total_count($req_data);
$result = $this->m_design->popup_list($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/design/design_popup_list/4' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
# view data
$return_data['pagination'] = $pagination;
$return_data['page'] = $page;
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_menu_code'] = $search_menu_code;
$return_data['list'] = $result;
# view
return $this->load->view('/admin/design/design_popup_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록
# CREATE : 2018-02-26
#---------------------------------------------------------------------------
function fn_design_popup_reg() {
# request
$page = trim($this->input->get_post('page', TRUE));;
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_menu_code = trim($this->input->get_post('search_menu_code', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$mode = trim($this->input->get_post('mode', TRUE));
$result = array();
if($mode == 'edit') {
# model
$this->load->model('admin/design/m_design');
$result = $this->m_design->popup_select($idx);
if(count($result) == 0) {
gf_alert("잘못된 접근입니다.", '/admin/design/design_popup_list/8');
exit;
}
$result = $result[0];
}
# view data
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_menu_code'] = $search_menu_code;
$return_data['mode'] = $mode;
$return_data['result'] = $result;
# view
return $this->load->view('/admin/design/design_popup_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록 저장
# CREATE : 2018-02-26
#---------------------------------------------------------------------------
function fn_design_popup_reg_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$mode = trim($this->input->get_post('mode', TRUE));
$page = trim($this->input->get_post('page', TRUE));;
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_menu_code = trim($this->input->get_post('search_menu_code', TRUE));
$popup_type_name = trim($this->input->get_post('popup_type_name', TRUE));
$title = trim($this->input->get_post('title', TRUE));
$menu_code = trim($this->input->get_post('menu_code', TRUE));
$top_margin = trim($this->input->get_post('top_margin', TRUE));
$left_margin = trim($this->input->get_post('left_margin', TRUE));
$width_size = trim($this->input->get_post('width_size', TRUE));
$height_size = trim($this->input->get_post('height_size', TRUE));
$link_url = trim($this->input->get_post('link_url', TRUE));
$content = trim($this->input->get_post('content', FALSE));
$start_date = trim($this->input->get_post('start_date', TRUE));
$end_date = trim($this->input->get_post('end_date', TRUE));
$start_time1 = trim($this->input->get_post('start_time1', TRUE));
$start_time2 = trim($this->input->get_post('start_time2', TRUE));
$end_time1 = trim($this->input->get_post('end_time1', TRUE));
$end_time2 = trim($this->input->get_post('end_time2', TRUE));
$is_display = trim($this->input->get_post('is_display', TRUE));
$prev_img = trim($this->input->get_post('img_path', TRUE));
if($start_time1=='') $start_time1 = '00';
if($start_time2=='') $start_time2 = '00';
if($end_time1=='') $end_time1 = '00';
if($end_time2=='') $end_time2 = '00';
$start_time = $start_time1.':'.$start_time2;
$end_time = $end_time1.':'.$end_time2;
$start_date = $start_date.' '.$start_time;
$end_date = $end_date.' '.$end_time;
# req data
$req_data['idx'] = $idx;
$req_data['popup_type_name']= $popup_type_name;
$req_data['title'] = $title;
$req_data['menu_code'] = $menu_code;
$req_data['top_margin'] = $top_margin;
$req_data['left_margin'] = $left_margin;
$req_data['width_size'] = $width_size;
$req_data['height_size'] = $height_size;
$req_data['link_url'] = $link_url;
$req_data['content'] = $content;
$req_data['start_date'] = $start_date;
$req_data['end_date'] = $end_date;
$req_data['is_display'] = $is_display;
$req_data['prev_img'] = $prev_img;
if($mode == 'add') { // 등록
# model
$this->load->model('admin/design/m_design');
$result = $this->m_design->popup_insert($req_data);
$go_url = '/admin/design/design_popup_list/8/';
} else if($mode == 'edit') { // 수정
# model
$this->load->model('admin/design/m_design');
$result = $this->m_design->popup_update($req_data);
$go_url = '/admin/design/design_popup_list/8/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword.'&search_menu_code='.$search_menu_code;
}
if(!$result) {
gf_alert("저장에 실패했습니다.", 'back');
exit;
}
gf_alert("저장되었습니다.", $go_url);
}
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록 > 삭제 처리
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_design_popup_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$req_date[] = $idx;
# model - update
$this->load->model('admin/design/m_design');
$this->m_design->popup_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/design/design_popup_list/8');
}
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록 > 삭제 처리 (다중)
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function fn_design_popup_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model - update
# model - update
$this->load->model('admin/design/m_design');
$this->m_design->popup_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/design/design_popup_list/8');
}
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,119 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class login extends CI_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 어드민 로그인 메인
# CREATE : 2018-02-18
#---------------------------------------------------------------------------
function index() {
$this->load->library('session');
# view
$this->load->view('/admin/admin_member/login');
}
#---------------------------------------------------------------------------
# PURPOSE : 어드민 로그인
# CREATE : 2018-02-18
#---------------------------------------------------------------------------
function login_proc(){
$this->load->helper('url');
$this->load->helper('crossmap/exception_helper');
$this->load->library('session');
# Request
$user_id = trim($this->input->get_post('user_id', TRUE)); // 아이디
$user_pwd = trim($this->input->get_post('user_pwd', TRUE)); // 비밀번호
$user_type = trim($this->input->get_post('user_type', TRUE));
# valid Check
if (empty($user_id) == true) {
gf_alert('아이디를 입력해주세요.', '/admin/');
exit;
}
if (empty($user_pwd) == true) {
gf_alert('비밀번호를 입력해주세요.', '/admin/');
exit;
}
$req_data['user_id'] = $user_id;
$req_data['user_pwd'] = addslashes($user_pwd);
# model - 로그인
$this->load->model('admin/admin_member/m_login');
if($user_type == 0) {
$return_data = $this->m_login->login_proc($req_data);
$req_data['tb'] = 'admin';
} else {
$return_data = $this->m_login->partner_login_proc($req_data);
$req_data['tb'] = 'partner';
}
if($return_data == '') {
gf_alert('로그인 정보가 없습니다.', '/admin/');
exit;
}
$idx = $return_data['idx'];
$req_data['idx'] = $idx;
# 마지막 로그인 정보 업데이트
$this->m_login->last_login_update($req_data);
# 세션정보 저장
$user_id = $return_data['user_id'];
$user_name = $return_data['user_name'];
$last_login_date = $return_data['last_login_date'];
$member_group_idx = $return_data['member_group_idx'];
$last_login_date = substr($last_login_date, 0, 10);
switch ($member_group_idx) {
case '0': $user_type = '0'; break; // 어드민
case '6': $user_type = '1'; break; // 에디터
case '7': $user_type = '2'; break; // 칼럼리스트
}
if($user_type=='') {
gf_alert('잘못된 접근입니다.', '/admin/');
exit;
}
$this->session->set_userdata('Adm_Type', $user_type);
$this->session->set_userdata('Adm_Id', $user_id);
$this->session->set_userdata('Adm_Name', $user_name);
$this->session->set_userdata('Adm_Last_Login', $last_login_date);
$this->session->set_userdata('Adm_Idx', $idx);
# 메인으로 이동
header('location:/adm');
}
#---------------------------------------------------------------------------
# PURPOSE : 어드민 로그아웃
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function logout_proc(){
$this->load->helper('url');
$this->load->library('session');
# 세션정보 unset
$this->session->unset_userdata('Adm_Type');
$this->session->unset_userdata('Adm_Id');
$this->session->unset_userdata('Adm_Name');
$this->session->unset_userdata('Adm_Last_Login');
# 메인으로 이동
header('location:/admin');
}
}
?>

View File

@@ -0,0 +1,22 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once (APPPATH.'core/admin/cm_controller.php');
class main extends cm_controller {
function fn_index() {
}
}
?>

View File

@@ -0,0 +1,820 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include_once (APPPATH.'core/admin/cm_controller.php');
class maptoon extends cm_controller {
var $tb_name_category = 'mt_categories';
var $tb_name_episode = 'mt_episodes';
var $tb_name_maptoon_list = 'mt_list';
var $tb_name_notice = 'mt_notices';
var $tb_name_cartoonist = 'mt_cartoonists';
var $total_count = 20; // total # of list
var $list_limit = 10; // total # of pages
function __construct() {
parent::__construct();
$this->load->library('util');
}
/*
@desc : list all the maptoon categories
*/
public function fn_category() {
$idx = $this->input->get('idx');
$this->load->database();
if(is_numeric($idx)==TRUE && $idx>0) {
$query = $this->db->get_where($this->tb_name_category,['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_category);
$i = 0;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['list'][$i] = $row;
$i++;
}
return $this->load->view('/admin/maptoon/category_list', $return_data, true);
}
}
/*
@desc : register category
*/
public function fn_category_proc() {
$c_name = $this->input->post('c_name');
$mode = $this->input->post('mode');
$idx = $this->input->post('idx');
$c_name = trim($c_name);
if($c_name=='') {
$this->util->js_alert('카테고리 이름을 입력해 주십시오'); exit;
}
if($mode=='upt') {
if(is_numeric($idx)==TRUE && $idx>0) {
$data = ['c_name'=>$c_name];
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_category, $data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data = ['c_name' => $c_name];
$ret = $this->db->insert($this->tb_name_category,$data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
exit;
}
public function fn_register_episode_in_category() {
$episodes_idx = $this->input->post('episodes_idx');
$idx = $this->input->post('idx');
$len = count($episodes_idx);
if(is_array($episodes_idx)==TRUE && is_numeric($idx)==TRUE
&& $idx>0 && $len>0) {
$str = implode(',',$episodes_idx);
$this->load->model('maptoon/m_maptoon');
$ret = $this->m_maptoon->update_episodes_by_category($idx,$str);
$this->config->load('filecache',TRUE);
$file_cache_path = $this->config->item('file_cache_path','filecache');
$params = array('file_cache_path'=>$file_cache_path);
$this->load->library('maptoon_lib',$params);
// get episode data to write cache
$json_data = $this->m_maptoon->get_widget_info_by_episode_idx($episodes_idx,'json');
if($json_data!=FALSE) {
$this->maptoon_lib->write_category_cache($idx,$json_data);
}
}
$this->util->js_alert_go('카테고리내 에피소드 등록이 완료되었습니다.','/admin/maptoon/category/10');
}
public function fn_category_detail() {
$idx = $this->input->get('idx');
$search_keyword = $this->input->get('search_keyword');
if(is_numeric($idx)==FALSE || $idx<=0) {
$this->util->js_alert_back('잘못된 접근입니다.'); exit;
}
// get maptoon list in chosen category
$this->load->model('maptoon/m_maptoon');
$return_data = ['c_name' => ''];
$data_category = $this->m_maptoon->get_category($idx);
if($data_category!=FALSE && isset($data_category['c_name'])==TRUE) {
$return_data['c_name'] = $data_category['c_name'];
}
if($data_category['mt_episodes_idx']=='') {// get episodes from episode category
$data_episodes = $this->m_maptoon->get_episodes_by_category($idx);
} else { // get episodes in chosen category
$data_episodes = $this->m_maptoon->get_episodes_by_category($data_category['mt_episodes_idx']);
}
if($data_episodes!=FALSE) {
$return_data['list'] = $data_episodes;
} else {
$return_data['list'] = '';
}
$return_data['idx'] = $idx;
return $this->load->view('/admin/maptoon/category_detail', $return_data, true);
}
/*
@desc : delete category
*/
public function fn_category_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_category);
if($ret==TRUE) {
$this->db->where('mt_categories_idx',$idx);
$data = ['mt_categories_idx' => 0];
$ret = $this->db->update($this->tb_name_episode,$data);
//echo $this->db->last_query();
$this->util->js_alert_parent_reload('삭제되었습니다.');
}
} else {
$this->util->js_alert('키값이 전달되지 않았습니다.');
}
exit;
}
/*
get list of maptoon episodes
@return json string
*/
public function fn_get_episodes_by_search_keyword() {
$keyword = $this->input->get('keyword');
if($keyword!='') {
$this->load->model('maptoon/m_maptoon');
$row = $this->m_maptoon->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;
}
}
/*
@desc : list all maptoons
*/
public function fn_maptoon_list() {
$page = $this->input->get('page',TRUE);
$this->load->model('maptoon/m_maptoon');
//$query_string = ['status'=>1, 'mt_cartoonists_idx'=>1];
$query_string = [];
$data = $this->m_maptoon->get_maptoon_list($query_string);
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# pagination
$req_data = array();
$req_data['total_count'] = $this->total_count;
$req_data['limit'] = $this->list_limit;
$req_data['base_url'] = '/admin/maptoon/maptoon_list/10/' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
$return_data = $req_data;
for($i=0; $i<count($data); $i++) {
$data[$i]['num_of_episodes'] = $this->m_maptoon->get_num_of_episodes($data[$i]['idx']);
}
$return_data['list'] = $data;
$return_data['page'] = $page;
$return_data['cartoonist'] = $arr_cartoonist;
return $this->load->view('/admin/maptoon/list', $return_data, true);
}
public function fn_maptoon_list_del() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
//1.check num of episode in maptoon
$this->load->model('maptoon/m_maptoon');
$num = $this->m_maptoon->get_num_of_episodes($idx);
$num_of_announcement = $this->m_maptoon->get_num_of_announcement_by_maptoon($idx);
if($num>0) {
$ret = ['result'=>"이미 등록되어 있는 에피소드가 있어서 삭제가 불가능합니다.\n해당 에피소드 삭제후 웹툰 삭제가 가능합니다."];
echo json_encode($ret); exit;
}
if($num_of_announcement>0) {
$ret = ['result'=>"이미 웹툰에 등록되어 있는 공지사항이 있어서 삭제가 불가능합니다.\n해당 공지사항 삭제후 웹툰 삭제가 가능합니다."];
echo json_encode($ret); exit;
}
$result = $this->m_maptoon->delete_maptoon($idx);
$ret = ['result'=>$result];
if($result==TRUE) {
$ret = ['result'=>'success'];
} else {
$ret = ['result'=>'DB error, 개발자에게 문의 바랍니다.'];
}
} else {
$ret = ['result'=>'wrong parameter'];
}
exit;
}
public function fn_maptoon_detail() {
$idx = $this->input->get('idx');
$this->load->model('maptoon/m_maptoon');
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
$return_data['cartoonist'] = $arr_cartoonist;
if(is_numeric($idx)==TRUE && $idx>0) {
$num_of_episodes = $this->m_maptoon->get_num_of_episodes($idx);
$return_data['num_of_episodes'] = $num_of_episodes;
$row = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
if(isset($row[0])==TRUE) {
$return_data['data'] = $row[0];
}
$return_data['maptoon_idx'] = $idx;
} else {
$return_data['data'] = [];
}
return $this->load->view('/admin/maptoon/maptoon_detail', $return_data, true);
}
/*
@desc : register maptoon
*/
public function fn_maptoon_proc() {
$idx = $this->input->post('idx');
$mode = $this->input->post('mode');
$mt_cartoonists_idx = $this->input->post('mt_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($mt_cartoonists_idx=='') {
$this->util->js_alert_back('맵툰작가를 입력해주십시오'); exit;
}
$this->load->model('maptoon/m_maptoon');
$maptoon_info = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
//이미지 업로드
if($_FILES['main_img']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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) ? MAPTOON_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"),
'mt_cartoonists_idx' => $mt_cartoonists_idx];
if(is_numeric($idx)==TRUE && $idx>0) { // update data
$ret = $this->m_maptoon->update_maptoon($idx, $data);
if($ret==TRUE) {
$this->util->js_alert_go('수정되었습니다','/admin/maptoon/maptoon_list/10');exit;
} else {
$this->util->js_alert_back('수정되지 않았습니다. 다시 시도해 주세요');exit;
}
} else { // insert data
$ret = $this->m_maptoon->insert_maptoon($data);
if($ret==TRUE) {
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/maptoon_list/10');exit;
} else {
$this->util->js_alert_back('등록되지 않았습니다. 다시 시도해 주세요');exit;
}
}
}
/*
@desc : delete maptoon
*/
public function fn_maptoon_del_proc() {
}
/*
@desc : show list of maptoon episodes
*/
public function fn_episode() {
$return_data['list'] = $result = array();
$this->load->model('maptoon/m_maptoon');
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list(); //작가 이름
$arr_mt_title = $this->m_maptoon->get_mt_title(); //맵툰 이름 리스트
$cartoonist_list=array();
foreach($arr_cartoonist as $val){
$cartoonist_list[$val['idx']]=$val['name'];
}
$query = $this->db->get($this->tb_name_category);
$arr_category = $query->result_array(); //카테고리 리스트
$category_list=array();
foreach($arr_category as $val){
$category_list[$val['idx']]=$val['c_name'];
}
$query_string = $_SERVER['QUERY_STRING'];
parse_str($query_string);
if(isset($author)) $arr_cartoonist_idx = $this->m_maptoon->get_cartoonist_idx_by_name(urldecode($author));
# 검색
$req_data = array();
isset($sort_list)? $req_data['sort_list']=$sort_list :$req_data['sort_list']=""; // 최신 조회
isset($date_reg)? $req_data['date_reg']=$date_reg :$req_data['date_reg']=""; // 등록 날짜별
isset($ca)? $req_data['category']=$ca :$req_data['category']=""; // 카테고리
isset($sdate)? $req_data['sdate']=$sdate :$req_data['sdate']=""; // 시작일
isset($edate)? $req_data['edate']=$edate :$req_data['edate']=""; // 종료일
isset($mt_name)? $req_data['mt_name']= urldecode($mt_name) :$req_data['mt_name']=""; // 맵툰 이름
isset($ep_title)? $req_data['ep_title']= urldecode($ep_title) :$req_data['ep_title']=""; // 맵툰 제목
isset($arr_cartoonist_idx)? $req_data['author']= $arr_cartoonist_idx :$req_data['author']=""; // 작가 번호
# paging 설정
$page = $this->uri->segment(5);
if($page == 0) $page = 1;
// $limit = PAGE_SIZE;
$limit = 10;
$offset = ($page-1) * $limit;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
#list 가져오기
$data = $this->m_maptoon->get_episode_list($req_data);
#total count 가져오기
$total_count=$this->m_maptoon->get_episode_list_search_count($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $total_count; // 총 에피소드 수
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/maptoon/episode/10/' ;
$req_data['suffix'] = '?'.$query_string;
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
$return_data = $req_data;
$return_data['list'] = $data;
$return_data['page'] = $page;
$return_data['pagination' ] = $pagination;
$return_data['cartoonist'] = $arr_cartoonist; // 작가 이름
$return_data['cartoonist_list'] = $cartoonist_list; // 작가 이름2
$return_data['mt_title' ] = $arr_mt_title; // 맵툰 이름
$return_data['category'] = $arr_category; // 카테고리 리스트
$return_data['category_list'] = $category_list; // 카테고리 리스트2
return $this->load->view('/admin/maptoon/episode_list', $return_data, true);
}
/*
@desc : register form for maptoon episode
*/
public function fn_episode_reg() {
$this->load->model('maptoon/m_maptoon');
$return_data['cartoonist'] = $this->m_maptoon->get_cartoonist_list();
$return_data['mt_title' ] = $this->m_maptoon->get_mt_title();
if(empty($this->input->post('idx')==FALSE)){
$idx= $this->input->post('idx');
$query = $this->db->get_where($this->tb_name_episode,['idx'=>$idx]);
$row = $query->row_array();
$return_data['modify_data'] = $row;
}
$query = $this->db->get($this->tb_name_category);
$arr_category = $query->result_array();
$return_data['category']=$arr_category;
return $this->load->view('/admin/maptoon/episode_reg', $return_data, true);
}
/*
@desc : register maptoon episode
*/
public function fn_episode_reg_proc() {
$mode = $this->input->post("mode");// edit 이면 수정
$idx = $this->input->post("idx"); // 수정시 사용
$mt_categories_idx = $this->input->post("mt_categories_idx");
$mt_list_idx = $this->input->post("mt_list_idx");
$title = $this->input->post("title");
$ep_no = $this->input->post("ep_no");
$display_date = $this->input->post("display_date");
$is_display = $this->input->post("is_display"); //0: NO 1:YES
//메인이미지 업로드
$main_img = '';
if($_FILES['main_img']['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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();
$main_img = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
}
//맵툰이미지 업로드
$data = array();
$filesCount = count($_FILES['webtoon_images']['name']);
$webtoon_images = '';
if($filesCount>0 && $_FILES['webtoon_images']['name']!=''){
for($i =0; $i<$filesCount;$i++){
$_FILES['webtoon_images'.$i]['name'] = $_FILES['webtoon_images']['name'][$i];
$_FILES['webtoon_images'.$i]['type'] = $_FILES['webtoon_images']['type'][$i];
$_FILES['webtoon_images'.$i]['tmp_name'] = $_FILES['webtoon_images']['tmp_name'][$i];
$_FILES['webtoon_images'.$i]['error'] = $_FILES['webtoon_images']['error'][$i];
$_FILES['webtoon_images'.$i]['size'] = $_FILES['webtoon_images']['size'][$i];
//이미지 업로드
if($_FILES['webtoon_images'.$i]['name']!='') {
$mid_url_path = date("Y")."/".date("m");
$upload_path = MAPTOON_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= 'webtoon_images'.$i.date("H").date("i").date("s");
if ( ! $this->upload->do_upload('webtoon_images'.$i)) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다1.", 'back');
}
$arr_upload_data = $this->upload->data();
$webtoon_images[$i] = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
}
}
}
if($mode!="edit"){
$data=[
'mt_categories_idx' => $mt_categories_idx,
'mt_list_idx' => $mt_list_idx,
'title' => $title,
'ep_no' => $ep_no,
'main_img' => $main_img,
'display_date' => $display_date,
'is_display' => $is_display,
'webtoon_images' => json_encode($webtoon_images),
'reg_date' => date("Y-m-d H:i:s")
];
$ret = $this->db->insert($this->tb_name_episode,$data);
if($ret==TRUE) {
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/episode/10');exit;
} else {
$this->util->js_alert('DB error');
}
}else if($mode=="edit"){
$data=[
'mt_categories_idx' => $mt_categories_idx,
'title' => $title,
'mt_list_idx' => $mt_list_idx,
'ep_no' => $ep_no,
'display_date' => $display_date,
'is_display' => $is_display,
];
if($main_img!='')$data['main_img']= $main_img;
if($webtoon_images!='') $data['webtoon_images'] = json_encode($webtoon_images);
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_episode,$data);
if($ret==TRUE) {
$this->util->js_alert_go('수정되었습니다','/admin/maptoon/episode/10');exit;
} else {
$this->util->js_alert('DB error');
}
}
}
/*
@desc : update maptoon episode
*/
public function fn_episode_upd_proc() {
}
/*
@desc : delete maptoon episode
*/
public function fn_episode_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>=0) {
$this->load->database();
$this->db->query("SET FOREIGN_KEY_CHECKS=0;");
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_episode);
if($ret==TRUE) {
$message = '삭제되었습니다.';
} else {
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
}
}else{
$message = '인덱스 값이 잘못 입력되었습니다';
exit;
}
// $this->util->js_alert_back($message);exit;
echo "<script>alert('".$message."');</script>";
Header("Location:/admin/maptoon/episode/10");
}
/*
@desc : show list of maptoon announcement
@param: numeric; idx of announcement table
*/
public function fn_announcement() {
$this->load->model('maptoon/m_maptoon');
$mt_idx=0; //all data
$return_data['list']=$this->m_maptoon->get_announcement_list($mt_idx);
$return_data['mt_title' ]=$this->m_maptoon->get_mt_title();
return $this->load->view('/admin/maptoon/notice_list',$return_data,true);
}
/*
@desc : register announcement
*/
public function fn_announcement_reg_proc() {
$mt_list_idx = $this->input->post('mt_title');
$mode = $this->input->post('mode');
$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($mode=='modify') {
if(is_numeric($idx)==TRUE && $idx>0) {
$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) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data=[ 'mt_list_idx' => $mt_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) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
// $this->util->js_alert('존재하지 않는 웹툰 제목입니다.');
}
exit;
}
/*
@desc : update maptoon announcement NOT USE
public function fn_announcement_upd_proc() {
$idx= $this->input->post('idx');
$contents= $this->input->post('contentes');
$idx= $this->input->post('s_date');
$idx= $this->input->post('e_date');
$mode= $this->input->post('mode');
if($mode==""){
exit;
}else{
$data = [
'contentes' => $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) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
}
*/
/*
@desc : delete maptoon announcement
*/
public function fn_announcement_del_proc() {
$idx = $this->input->get_post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->load->database();
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_notice);
echo $ret;
if($ret==TRUE) {
$message = '삭제되었습니다.';
} else {
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
}
}else{
$message = '인덱스 값이 잘못 입력되었습니다';
exit;
}
echo "<script>alert('".$message."'); parent.location.reload();</script>";
}
/*
@desc : list all cartoonists
*/
public function fn_cartoonist() {
$idx = $this->input->get('idx');
$this->load->database();
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;
$return_data = array();
foreach($query->result_array() as $row) {
$return_data['list'][$i] = $row;
$i++;
}
return $this->load->view('/admin/maptoon/cartoonist', $return_data, true);
}
}
/*
@desc : register & modify cartoonist info
*/
public function fn_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($mode=='upt') {
if(is_numeric($idx)==TRUE && $idx>0) {
$data = ['name' => $name,
'website' => $website];
$this->db->where('idx',$idx);
$ret = $this->db->update($this->tb_name_cartoonist, $data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('수정되었습니다.');
} else {
$this->util->js_alert('DB error');
}
} else {
$this->util->js_alert('키값이 입력되지 않았습니다.');
}
} else {
$data = ['name' => $name,
'website' => $website];
$ret = $this->db->insert($this->tb_name_cartoonist,$data);
if($ret==TRUE) {
$this->util->js_alert_parent_reload('등록되었습니다.');
} else {
$this->util->js_alert('DB error');
}
}
} else {
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
}
exit;
}
/*
@desc : delete cartoonist info
*/
public function fn_cartoonist_del_proc() {
$idx = $this->input->post('idx');
if(is_numeric($idx)==TRUE && $idx>0) {
$this->db->where('idx',$idx);
$ret = $this->db->delete($this->tb_name_cartoonist);
if($ret==TRUE) {
$this->db->where('mt_cartoonists_idx',$idx);
$data = ['mt_cartoonists_idx' => 0];
$ret = $this->db->update($this->tb_name_maptoon_list,$data);
//echo $this->db->last_query();
$this->util->js_alert_parent_reload('삭제되었습니다.');
}
} else {
$this->util->js_alert('키값이 전달되지 않았습니다.');
}
exit;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/admin/cm_controller.php');
class search extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 기사검색
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function fn_ajax_search_article_list() {
# request
$article_keyword = trim($this->input->get_post('article_keyword', TRUE));
$content_type = trim($this->input->get_post('content_type', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
$type = trim($this->input->get_post('type', TRUE));
$category1 = trim($this->input->get_post('category1', TRUE));
$category2 = trim($this->input->get_post('category2', TRUE));
$category3 = trim($this->input->get_post('category3', TRUE));
if($sort=='') $sort = '1';
switch ($sort) {
case '1': $sort_column = 'display_date'; $sort_type = 'desc'; break;
case '2': $sort_column = 'display_date'; $sort_type = 'asc'; break;
default : $sort_column = 'display_date'; $sort_type = 'desc'; break;
}
# 검색
$req_data['article_keyword'] = addslashes($article_keyword);
$req_data['sort_column'] = $sort_column;
$req_data['sort_type'] = $sort_type;
$req_data['category1'] = $category1;
$req_data['category2'] = $category2;
$req_data['category3'] = $category3;
if($content_type == 'all') {
# model - list
$this->load->model('admin/comm/m_search');
$result = $this->m_search->all_list_limit100($req_data);
} else {
if($content_type == '1') { // 뉴스
# model - list
$this->load->model('admin/news/m_news');
$result = $this->m_news->news_list_limit100($req_data);
} else if($content_type == '2') { // 칼럼
# model - list
$this->load->model('admin/column/m_column');
$result = $this->m_column->column_list_limit100($req_data);
} else if($content_type == '3') { // 라이프
# model - list
$this->load->model('admin/life/m_life');
$result = $this->m_life->life_list_limit100($req_data);
}
}
# view data
$return_data['list'] = $result;
$return_data['count'] = count($result);
$return_data['sort'] = $sort;
if($type=='JSON') {
$return_data['result'] = array('result_code' => '0000', 'result_data'=>$return_data);
$view_url = '/admin/comm/result_json';
} else {
$view_url = '/admin/search/search_article_list';
}
# view
return $this->load->view($view_url, $return_data);
}
}
?>

View File

@@ -0,0 +1,440 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once (APPPATH.'core/admin/cm_controller.php');
class service extends cm_controller {
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 기본정보
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function fn_service_authorization_reg() {
// # model
// $this->load->model('admin/setting/m_setting_site');
// $return_data = $this->m_setting_site->site_info_select();
// if($return_data == '') {
// $return_data['homepage_title'] = '';
// $return_data['admin_logo'] = '';
// $return_data['footer_script'] = '';
// $return_data['webmaster_name'] = '';
// $return_data['webmaster_email'] = '';
// }
//
// # view
// return $this->load->view('/admin/setting/setting_site_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 기본정보 저장
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function fn_setting_site_reg_proc() {
$homepage_title = trim($this->input->get_post('homepage_title', TRUE)); // 홈페이지제목
$footer_script = trim($this->input->get_post('footer_script', FALSE)); // 하단스크립트
$webmaster_name = trim($this->input->get_post('webmaster_name', TRUE)); // 웹마스터이름
$webmaster_email = trim($this->input->get_post('webmaster_email', TRUE)); // 웹마스터이메일
$is_del_admin_logo = trim($this->input->get_post('is_del_admin_log', TRUE)); // 관리자페이지로고 - 삭제여부
# valid check
$this->load->library('form_validation');
$this->form_validation->set_rules('homepage_title', '홈페이지 제목', 'required');
$this->form_validation->set_rules('webmaster_name', '웹마스터 이름', 'required');
$this->form_validation->set_rules('webmaster_email', '웹마스터 이메일주소', 'required');
if($this->form_validation->run() == false){
gf_alert("정보를 정확히 입력해주세요.", '/admin/main');
exit;
}
$footer_script = htmlspecialchars($footer_script);
# model
$this->load->model('admin/setting/m_setting_site');
$return_data = $this->m_setting_site->site_info_select();
$org_filename = '';
if($return_data != '') {
$org_filename = $return_data['admin_logo'];
$footer_content = $return_data['footer_content'];
}
# 이미지 삭제
if($is_del_admin_logo=='Y') {
unlink('.'.$org_filename);
$org_filename = '';
}
if($_FILES['admin_logo']['name']!='') {
# image upload
$upload_path = './files/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('admin_logo')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", '/admin/setting/setting_site_reg/1');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
$filename = $org_filename;
}
$req_data['homepage_title'] = $homepage_title;
$req_data['admin_logo'] = $filename;
$req_data['footer_script'] = $footer_script;
$req_data['webmaster_name'] = $webmaster_name;
$req_data['webmaster_email'] = $webmaster_email;
if($return_data != '') { // 수정
$idx = $return_data['idx'];
$req_data['idx'] = $idx;
# model - update
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->site_info_update($req_data);
} else { // 등록
# model - update
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->site_info_insert($req_data);
}
gf_alert("저장되었습니다.", '/admin/setting/setting_site_reg/1');
}
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 접근기능
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function fn_setting_site_access_reg() {
# model
$this->load->model('admin/setting/m_setting_site');
$return_data = $this->m_setting_site->site_access_ip_select();
$arr_return_data['access_type_1'] = '';
$arr_return_data['access_type_2'] = '';
$arr_return_data['access_type_3'] = '';
if($return_data != '') {
foreach($return_data as $val) {
$key = 'access_type_'.$val['access_type'];
$arr_return_data[$key] .= $val['ip']."\r\n";;
}
}
# view
return $this->load->view('/admin/setting/setting_site_access_reg', $arr_return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 접근기능 저장
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function fn_setting_site_access_reg_proc() {
$access_type_1 = trim($this->input->get_post('access_type_1', TRUE)); // 관리자 페이지 접근가능 IP
$access_type_2 = trim($this->input->get_post('access_type_2', TRUE)); // 사이트 접근불가 IP
$access_type_3 = trim($this->input->get_post('access_type_3', TRUE)); // 사이트 접근가능 IP
$arr_access_type_1 = explode("\r\n", $access_type_1);
$arr_access_type_1 = array_values(array_filter(array_map('trim',$arr_access_type_1)));
$arr_access_type_2 = explode("\r\n", $access_type_2);
$arr_access_type_2 = array_values(array_filter(array_map('trim',$arr_access_type_2)));
$arr_access_type_3 = explode("\r\n", $access_type_3);
$arr_access_type_3 = array_values(array_filter(array_map('trim',$arr_access_type_3)));
$req_data['access_type_1'] = $arr_access_type_1;
$req_data['access_type_2'] = $arr_access_type_2;
$req_data['access_type_3'] = $arr_access_type_3;
# model - 접근기능 삭제
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->site_access_ip_delete();
# model - 금칙접근기능어 입력
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->site_access_ip_insert($req_data);
gf_alert("저장되었습니다.", '/admin/setting/setting_site_access_reg/1');
}
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 하단푸터관리
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function fn_setting_footer_reg() {
# model
$this->load->model('admin/setting/m_setting_site');
$return_data = $this->m_setting_site->site_info_select();
if($return_data == '') {
$return_data['footer_content'] = '';
}
# view
return $this->load->view('/admin/setting/setting_footer_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 하단푸터관리 저장
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function fn_setting_footer_reg_proc() {
$footer_content = trim($this->input->get_post('footer_content', TRUE)); // 사이트 하단 정보입력
# valid check
$this->load->library('form_validation');
$this->form_validation->set_rules('footer_content', '사이트 하단 정보입력', 'required');
if($this->form_validation->run() == false){
gf_alert("정보를 정확히 입력해주세요.", '/admin/main');
exit;
}
$footer_content = htmlspecialchars($footer_content);
# model
$this->load->model('admin/setting/m_setting_site');
$return_data = $this->m_setting_site->site_info_select();
$req_data['footer_content'] = $footer_content;
if($return_data != '') { // 수정
$idx = $return_data['idx'];
$req_data['idx'] = $idx;
# model - update
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->site_info_footer_content_update($req_data);
} else { // 등록
# model - update
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->site_info_insert($req_data);
}
gf_alert("저장되었습니다.", '/admin/setting/setting_footer_reg/1');
}
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 금칙어설정
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function fn_setting_forbidden_word_reg() {
# model
$this->load->model('admin/setting/m_setting_site');
$return_data = $this->m_setting_site->forbidden_word_select();
if($return_data == '') {
$return_data['forbidden_word'] = '';
} else {
$forbidden_word = '';
foreach($return_data as $val) {
$forbidden_word.= $val['word']."\r\n";
}
$return_data['forbidden_word'] = $forbidden_word;
}
# view
return $this->load->view('/admin/setting/setting_forbidden_word_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 금칙어설정 저장
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function fn_setting_forbidden_word_reg_proc() {
$forbidden_word = trim($this->input->get_post('forbidden_word', TRUE)); // 단어 필터링
# valid check
$this->load->library('form_validation');
$this->form_validation->set_rules('forbidden_word', '단어 필터링', 'required');
if($this->form_validation->run() == false){
gf_alert("정보를 정확히 입력해주세요.", '/admin/main');
exit;
}
$arr_forbidden_word = explode("\r\n", $forbidden_word);
$req_data = array_values(array_filter(array_map('trim',$arr_forbidden_word)));
# model - 금칙어 삭제
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->forbidden_word_delete();
# model - 금칙어 입력
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->forbidden_word_insert($req_data);
gf_alert("저장되었습니다.", '/admin/setting/setting_forbidden_word_reg/1');
}
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 이용약관개인정보 취급방침
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function fn_setting_policy_reg() {
# model
$this->load->model('admin/setting/m_setting_site');
$return_data = $this->m_setting_site->site_info_select();
if($return_data == '') {
$return_data['service'] = '';
$return_data['privacy'] = '';
$return_data['privacy_agreement'] = '';
}
# view
return $this->load->view('/admin/setting/setting_policy_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 사이트정보설정 - 이용약관개인정보 취급방침 저장
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function fn_setting_policy_reg_proc() {
$service = trim($this->input->get_post('service', TRUE)); // 이용약관
$privacy = trim($this->input->get_post('privacy', TRUE)); // 개인정보 취급방침
$privacy_agreement = trim($this->input->get_post('privacy_agreement', TRUE)); // 개인정보 수집 이용동의
# valid check
$this->load->library('form_validation');
$this->form_validation->set_rules('service', '이용약관', 'required');
$this->form_validation->set_rules('privacy', '개인정보 취급방침', 'required');
$this->form_validation->set_rules('privacy_agreement', '개인정보 수집 이용동의', 'required');
if($this->form_validation->run() == false){
gf_alert("정보를 정확히 입력해주세요.", '/admin/main');
exit;
}
$service = htmlspecialchars($service);
$privacy = htmlspecialchars($privacy);
$privacy_agreement = htmlspecialchars($privacy_agreement);
# model
$this->load->model('admin/setting/m_setting_site');
$return_data = $this->m_setting_site->site_info_select();
$req_data['service'] = $service;
$req_data['privacy'] = $privacy;
$req_data['privacy_agreement'] = $privacy_agreement;
if($return_data != '') { // 수정
$idx = $return_data['idx'];
$req_data['idx'] = $idx;
# model - update
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->site_info_policy_update($req_data);
} else { // 등록
# model - update
$this->load->model('admin/setting/m_setting_site');
$this->m_setting_site->site_info_insert($req_data);
}
gf_alert("저장되었습니다.", '/admin/setting/setting_policy_reg/1');
}
#---------------------------------------------------------------------------
# PURPOSE : 신고관리 - 블라인드리스트
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function fn_setting_blind_list() {
# request
$page = $this->uri->segment(5);
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
// $this->load->model('shop/shopinfo');
// $data['arrRtnShopInfo'] = $this->shopinfo->getShopInfo($Shop_No);
// $data['arrRtnShopMenuInfo'] = $this->shopinfo->getShopMenuInfo($Shop_No);
// $data['arrRtnShopReviewList'] = $this->shopinfo->getShopReviewList($Shop_No, $reqData['offset'], $reqData['limit']);
// $data['url'] = $reqData['url'];
//
//
//
//
// # model
// $this->load->model('admin/setting/m_setting_site');
// $return_data = $this->m_setting_site->site_info_select();
// if($return_data == '') {
// $return_data['service'] = '';
// $return_data['privacy'] = '';
// $return_data['privacy_agreement'] = '';
// }
//
// # view
// return $this->load->view('/admin/setting/setting_policy_reg', $return_data, true);
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Bible extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library('user_agent');
$this->load->library('Post', '', 'post');
}
public function index() {
$post = new stdClass;
$post->title = '';
$post->content = '';
$post->mainImg = '';
$this->load->view('bible/bible', array('post' => $post));
}
}

301
application/controllers/cmtv.php Executable file
View File

@@ -0,0 +1,301 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Cmtv extends CI_Controller
{
private $parentCategoryName = 'crossmaptv';
private $categoryDescription = array(
30 => '언제나 하나님 안에서 글을 품는 여행작가',
31 => '삶과 믿음의 지혜와 지식',
32 => '매일매일 은혜를 채우는 시간',
33 => '영어로 성경을 읽어봐요',
34 => '신앙에 질문들 모조리 답해드립니다',
);
private $cmtvCategories = array();
private $cmtvCategoryId = array();
private $cmtvCategoryDetail = array();
public function __construct()
{
parent::__construct();
$this->load->library('user_agent');
$this->cmtvCategories = $this->config->item('categories')[$this->parentCategoryName];
$this->cmtvCategoryId = array_values($this->cmtvCategories);
$this->load->library('Post', '', 'post');
$this->load->model('editor_model');
$this->load->model('category_model');
$this->load->model('config_model');
$cmtvCategoryDetail = $this->category_model->findById($this->cmtvCategoryId)->result();
foreach ($cmtvCategoryDetail as $category) {
$this->cmtvCategoryDetail[$category->idx] = $category;
}
$this->db->query("SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'");
}
private function getIndexSlide()
{
$query = $this->db->query("SELECT
`p`.`idx` `editorId`,
`p`.`partner_img` `editorImg`,
`p`.`main_img` `editorMainImg`,
`p`.`partner_name` `editorName`,
`p`.`partner_intro` `editorIntro`,
`l`.`title`,
`l`.`head_title`,
`l`.`sub_title`,
`l`.`content`,
`l`.`category_idx` `categoryId`,
`l`.`idx`,
`l`.`main_img` `mainImg`,
`l`.`hit_count` `views`,
`l`.`like_count` `likes`,
`l`.`comment_count` `comments`,
`l`.*
FROM
`life` `l`
LEFT JOIN
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
inner join cm_config c on l.idx = c.PostId
WHERE
c.Type = 'cmtv' and c.Page = 'cmtvhomehot'
AND `l`.`is_display` = 'Y'
AND `l`.`is_del` = 'N' order by c.OrderNum");
return $this->post->urify($query->result());
}
private function getCategorySlide($categoryId)
{
$query = $this->db->query("SELECT
`p`.`idx` `editorId`,
`p`.`partner_img` `editorImg`,
`p`.`main_img` `editorMainImg`,
`p`.`partner_name` `editorName`,
`p`.`partner_intro` `editorIntro`,
`l`.`title`,
`l`.`head_title`,
`l`.`sub_title`,
`l`.`content`,
`l`.`category_idx` `categoryId`,
`l`.`idx`,
`l`.`main_img` `mainImg`,
`l`.`hit_count` `views`,
`l`.`like_count` `likes`,
`l`.`comment_count` `comments`,
`l`.*
FROM
`life` `l`
LEFT JOIN
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
inner join cm_config c on l.idx = c.PostId
WHERE
c.Type = 'cmtv' and c.Page = 'categorylatest' and c.CategoryId = $categoryId
AND `l`.`is_display` = 'Y'
AND `l`.`is_del` = 'N' order by c.OrderNum");
return $this->post->urify($query->result());
}
public function index()
{
$graceHomeConfigured = $this->getIndexSlide();
if (count($graceHomeConfigured)) {
$graceHomeTopConfigured = array();
foreach($graceHomeConfigured as $c) {
$graceHomeTopConfigured[] = $c->idx;
}
$slide = $this->post->getPostsEditorRecent($this->cmtvCategoryId, 8 - count($graceHomeConfigured), 'reg_date', 'desc', $graceHomeTopConfigured);
$slide = array_merge($graceHomeConfigured, $slide);
} else {
$slide = $this->post->getPostsEditorRecent($this->cmtvCategoryId, 8, 'reg_date');
}
$ignores = array();
foreach ($slide as $s) {
array_push($ignores, $s->idx);
}
$slide2 = $this->post->getPostsByCategoryId($this->cmtvCategoryId, 8 - count($slide), 'reg_date', 'desc', $ignores);
foreach ($slide2 as $s) {
array_push($slide, $s);
}
foreach (array(
'word' => array($this->cmtvCategories['word'], $this->agent->is_mobile() ? 6 : 10),
'worship' => array($this->cmtvCategories['worship'], $this->agent->is_mobile() ? 6 : 10),
'social' => array($this->cmtvCategories['social'], $this->agent->is_mobile() ? 6 : 10),
'tv' => array($this->cmtvCategories['tv'], $this->agent->is_mobile() ? 6 : 10)) as $category => $props) {
$data[$category] = $this->post->getPostsByCategoryId($props[0], $props[1]);
}
$newUpdated = array('a');
foreach ($data as $k => $v) {
foreach ($v as $p) {
if (time() - 3600 * 24 > strtotime($p->update_date)) {
array_push($newUpdated, $k);
break;
}
}
}
$data['popularPosts'] = $this->post->getTop10($this->cmtvCategoryId);
$data['editors'] = $this->editor_model->findByCategoryId($this->cmtvCategoryId)->limit(4)->get()->result();
$data['slide'] = $slide;
$data['post'] = $slide[0];
$data['cmtvCategories'] = $this->cmtvCategoryDetail;
$data['newUpdated'] = array_merge(array('a'), $newUpdated);
$this->load->view('cmtv/cmtv', $data);
}
public function category()
{
$categoryTitle = urldecode($this->uri->segment(3));
$categoryId = $this->uri->segment(4);
if (!$categoryId) {
show_404();
}
$orderByLikes = $this->uri->segment(5);
$graceHomeConfigured = $this->getCategorySlide($categoryId);
if (count($graceHomeConfigured)) {
$graceHomeTopConfigured = array();
foreach($graceHomeConfigured as $c) {
$graceHomeTopConfigured[] = $c->idx;
}
$slide = $this->post->getPostsEditorRecent($this->cmtvCategoryId, 8 - count($graceHomeConfigured), 'reg_date', 'desc', $graceHomeTopConfigured);
$slide = array_merge($graceHomeConfigured, $slide);
} else {
$slide = $this->post->getPostsEditorRecent($categoryId, 8, 'reg_date');
}
$ignores = array();
foreach ($slide as $s) {
array_push($ignores, $s->idx);
}
$slide2 = $this->post->getPostsByCategoryId($categoryId, 8 - count($slide), 'reg_date', 'desc', $ignores);
foreach ($slide2 as $s) {
array_push($slide, $s);
}
$slideIdx = array();
foreach ($slide as $s) {
array_push($slideIdx, $s->idx);
}
$posts = $this->post->getPostsByCategoryId($categoryId, 21, $orderByLikes ? 'like_count' : 'update_date', 'desc', $slideIdx);
$postIds = array();
foreach ($posts as $p) {
array_push($postIds, $p->idx);
}
$editorTotal = $this->editor_model->findByCategoryId($categoryId)->count_all_results();
$data = array(
'slide' => $slide,
'posts' => array_slice($posts, 0, 20),
'isPostMore' => count($posts) > 20,
'post' => &$slide[0],
'editorTotal' => $editorTotal,
'isLikesOrder' => $orderByLikes,
'editors' => $this->editor_model->getEditors($categoryId, 4),
'cmtvCategories' => $this->cmtvCategoryDetail,
'categoryTitle' => $this->cmtvCategoryDetail[$categoryId]->category_name,
'categoryId' => $categoryId,
// 'categoryDescription' => $this->categoryDescription[$categoryId],
'pageInitPostIds' => array_merge($slideIdx, $postIds),
);
$data['popularPosts'] = $this->post->getTop10($categoryId);
$this->load->view('cmtv/category', $data);
}
private function getChannelEditorPick($alternativePost) {
$config = $this->config_model->findByTypeAndPage('cmtv', 'channellatest')->get()->result();
foreach($config as $c) {
if($c->CategoryId == $this->uri->segment(4)) return $this->post->getPost($c->PostId);
}
return $alternativePost;
}
public function channel()
{
$viewTypeVideos = $this->uri->segment(5);
$editorId = $this->uri->segment(4);
$posts = $this->post->getEditorPosts($editorId, $this->agent->is_mobile() ? 8 : 15, $viewTypeVideos == 'views' ? 'like_count' : 'update_date');
$postIds = array();
foreach ($posts as $p) {
array_push($postIds, $p->idx);
}
$this->load->view('cmtv/channel' . ($viewTypeVideos ? '_videos' : ''), array(
'posts' => $posts,
'post' => $this->getChannelEditorPick($posts[0]),
'editor' => $this->editor_model->findById($this->uri->segment(4)),
'cmtvCategories' => $this->cmtvCategoryDetail,
'isLikesOrder' => $viewTypeVideos == 'views',
'pageInitPostIds' => $postIds,
));
}
public function channels()
{
$orderByLikes = $this->uri->segment(5);
$categoryId = $this->uri->segment(4);
$data = array('channels' => $this->editor_model->findByCategoryId($categoryId)->limit(24)->get()->result(),
'channels' => $this->editor_model->findByCategoryId($categoryId)->limit(24)->get()->result(),
'cmtvCategories' => $this->cmtvCategoryDetail);
$data['post'] = $data['channels'][rand(0, count($data['channels']) - 1)];
$data['post']->title = $data['post']->editorName;
$data['post']->content = $data['post']->editorIntro;
$data['post']->mainImg = $data['post']->editorImg;
$this->load->view('cmtv/channels', $data);
}
public function view()
{
$postId = $this->uri->segment(3);
$data = array('post' => $this->post->getPost($postId), 'cmtvCategories' => $this->cmtvCategoryDetail);
$data['post']->views = $data['post']->views + 1;
$this->db->where('idx', $data['post']->idx)->update('life', array('hit_count' => $data['post']->views));
if ($data['post']) {
$editorPosts = $this->post->getEditorPosts($data['post']->partner_idx, 100, 'update_date', 'desc', [$data['post']->idx]);
$data['editorPost'] = $editorPosts[rand(0, count($editorPosts)-1)];
$excepts = array($data['post']->idx);
array_push($excepts, $data['editorPost']->idx);
$data['iLike'] = $this->session->userdata('C_Member_Id') ? $this->db->where('content_idx', $postId)->where('content_type', 3)->where('member_id', $this->session->userdata('C_Member_Id'))->from('like_log')->count_all_results() : false;
$recents = $this->post->getPostsByCategoryId($this->cmtvCategoryId, 1000, 'update_date', 'desc', $excepts);
shuffle($recents);
$data['recentPosts'] = array_slice($recents, 0, 15);
$this->load->view('cmtv/view', $data);
} else {
header('location:/cmtv');
}
}
public function posts()
{
$excepts = $this->input->post('excepts') ? explode(',', $this->input->post('excepts')) : array(0);
$page = $this->input->post('page');
$pageId = $this->input->post('pageId');
$orderByLikes = $this->input->post('orderBy');
$posts = $page == 'editor' ? $this->post->getEditorPosts($pageId, 10, $orderByLikes == 'views' ? 'hit_count' : 'update_date', 'desc', $excepts) :
($page == 'category' ? $this->post->getPostsByCategoryId($pageId, 10, $orderByLikes ? 'like_count' : 'update_date', 'desc', $excepts) :
$this->post->getEditorPosts($pageId, 10, $orderByLikes ? 'like_count' : 'update_date', 'desc', $excepts)
);
foreach ($posts as $k => $p) {
$posts[$k]->editorNameUrl = cleanUrl($posts[$k]->editorName);
$posts[$k]->mainImg = imgSrc($posts[$k]->mainImg);
$posts[$k]->timeAgo = time_elapsed_string($posts[$k]->reg_date);
}
echo json_encode(array('code' => 200, 'message' => 'success', 'data' => $posts));
}
}

222
application/controllers/grace.php Executable file
View File

@@ -0,0 +1,222 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Grace extends CI_Controller
{
private $categoryDescription = array(
30 => '언제나 하나님 안에서 글을 품는 여행작가',
31 => '삶과 믿음의 지혜와 지식',
32 => '매일매일 은혜를 채우는 시간',
33 => '영어로 성경을 읽어봐요',
34 => '신앙에 질문들 모조리 답해드립니다',
46 => '자료실',
);
private $graceCategories = array(30, 31, 32, 33, 34, 46);
private $graceCategoryDetail = array();
public function __construct()
{
parent::__construct();
$this->load->library('Post', '', 'post');
$this->load->model('life_model');
$this->load->model('editor_model');
$this->load->model('category_model');
$this->load->model('config_model');
$graceCategoryDetail = $this->category_model->findByParentId(35)->result();
foreach ($graceCategoryDetail as $category) {
$this->graceCategoryDetail[$category->idx] = $category;
}
}
private function getIndexSlide()
{
$query = $this->db->query("SELECT
`p`.`idx` `editorId`,
`p`.`partner_img` `editorImg`,
`p`.`main_img` `editorMainImg`,
`p`.`partner_name` `editorName`,
`p`.`partner_intro` `editorIntro`,
`l`.`title`,
`l`.`head_title`,
`l`.`sub_title`,
`l`.`content`,
`l`.`category_idx` `categoryId`,
`l`.`idx`,
`l`.`main_img` `mainImg`,
`l`.`hit_count` `views`,
`l`.`like_count` `likes`,
`l`.`comment_count` `comments`,
`l`.*
FROM
`life` `l`
LEFT JOIN
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
inner join cm_config c on l.idx = c.PostId
WHERE
c.Type = 'grace' and c.Page = 'gracehometop'
AND `l`.`is_display` = 'Y'
AND `l`.`is_del` = 'N' order by c.OrderNum");
return $this->post->urify($query->result());
}
public function index()
{
$graceHomeConfigured = $this->getIndexSlide();
if (count($graceHomeConfigured)) {
$graceHomeTopConfigured = array();
foreach($graceHomeConfigured as $c) {
$graceHomeTopConfigured[] = $c->idx;
}
$slide = $this->post->getPostsByCategoryId($this->graceCategories, 3 - count($graceHomeConfigured), 'reg_date', 'desc', $graceHomeTopConfigured);
$slide = array_merge($graceHomeConfigured, $slide);
} else {
$slide = $this->post->getPostsByCategoryId($this->graceCategories, 3, 'reg_date');
}
foreach (array(
'wordCards' => array(30, 8),
'books' => array(31, 8),
'dailyQt' => array(32, 8),
'engWords' => array(33, 2),
'qna' => array(34, 2)) as $category => $props) {
$data[$category] = $this->post->getPostsByCategoryId($props[0], $props[1]);
}
$newUpdated = array('a');
foreach ($data as $k => $v) {
foreach ($v as $p) {
if (time() - 3600 * 24 > strtotime($p->update_date)) {
array_push($newUpdated, $k);
break;
}
}
}
$data['popularPosts'] = $this->post->getPostsByCategoryId($this->graceCategories, 6, 'hit_count', 'desc');
$data['slide'] = $slide;
$data['post'] = $slide[0];
$data['graceCategories'] = $this->graceCategoryDetail;
$data['newUpdated'] = array_merge(array('a'), $newUpdated);
$this->load->view('grace/grace', $data);
}
public function category()
{
$categoryTitle = urldecode($this->uri->segment(3));
$categoryId = $this->uri->segment(4);
if(!isset($this->graceCategoryDetail[$categoryId])) {
go('/grace');
exit(301);
}
if (!$categoryId) {
show_404();
}
$orderByLikes = $this->uri->segment(5);
$cmConfig = $this->config_model->findByTypeAndNameAndPage('display', 'grace', 'submenu-top')->get();
if ($cmConfig->num_rows()) {
$cfPostId = array();
foreach ($cmConfig->result() as $cf) {
array_push($cfPostId, $cf->PostId);
}
$configuredPosts = $this->post->getPostJoin1(implode(",", $cfPostId));
if ($configuredCount = count($configuredPosts)) {
if ($configuredCount < 6) {
$slide = $this->post->getPostsByCategoryId($this->graceCategories, 6 - $configuredCount, 'reg_date', 'desc', $cfPostId);
$slide = array_merge($this->post->urify($configuredPosts), $slide);
} else {
$slide = $this->post->urify($configuredPosts);
}
} else {
$slide = $this->post->getPostsByCategoryId($this->graceCategories, 6, 'reg_date');
}
} else {
$slide = $this->post->getPostsByCategoryId($categoryId, 6, 'reg_date');
}
// print_r($slide);die;
$slideIdx = array();
foreach ($slide as $s) {
array_push($slideIdx, $s->idx);
}
$posts = $this->post->getPostsByCategoryId($categoryId, 16, $orderByLikes ? 'like_count' : 'update_date', 'desc', $slideIdx);
$postIds = array();
foreach ($posts as $p) {
array_push($postIds, $p->idx);
}
$editorTotal = $this->editor_model->findByCategoryId($categoryId)->count_all_results();
$data = array(
'slide' => $slide,
'posts' => $posts,
'post' => &$posts[0],
'editorTotal' => $editorTotal,
'isLikesOrder' => $orderByLikes,
'editors' => $this->editor_model->findByCategoryId($categoryId)->limit(6)->get()->result(),
'graceCategories' => $this->graceCategoryDetail,
'categoryTitle' => empty($this->graceCategoryDetail[$categoryId]) ? $categoryTitle : $this->graceCategoryDetail[$categoryId]->category_name,
'categoryId' => $categoryId,
'categoryDescription' => $this->graceCategoryDetail[$categoryId]->description,
'pageInitPostIds' => array_merge($slideIdx, $postIds),
);
$this->load->view('grace/category', $data);
}
public function editor()
{
$orderByLikes = $this->uri->segment(5);
$editorId = $this->uri->segment(4);
$posts = $this->post->getEditorPosts($editorId, 16, $orderByLikes ? 'like_count' : 'update_date');
$this->load->view('grace/editor', array(
'posts' => $posts,
'post' => &$posts[0],
'editor' => $this->editor_model->findById($this->uri->segment(4)),
'graceCategories' => $this->graceCategoryDetail,
'isLikesOrder' => $orderByLikes,
'pageInitPostIds' => array_map(function ($p) {return $p->idx;}, $posts),
));
}
public function view()
{
$postId = $this->uri->segment(3);
$data = array('post' => $this->post->getPost($postId), 'graceCategories' => $this->graceCategoryDetail);
if ($data['post']) {
$data['editorPosts'] = $this->post->getEditorPosts($data['post']->partner_idx, 4, 'update_date', 'desc', [$data['post']->idx]);
$excepts = array($data['post']->idx);
foreach ($data['editorPosts'] as $p) {
array_push($excepts, $p->idx);
}
$data['iLike'] = $this->session->userdata('C_Member_Id') ? $this->db->where('content_idx', $postId)->where('content_type', 3)->where('member_id', $this->session->userdata('C_Member_Id'))->from('like_log')->count_all_results() : false;
$data['recentPosts'] = $this->post->getPostsByCategoryId($this->graceCategories, 8, 'update_date', 'desc', $excepts);
$this->load->view('grace/view', $data);
} else {
header('location:/grace');
}
}
public function posts()
{
$excepts = $this->input->post('excepts') ? explode(',', $this->input->post('excepts')) : array(0);
$page = $this->input->post('page');
$pageId = $this->input->post('pageId');
$orderByLikes = $this->input->post('orderBy');
if($page == 'editor') {
$posts = $this->post->getEditorPosts($pageId, 16, $orderByLikes ? 'like_count' : 'update_date', 'desc', $excepts);
}else if($page == 'category') {
$posts = $this->post->getPostsByCategoryId($pageId, 16, $orderByLikes ? 'like_count' : 'update_date', 'desc', $excepts);
}else {
$posts = $this->post->getEditorPosts($pageId, 16, $orderByLikes ? 'like_count' : 'update_date', 'desc', $excepts);
}
foreach ($posts as $k => $p) {
$posts[$k]->editorNameUrl = cleanUrl($posts[$k]->editorName);
$posts[$k]->mainImg = imgSrc($posts[$k]->mainImg);
}
echo json_encode(array('code' => 200, 'message' => 'success', 'data' => $posts));
}
}

View File

@@ -0,0 +1,206 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class board extends cm_Controller
{
function fn_notice(){
$this->load->model('/web/m_bbs_notice');
$current_page= (isset($_GET['page'])? $_GET['page'] : 1);
$limit=10;
$req_data['offset'] = ( ($current_page-1) * $limit);
$req_data['limit'] = $limit;
if($this->input->get('search_keyword')){
$req_data['search_type'] = 'total';
$req_data['search_keyword'] = $this->input->get('search_keyword');
}
else{
$req_data['search_type'] = null;
$req_data['search_keyword'] = null;
}
$board_data = $this->m_bbs_notice->bbs_notice_list($req_data);
$board_count = $this->m_bbs_notice->bbs_notice_list_total_count($req_data);
$data = array(
"board_data" => $board_data,
"board_count" => $board_count,
"current_page"=> $current_page,
"search_keyword"=> $req_data['search_keyword'],
"total_count"=> $board_count,
"limit" => $limit
);
return $this->load->view('/m/board/notice',$data,true);
}
#---------------------------------------------------------------------------
# PURPOSE : faq
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function fn_faq() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_category1 = trim($this->input->get_post('search_category1', TRUE));
$search_category2 = trim($this->input->get_post('search_category2', TRUE));
# default setting
if($page=='') $page = '1';
# 카테고리 가져오기
$this->load->model('web/m_bbs_faq_category');
$arr_category = $this->m_bbs_faq_category->bbs_faq_category_all_list();
$arr_category1 = array(); $arr_category2 = array();
foreach ($arr_category as $val) {
if($val['depth']=='1') $arr_category1[] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name'], 'idx'=> $val['idx']);
if($val['depth']=='2') $arr_category2[$val['p_category_code']][$val['category_code']] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name'], 'idx'=> $val['idx'] , 'list'=>array());
}
if($search_category1 == '') $search_category1 = $arr_category1[0]['category_code'];
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
# faq
$req_data = array();
$req_data['search_type'] = 'title';
$req_data['search_keyword'] = $search_keyword;
$req_data['faq_category_code1'] = $search_category1;
$req_data['faq_category_code2'] = $search_category2;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_bbs_faq');
$result = $this->m_bbs_faq->bbs_faq_list($req_data);
$total_count = $this->m_bbs_faq->bbs_faq_list_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/cs/faq?search_keyword='.$search_keyword.'&search_category1='.$search_category1.'&search_category2='.$search_category2.'&page=');
$data_num = ($total_count + $limit)-($page*$limit);
foreach($result as $data){
$arr_category2[$data['faq_category_code1']][$data['faq_category_code2']]['list'][] = $data;
}
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category1'] = $search_category1;
$return_data['search_category2'] = $search_category2;
$return_data['list'] = $result;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['pagination'] = $pagination;
$return_data['data_num'] = $data_num;
// var_dump($arr_category2);
# view
return $this->load->view('/m/board/faq', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : faq 뷰
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function fn_faq_view() {
# Request
$idx = $this->uri->segment(4);
$_SESSION['read'][$idx] = true;
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_category1 = trim($this->input->get_post('search_category1', TRUE));
$search_category2 = trim($this->input->get_post('search_category2', TRUE));
$data_num = trim($this->input->get_post('data_num', TRUE));
# 카테고리 가져오기
$this->load->model('web/m_bbs_faq_category');
$arr_category = $this->m_bbs_faq_category->bbs_faq_category_all_list();
$arr_category1 = array(); $arr_category2 = array();
foreach ($arr_category as $val) {
if($val['depth']=='1') $arr_category1[] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name'], 'idx'=> $val['idx']);
if($val['depth']=='2') $arr_category2[$val['p_category_code']][] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name'], 'idx'=> $val['idx']);
}
if($search_category1 == '') $search_category1 = $arr_category1[0]['category_code'];
# model - list
$this->load->model('web/m_bbs_faq');
$result = $this->m_bbs_faq->bbs_faq_select($idx);
# faq
$req_data = array();
$req_data['search_type'] = 'title';
$req_data['search_keyword'] = $search_keyword;
$req_data['faq_category_code1'] = $search_category1;
$req_data['faq_category_code2'] = $search_category2;
$req_data['offset'] = 0;
$req_data['limit'] = 4;
$req_data['idx'] = $idx;
$next_list = $this->m_bbs_faq->bbs_faq_other_list($req_data);
$total_count = $this->m_bbs_faq->bbs_faq_list_total_count($req_data);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['result'] = $result;
$return_data['next_list'] = $next_list;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category1'] = $search_category1;
$return_data['search_category2'] = $search_category2;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['total_count'] = $total_count;
$return_data['data_num'] = $data_num;
# view
return $this->load->view('/m/board/faq_view', $return_data, true);
}
function fn_ajax_new_notice() {
# Request
$this->load->model('/web/m_bbs_notice');
echo ($this->m_bbs_notice->bbs_notice_new() > 0 ) ? true : false;
exit();
}
}

View File

@@ -0,0 +1,71 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class cmtv extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 메인
# CREATE : 2019-04-17
#---------------------------------------------------------------------------
function fn_index() {
// 말씀과 묵상
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 22;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '1';
$req_data['sort_column'] = 'a.reg_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 2;
$this->load->model('admin/life/m_life');
$this->load->model('web/m_channel');
// 말씀영상
$req_data['search_category_code2'] = '42';
$arr_words = $this->m_channel->channel_join_category_select(42);
$arr_words['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_words['data'] = $this->m_life->life_list($req_data);
//찬양영상
$req_data['search_category_code2'] = '43';
$arr_praise = $this->m_channel->channel_join_category_select(43);
$arr_praise['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_praise['data'] = $this->m_life->life_list($req_data);
// 간증
$req_data['search_category_code2'] = '44';
$arr_testimony = $this->m_channel->channel_join_category_select(44);
$arr_testimony['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_testimony['data'] = $this->m_life->life_list($req_data);
//토크쇼
$req_data['search_category_code2'] = '45';
$arr_talkshow = $this->m_channel->channel_join_category_select(45);
$arr_talkshow['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_talkshow['data'] = $this->m_life->life_list($req_data);
# view data
$return_data['channel'] = array();
$return_data['page_title_1'] = "크맵TV";
array_push($return_data['channel'], $arr_words, $arr_praise, $arr_testimony, $arr_talkshow);
// $return_data['arr_praise'] = ;
// $return_data['arr_testimony'] = ;
// $return_data['arr_talkshow'] = ;
# view
return $this->load->view('/m/cmtv/channel_recommend', $return_data, true);
}
}
?>

View File

@@ -0,0 +1,230 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class common extends cm_Controller
{
#---------------------------------------------------------------------------
# PURPOSE : 리뷰쓰기
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function fn_kmc_mobile_auth()
{
$this->load->view("/m/common/kmc_mobile_auth");
}
function fn_kmc_mobile_callback(){
$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('/m/common/kmc_mobile_auth_fin', $return_data,true);
}
function fn_ajax_kmc_encode_proc() {
# 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 = '003003'; // 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')) {
//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);
}
if($enc_tr_cert == '') {
$return_data['result'] = array('code' => '9999');
} else {
$return_data['result'] = array('code' => '0000', 'data' => $enc_tr_cert);
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
}

View File

@@ -0,0 +1,955 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class life extends cm_Controller {
function fn_index() {
$this->load->model('web/m_theme');
# theme_type = 1 (헤드라인뉴스), theme_type = 8 (오늘의칼럼), theme_type = 11 (라이프홈), theme_type = 12 (데일리큐티)
# 16 = 상단(2) , 17 = 라이프(3) , 18 = 은혜의샘(6), 19(3) = 하늘양식, 20=상단_빅원(1), 21=중상단(6)
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = array('21', '11','12','26');
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
$arr_life_home = array();
$arr_daily_cutie = array();
foreach ($arr_theme as $val) {
if($val['theme_type'] == 11) $arr_life_home[$val['rank']] = array('title' => $val['title'], 'sub_title'=> $val['sub_title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 12) $arr_daily_cutie[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 21) $arr_grace_middle[$val['rank']] = $val;
}
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 17;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '1';
$req_data['sort_column'] = 'a.reg_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 6;
$this->load->model('admin/life/m_life');
$this->load->model('web/m_channel');
// 책
$req_data['search_category_code2'] = 26;
$arr_book = $this->m_channel->channel_join_category_select(26);
$arr_book['data'] = $this->m_life->life_list($req_data);
// 카드뉴스형식 깨알은혜
$req_data['search_category_code1'] = 5;
$req_data['search_category_code2'] = 28;
$req_data['limit'] = 4;
$arr_card = $this->m_channel->channel_join_category_select(28);
$arr_card['data'] = $this->m_life->life_list($req_data);
// 영어 한구절
$req_data['search_category_code1'] = 10;
$req_data['search_category_code2'] = 7;
$req_data['limit'] = 2;
$arr_en = $this->m_channel->channel_join_category_select(7);
$arr_en['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_en['data'] = $this->m_life->life_list($req_data);
// 영어 한구절
$req_data['search_category_code1'] = 10;
$req_data['search_category_code2'] = 8;
$arr_knowledge = $this->m_channel->channel_join_category_select(8);
$arr_knowledge['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_knowledge['data'] = $this->m_life->life_list($req_data);
// 말씀엽서
$req_data['search_category_code1'] = 5;
$req_data['search_category_code2'] = 3;
$arr_post = $this->m_channel->channel_join_category_select(3);
// 운율있는 묵상
$req_data['search_category_code1'] = 8;
$req_data['search_category_code2'] = 6;
$req_data['limit'] = 4;
$arr_poem = $this->m_channel->channel_join_category_select(8);
$arr_poem['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_poem['data'] = $this->m_life->life_list($req_data);
$arr_channel =array($arr_poem, $arr_post, $arr_en, $arr_card, $arr_book);
$return_data['page_title_1'] = "은혜";
$return_data['arr_life_home'] = $arr_life_home;
$return_data['arr_daily_cutie'] = $arr_daily_cutie;
$return_data['arr_grace_middle'] = $arr_grace_middle;
$return_data['arr_book'] = $arr_book;
$return_data['arr_card'] = $arr_card;
$return_data['arr_en'] = $arr_en;
$return_data['arr_knowledge'] = $arr_knowledge;
$return_data['arr_post'] = $arr_post;
$return_data['arr_poem'] = $arr_poem;
$return_data['arr_channel'] = $arr_channel;
return $this->load->view('/m/life/main3', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 메인
# CREATE : 2018-04-10
#---------------------------------------------------------------------------
function fn_index_back() {
# Request
$search_date = trim($this->input->get_post('search_date', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$popular_page = trim($this->input->get_post('popular_page', TRUE));
$search_popular = trim($this->input->get_post('search_popular', TRUE));
# default setting
if($search_sort == '') $search_sort = '1';
if($search_date=='') $search_date = date('Y-m');
if($search_popular=='') $search_popular = '1';
# 해당월의 마지막 날짜
$end_day = date("t", strtotime($search_date));
$start_date = $search_date.'-01';
$end_date = $search_date.'-'.$end_day;
# 년월 구하기
$month = date('m', strtotime($start_date));
$month_txt = date("Y", strtotime($start_date)).'년 '.(int)$month.'월';
# 이전달
$prev_date = date('Y-m', strtotime($start_date." -1 month"));
# 다음달
$next_date = date('Y-m', strtotime($start_date." +1 month"));
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# paging 설정
$limit = 15;
$offset = 0;
# 라이프
$req_data = array();
$req_data['start_date'] = $start_date;
$req_data['end_date'] = $end_date;
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_life');
$result = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
# 인기채널
# paging 설정
if($popular_page=='') $popular_page = '1';
$popular_limit = 8;
$popular_offset = ($popular_page-1) * $popular_limit;
$req_data = array();
$req_data['offset'] = $popular_offset;
$req_data['limit'] = $popular_limit;
$req_data['sort_column'] = 'popular_count';
if($search_popular == 1) {
# model - channel
$this->load->model('web/m_channel');
$arr_popular = $this->m_channel->channel_list($req_data);
$popular_total_count = $this->m_channel->channel_list_total_count();
} if($search_popular == 2) {
$req_data['member_group_idx'] = 6;
# model - editor
$this->load->model('web/m_partner');
$arr_popular = $this->m_partner->partner_list($req_data);
$popular_total_count = $this->m_partner->partner_list_total_count($req_data);
}
$popular_max_page = ceil($popular_total_count / $popular_limit);
# channel_page
$this->load->helper('crossmap/tool_helper');
$pagination = gf_paging($popular_limit, $popular_page, $popular_max_page, '/web/life/?search_date='.$search_date.'&search_sort='.$search_sort.'&search_popular='.$search_popular.'&popular_page=');
# view data
$return_data = array();
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['start_date'] = $start_date;
$return_data['end_date'] = $end_date;
$return_data['search_date'] = $search_date;
$return_data['search_sort'] = $search_sort;
$return_data['search_popular'] = $search_popular;
$return_data['month_txt'] = $month_txt;
$return_data['prev_date'] = $prev_date;
$return_data['next_date'] = $next_date;
$return_data['list'] = $result;
$return_data['arr_popular'] = $arr_popular;
$return_data['popular_total_count'] = $popular_total_count;
$return_data['pagination'] = $pagination;
# view
return $this->load->view('/web/life/index', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 뷰
# CREATE : 2018-04-11
#---------------------------------------------------------------------------
function fn_life_view() {
setcookie("pre_page",3,0,'/');
# Request
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '3';
# model - list
$this->load->model('web/m_life');
$result = $this->m_life->life_join_editor_category_channel_select($idx);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/web/life');
exit;
}
$bookmark_count = 0;
if($SES_MEMBER_ID !='') {
# 게시물 열람 불가 체크
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['limit_type'] = '2';
# model
$this->load->model('web/m_blind_limit');
$arr_blind = $this->m_blind_limit->blind_limit_where_member_id_limit_type_select($req_data);
if(count($arr_blind) > 0) {
$return_data['arr_blind'] = $arr_blind;
$return_data['url'] = '/web/life/';
# view
return $this->load->view('/web/comm/blind_view_alert', $return_data, true);
}
# model - bookmark
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_bookmark');
$bookmark_count = $this->m_bookmark->bookmark_member_id_content_idx_count($req_data);
}
# hit count update
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$this->load->library('comm');
$this->comm->fn_hit_count_update($req_data);
# 이전글
$arr_prev = $this->m_life->life_prev_select($idx);
# 이후글
$arr_next = $this->m_life->life_next_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_prev'] = $arr_prev;
$return_data['arr_next'] = $arr_next;
$return_data['bookmark_count'] = $bookmark_count;
$return_data['result'] = $result;
# view
return $this->load->view('/m/life/life_view', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 댓글
# CREATE : 2018-04-29
#---------------------------------------------------------------------------
function fn_life_comment() {
# Request
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '3';
# model - list
$this->load->model('web/m_life');
$result = $this->m_life->life_join_editor_category_channel_select($idx);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/web/life');
exit;
}
# 북마크
$bookmark_count = 0;
if($SES_MEMBER_ID !='') {
# model - bookmark
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_bookmark');
$bookmark_count = $this->m_bookmark->bookmark_member_id_content_idx_count($req_data);
}
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['bookmark_count'] = $bookmark_count;
$return_data['result'] = $result;
# view
return $this->load->view('/m/life/life_comment', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 랭킹
# CREATE : 2018-04-29
#---------------------------------------------------------------------------
function fn_ranking() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$ranking_type = trim($this->input->get_post('ranking_type', TRUE));
$content_type = 3;
# default setting
if($ranking_type == '') $ranking_type = '1';
if($page=='') $page = '1';
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['ranking_type'] = $ranking_type;
$req_data['content_type'] = $content_type;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$this->load->model('web/m_ranking');
$result = $this->m_ranking->ranking_join_life_list($req_data);
$total_count = $this->m_ranking->ranking_join_life_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/life/ranking?ranking_type='.$ranking_type.'&page=');
# right
$theme_types = array('13', '14');
$this->load->library('comm');
$arr_life_right_comm = $this->comm->fn_life_right_comm($theme_types);
$arr_life_style = $arr_life_right_comm['arr_life_style'];
$arr_boomup_life = $arr_life_right_comm['arr_boomup_life'];
$arr_life_ranking = $arr_life_right_comm['arr_life_ranking'];
if(count($arr_life_style) > 0) {
array_splice($arr_life_style, 2, count($arr_life_style));
}
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['list'] = $result;
$return_data['arr_life_style'] = $arr_life_style;
$return_data['arr_boomup_life'] = $arr_boomup_life;
$return_data['arr_life_ranking'] = $arr_life_ranking;
$return_data['pagination'] = $pagination;
$return_data['ranking_type'] = $ranking_type;
# view
return $this->load->view('/web/life/ranking', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 채널 홈
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_channel() {
# Request
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '3';
# channel 정보
$this->load->model('web/m_channel');
$result = $this->m_channel->channel_join_category_select($idx);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/web/life');
exit;
}
if($search_sort == '') $search_sort = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# 배달여부
$this->load->model('web/m_delivery');
$channel_delivery_count = 0;
if($SES_MEMBER_ID != '') {
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['main_idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$arr_column_delivery = $this->m_delivery->delivery_where_member_id_main_idx_select($req_data);
$channel_delivery_count = count($arr_column_delivery);
}
# 채널글
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = 0;
$req_data['limit'] = 15;
$req_data['search_type'] = 'channel_idx';
$req_data['search_key'] = $idx;
# model - list
$this->load->model('web/m_life');
$list = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
# 배달수
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['main_idx'] = $idx;
$channel_delivery_total_count = $this->m_delivery->delivery_where_main_idx_count($req_data);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['search_sort'] = $search_sort;
$return_data['channel_delivery_count'] = $channel_delivery_count;
$return_data['result'] = $result;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
$return_data['channel_delivery_total_count'] = $channel_delivery_total_count;
# view
return $this->load->view('/m/life/channel', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : life_list_more
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_ajax_life_list_more() {
# request
$sort = trim($this->input->get_post('sort', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$channel_idx = trim($this->input->get_post('channel_idx', TRUE));
$partner_idx = trim($this->input->get_post('partner_idx', TRUE));
$type = trim($this->input->get_post('type', TRUE));
$start_date = trim($this->input->get_post('start_date', TRUE));
$end_date = trim($this->input->get_post('end_date', TRUE));
switch ($sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
if($type == 'main') {
$limit = 15;
$offset = ($page-1) * $limit;
# 라이프
$req_data = array();
$req_data['start_date'] = $start_date;
$req_data['end_date'] = $end_date;
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$view_url = '/m/life/life_main_list_more';
} else {
if($partner_idx!='') {
$search_type = 'partner_idx';
$search_key = $partner_idx;
$limit = 8;
$offset = ($page-1) * $limit;
$view_url = '/m/life/editor_life_list_more';
} else {
$search_type = 'channel_idx';
$search_key = $channel_idx;
$limit = 15;
$offset = ($page-1) * $limit;
$view_url = '/m/life/life_list_more';
}
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['search_type'] = $search_type;
$req_data['search_key'] = $search_key;
}
# model - list
$this->load->model('web/m_life');
$list = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
if(count($list) > 0) {
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
$return_data['page'] = $page;
} else {
$return_data['result_code'] = '9999';
}
# view
return $this->load->view($view_url, $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 에디터 홈
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_editor() {
# Request
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$idx = $this->uri->segment(4);
# editor 정보
$this->load->model('web/m_partner');
$result = $this->m_partner->partner_join_category_channel_select($idx);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/m/life');
exit;
}
if($search_sort == '') $search_sort = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# 에디터글
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = 0;
$req_data['limit'] = 8;
$req_data['search_type'] = 'partner_idx';
$req_data['search_key'] = $idx;
# model - list
$this->load->model('web/m_life');
$list = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['search_sort'] = $search_sort;
$return_data['result'] = $result;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
# view
return $this->load->view('/m/life/editor', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 추천채널
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_channel_recommend() {
# 추천채널
$etc_section_type = 1;
$this->load->model('web/m_life_etc_section');
$arr_etc_section = $this->m_life_etc_section->life_etc_section_join_channel_list($etc_section_type);
$result = $this->m_life_etc_section->life_etc_section_detail_join_life_list($etc_section_type);
$arr_etc_section_detail = array();
foreach ($result as $val) {
$arr_etc_section_detail[$val['life_etc_section_idx']][$val['rank']] = array('head_title'=>$val['head_title'], 'title'=>$val['title'], 'partner_idx' => $val['partner_idx'], 'editor_name' => $val['editor_name'], 'main_img' => $val['main_img'], 'content_idx' => $val['content_idx']);
}
# view data
$return_data = array();
$return_data['arr_etc_section'] = $arr_etc_section;
$return_data['arr_etc_section_detail'] = $arr_etc_section_detail;
# view
return $this->load->view('/m/life/channel_recommend', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 카테고리
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_category() {
# Request
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$category_idx = $this->uri->segment(4);
if($search_sort == '') $search_sort = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'reg_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'reg_date'; break;
}
# 카테고리
$this->load->model('web/m_category');
$arr_category = $this->m_category->category_all_list();
if(count($arr_category)==0) {
gf_alert("등록된 카테고리가 없습니다.", '/web/life');
exit;
}
if($category_idx == '') {
$category_idx = $arr_category[0]['idx'];
$category_name = $arr_category[0]['category_name'];
$swiper_page = 0;
} else {
foreach($arr_category as $key => $val) {
if($val['idx'] == $category_idx) {
$swiper_page = $key;
$category_name = $val['category_name'];
break;
}
}
}
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = 0;
$req_data['limit'] = 8;
$req_data['search_type'] = 'category_idx';
$req_data['search_key'] = $category_idx;
$req_data['member_group_idx'] = '6';
# editor list
$this->load->model('web/m_partner');
$result = $this->m_partner->partner_life_aritcle_count_list($req_data);
$total_count = $this->m_partner->partner_list_total_count($req_data);
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['search_sort'] = $search_sort;
$return_data['arr_category'] = $arr_category;
$return_data['category_idx'] = $category_idx;
$return_data['category_name'] = $category_name;
$return_data['swiper_page'] = $swiper_page;
# view
return $this->load->view('/m/life/category', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : editor_list_more
# CREATE : 2018-05-01
#---------------------------------------------------------------------------
function fn_ajax_editor_list_more() {
# request
$sort = trim($this->input->get_post('sort', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$category_idx = trim($this->input->get_post('category_idx', TRUE));
switch ($sort) {
case '2': $sort_column = 'popular_count'; break;
case '1': $sort_column = 'reg_date'; break;
default : $sort_column = 'reg_date'; break;
}
$limit = 8;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['search_type'] = 'category_idx';
$req_data['search_key'] = $category_idx;
$req_data['member_group_idx'] = '6';
# editor list
$this->load->model('web/m_partner');
$list = $this->m_partner->partner_life_aritcle_count_list($req_data);
$total_count = $this->m_partner->partner_list_total_count($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
if(count($list) > 0) {
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
} else {
$return_data['result_code'] = '9999';
}
# view
return $this->load->view("/web/life/editor_list_more", $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : tag
# CREATE : 2018-05-01
#---------------------------------------------------------------------------
function fn_tag() {
# Request
$tag = $this->uri->segment(4);
$content_type = '3';
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$tag = urldecode($tag);
# tag
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['tag'] = $tag;
$this->load->model('web/m_tag');
$total_count = $this->m_tag->tag_join_life_list_total_count($req_data);
if($total_count == 0) {
gf_alert("등록된 태그가 없습니다.", '/web/life');
exit;
}
# 배달여부
$this->load->model('web/m_delivery');
$tag_delivery_count = 0;
if($SES_MEMBER_ID != '') {
$req_data = array();
$req_data['content_type'] = '9';
$req_data['main_idx'] = $tag;
$req_data['member_id'] = $SES_MEMBER_ID;
$arr_column_delivery = $this->m_delivery->delivery_where_member_id_main_idx_select($req_data);
$tag_delivery_count = count($arr_column_delivery);
}
$this->load->model('web/m_tag');
# 연관태그
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['tag'] = $tag;
$arr_relation_tag = $this->m_tag->tag_join_tag_list($req_data);
# 태그글
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['tag'] = $tag;
$req_data['offset'] = 0;
$req_data['limit'] = 9;
$result = $this->m_tag->tag_join_life_list($req_data);
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['tag_delivery_count'] = $tag_delivery_count;
$return_data['tag'] = $tag;
$return_data['arr_relation_tag'] = $arr_relation_tag;
# view
return $this->load->view('/m/life/tag', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : tag_list_more
# CREATE : 2018-05-01
#---------------------------------------------------------------------------
function fn_ajax_tag_list_more() {
# request
$page = trim($this->input->get_post('page', TRUE));
$tag = trim($this->input->get_post('tag', TRUE));
$content_type = '3';
$limit = 9;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['tag'] = $tag;
$req_data['content_type'] = $content_type;
$this->load->model('web/m_tag');
$list = $this->m_tag->tag_join_life_list($req_data);
$total_count = $this->m_tag->tag_join_life_list_total_count($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
if(count($list) > 0) {
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
} else {
$return_data['result_code'] = '9999';
}
# view
return $this->load->view("/m/life/tag_list_more", $return_data);
}
}
?>

View File

@@ -0,0 +1,274 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class main extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 모바일 메인
# CREATE :
#---------------------------------------------------------------------------
function fn_index() {
$now_date = date("Y-m-d");
# 오늘의 말씀
$this->load->model('web/m_today_word');
$arr_today_word = $this->m_today_word->today_word_where_display_date_select($now_date);
# 테마
# theme_type = 1 (헤드라인뉴스), theme_type = 8 (오늘의칼럼), theme_type = 11 (라이프홈), theme_type = 12 (데일리큐티)
# 16 = 상단(2) , 17 = 라이프(3) , 18 = 은혜의샘(6), 19(3) = 하늘양식, 20=상단_빅원(1), 21=중상단(6)
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = array('1','16', '17', '18','19','20','21','8', '3','6');
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
// echo $this->db->last_query();
$arr_headline_news = array();
$arr_life_home = array();
$arr_daily_cutie = array();
$arr_grace_top = array();
$arr_grace_life = array();
$arr_grace_well = array();
$arr_grace_sky = array();
$arr_grace_bigone = array();
$arr_grace_middle = array();
$arr_headline_column = array();
$arr_p_video = array();
$a = array();
$i = 0;
foreach ($arr_theme as $val) {
if($val['theme_type'] == 1) $arr_headline_news[$val['rank']] = $val;
if($val['theme_type'] == 16) $arr_grace_top[$val['rank']] = $val;
if($val['theme_type'] == 17) $arr_grace_life[$val['rank']] = $val;
if($val['theme_type'] == 18) $arr_grace_well[$val['rank']] = $val;
if($val['theme_type'] == 19) $arr_grace_sky[$val['rank']] = $val;
if($val['theme_type'] == 20) $arr_grace_bigone[$val['rank']] = $val;
if($val['theme_type'] == 21) $arr_grace_middle[$val['rank']] = $val;
if($val['theme_type'] == 8) $arr_headline_column[$val['rank']] = $val;
}
# 기타섹션 - 인기영상 1 / 인기포토 2
$this->load->model('web/m_etc_section');
$req_data = array();
$req_data['etc_section_types'] = array('3');
$arr_etc_section = $this->m_etc_section->etc_section_where_in_etc_section_type_list($req_data);
$arr_p_photo = array();
$arr_p_video = array();
foreach ($arr_etc_section as $val) {
if($val['etc_section_type'] == 3) $arr_etc_video[$val['rank']] = $val;
}
# 카드뉴스 - 기타섹션 테마
$this->load->model('web/m_etc_section');
$etc_section_type = 4;
$arr_card_news = $this->m_etc_section->etc_section_where_theme_type_list($etc_section_type);
# 언론
$this->load->model('web/m_press');
$arr_press = $this->m_press->press_all_list();
# 카테고리별
$this->load->model('web/m_main_category_company');
$arr_company = $this->m_main_category_company->main_category_company_all_list();
#상단채널
$this->load->model('web/m_life_etc_section');
$arr_chanel = $this->m_life_etc_section->life_etc_section_join_channel_list(array(3,4,5,6));
#임의 체널
$arr_random_chanel = $this->m_life_etc_section->life_etc_section_detail_list(34);
foreach ($arr_chanel as $val) {
switch ($val['etc_section_type']){
#하단인기베스트
case 3:
$arr_p_best = $val;
break;
#추천에디터
case 6:
$arr_recom_editor = $val;
break;
}
}
$return_data = array();
/*
메인 화면 출력용 데이터
*/
$this->load->model('admin/etc_section/m_life_etc_section');
// $total_count = $this->m_life_etc_section->life_editor_etc_section_list_total_count($req_data);
$rd = array(
"search_type" => "","search_keyword"=>"","search_category"=>"",
"search_etc_section_type"=>5,
"sort_column"=>"reg_date",
"offset"=>"0",
"limit"=>"1");
$aa = $this->m_life_etc_section->life_editor_etc_section_list($rd);
$arr_mid_bigone = $this->m_life_etc_section->life_etc_section_detail_list($aa[0]['idx']);
// echo $this->db->last_query();
$return_data['bigone_main'] = $aa[0];
$return_data['arr_today_word'] = $arr_today_word;
#뉴스
$return_data['arr_headline_news'] = $arr_headline_news;
#라이프
$return_data['arr_life_home'] = $arr_life_home;
$return_data['arr_daily_cutie'] = $arr_daily_cutie;
#카드뉴스
$return_data['arr_card_news'] = $arr_card_news;
$return_data['arr_press'] = $arr_press;
$return_data['arr_company'] = $arr_company;
#탑6
$return_data['arr_grace_top'] = $arr_grace_top;
#라이프 테마
$return_data['arr_grace_life'] = $arr_grace_life;
#은혜의 샘
$return_data['arr_grace_well'] = $arr_grace_well;
#하늘양식
$return_data['arr_grace_sky'] = $arr_grace_sky;
#빅원
$return_data['arr_grace_bigone'] = $arr_grace_bigone;
#중상단
$return_data['arr_grace_middle'] = $arr_grace_middle;
#컬럼
$return_data['arr_headline_column'] = $arr_headline_column;
#은혜로운 영상
$return_data['arr_etc_video'] = $arr_etc_video;
#임의 채널
$return_data['arr_random_chanel'] = $arr_random_chanel;
#임의 채널
$return_data['arr_p_best'] = $arr_p_best;
#임의 채널
$return_data['arr_mid_bigone'] = $arr_mid_bigone;
#임의 채널
$return_data['arr_recom_editor'] = $arr_recom_editor;
# Request
$search_date = trim($this->input->get_post('search_date', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$popular_page = trim($this->input->get_post('popular_page', TRUE));
$search_popular = trim($this->input->get_post('search_popular', TRUE));
# default setting
if($search_sort == '') $search_sort = '1';
if($search_date=='') $search_date = date('Y-m');
if($search_popular=='') $search_popular = '1';
# 해당월의 마지막 날짜
$end_day = date("t", strtotime($search_date));
$start_date = $search_date.'-01';
$end_date = $search_date.'-'.$end_day;
# 년월 구하기
$month = date('m', strtotime($start_date));
$month_txt = date("Y", strtotime($start_date)).'년 '.(int)$month.'월';
# 이전달
$prev_date = date('Y-m', strtotime($start_date." -1 month"));
# 다음달
$next_date = date('Y-m', strtotime($start_date." +1 month"));
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# paging 설정
$limit = 15;
$offset = 0;
# 라이프
$req_data = array();
$req_data['start_date'] = $start_date;
$req_data['end_date'] = $end_date;
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_life');
$result = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
// $this->load->model('admin/etc_section/m_life_etc_section');
$req_data = array("etc_section_type"=>4);
$return_data['arr_etc_section'] = $this->m_life_etc_section->life_etc_section_type_list($req_data);
$arr_life_etc_section_detail_rank = array();
$arr_etc_section_detail = $this->m_life_etc_section->life_etc_section_detail_type_list($req_data);
// var_dump($arr_etc_section_detail);
foreach ($arr_etc_section_detail as $val) {
$arr_life_etc_section_detail_rank[$val['life_etc_section_idx']][$val['rank']] = array('main_img'=> $val['main_img'], 'head_title'=> $val['head_title'], 'title'=> $val['title'], 'content_idx'=> $val['content_idx'], 'hit_count'=>$val['hit_count'], 'editor_name'=>$val['editor_name']);
// print_r($val);
}
// $result2 = $this->m_life_etc_section->life_etc_section_detail_list($idx);
$return_data['arr_etc_section_detail'] = $arr_life_etc_section_detail_rank;
$return_data['life'] = $result;
$this->load->helper('crossmap/tool_helper');
$this->load->model('web/m_contents_setting');
$return_data['arr_news_setting'] = $this->m_contents_setting->contents_setting_select(1);
return $this->load->view('/m/m_index', $return_data, true);
// return $this->load->view('/m/common/footer');
}
}
?>

View File

@@ -0,0 +1,104 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class main2 extends cm_Controller {
function fn_index() {
$this->load->model('web/m_theme');
# theme_type = 1 (헤드라인뉴스), theme_type = 8 (오늘의칼럼), theme_type = 11 (라이프홈), theme_type = 12 (데일리큐티)
# 16 = 상단(2) , 17 = 라이프(3) , 18 = 은혜의샘(6), 19(3) = 하늘양식, 20=상단_빅원(1), 21=중상단(6)
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = array('21', '11','12','26');
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
$arr_life_home = array();
$arr_daily_cutie = array();
foreach ($arr_theme as $val) {
if($val['theme_type'] == 11) $arr_life_home[$val['rank']] = array('title' => $val['title'], 'sub_title'=> $val['sub_title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 12) $arr_daily_cutie[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 21) $arr_grace_middle[$val['rank']] = $val;
}
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 17;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '1';
$req_data['sort_column'] = 'a.reg_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 6;
$this->load->model('admin/life/m_life');
$this->load->model('web/m_channel');
// 책
$req_data['search_category_code2'] = 26;
$arr_book = $this->m_channel->channel_join_category_select(26);
$arr_book['data'] = $this->m_life->life_list($req_data);
// 카드뉴스형식 깨알은혜
$req_data['search_category_code1'] = 5;
$req_data['search_category_code2'] = 28;
$req_data['limit'] = 4;
$arr_card = $this->m_channel->channel_join_category_select(28);
$arr_card['data'] = $this->m_life->life_list($req_data);
// 영어 한구절
$req_data['search_category_code1'] = 10;
$req_data['search_category_code2'] = 7;
$req_data['limit'] = 2;
$arr_en = $this->m_channel->channel_join_category_select(7);
$arr_en['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_en['data'] = $this->m_life->life_list($req_data);
// 영어 한구절
$req_data['search_category_code1'] = 10;
$req_data['search_category_code2'] = 8;
$arr_knowledge = $this->m_channel->channel_join_category_select(8);
$arr_knowledge['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_knowledge['data'] = $this->m_life->life_list($req_data);
// 말씀엽서
$req_data['search_category_code1'] = 5;
$req_data['search_category_code2'] = 3;
$arr_post = $this->m_channel->channel_join_category_select(3);
// 운율있는 묵상
$req_data['search_category_code1'] = 8;
$req_data['search_category_code2'] = 6;
$req_data['limit'] = 4;
$arr_poem = $this->m_channel->channel_join_category_select(8);
$arr_poem['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_poem['data'] = $this->m_life->life_list($req_data);
$arr_channel =array($arr_poem, $arr_post, $arr_en, $arr_card, $arr_book);
$return_data['page_title_1'] = "은혜";
$return_data['arr_life_home'] = $arr_life_home;
$return_data['arr_daily_cutie'] = $arr_daily_cutie;
$return_data['arr_grace_middle'] = $arr_grace_middle;
$return_data['arr_book'] = $arr_book;
$return_data['arr_card'] = $arr_card;
$return_data['arr_en'] = $arr_en;
$return_data['arr_knowledge'] = $arr_knowledge;
$return_data['arr_post'] = $arr_post;
$return_data['arr_poem'] = $arr_poem;
$return_data['arr_channel'] = $arr_channel;
return $this->load->view('/m/life/main3', $return_data, true);
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,677 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class mypage extends cm_Controller
{
function fn_qna(){
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
$search_type = isset($search_keyword) ? "total" : "";
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", 'back');
exit;
}
# default setting
if($page=='') $page = '1';
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
# 1:1문의
$req_data = array();
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = $search_keyword;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['member_id'] = $SES_MEMBER_ID;
# model - list
$this->load->model('web/m_bbs_question');
$result = $this->m_bbs_question->bbs_question_where_member_id_list($req_data);
$total_count = $this->m_bbs_question->bbs_question_where_member_id_list_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/m/mypage/qna?search_type='.$search_type.'&search_keyword='.$search_keyword.'&page=');
// var_dump($pagination);
$data_num = ($total_count + $limit)-($page*$limit);
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['data_num'] = $data_num;
$return_data['pagination'] = $pagination;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
return $this->load->view("/m/mypage/qna",$return_data,true);
}
function fn_qna_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($SES_MEMBER_ID == '') {
gf_alert("회원로그인 후에 가능합니다.", '/m/mypage/qna');
exit;
}
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", 'back');
exit;
}
# model
$this->load->model('web/m_bbs_question');
$now_date = date("Y-m-d H:i:s");
foreach ($arr_idx as $key=>$val) {
$req_data = array();
$req_data['idx'] = $val;
$req_data['write_id'] = $SES_MEMBER_ID;
$count = $this->m_bbs_question->bbs_question_write_id_idx_count($req_data);
if($count > 0) {
$arr_update_data1 = array();
$arr_update_data1[$key]['idx'] = $val;
$arr_update_data1[$key]['is_del'] = 'Y';
$arr_update_data1[$key]['update_id'] = $SES_MEMBER_ID;
$arr_update_data1[$key]['update_date'] = $now_date;
$this->m_bbs_question->bbs_question_is_del_update_batch($arr_update_data1);
$arr_update_data2 = array();
$arr_update_data2[$key]['p_idx'] = $val;
$arr_update_data2[$key]['is_del'] = 'Y';
$arr_update_data2[$key]['update_id'] = $SES_MEMBER_ID;
$arr_update_data2[$key]['update_date'] = $now_date;
$this->m_bbs_question->bbs_question_p_idx_is_del_update_batch($arr_update_data2);
}
}
gf_alert("삭제되었습니다.", '/m/mypage/qna');
}
function fn_qna_add() {
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", 'back');
exit;
}
# view
return $this->load->view('/m/mypage/qna_add', '', true);
}
function fn_qna_add_proc() {
# Request
$title = trim($this->input->get_post('title', TRUE));
$content = trim($this->input->get_post('content', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_NICNAME = $this->session->userdata('C_Member_Nicname');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", 'back');
exit;
}
# model
$this->load->model('web/m_bbs_question');
# max idx 가져오기
$result = $this->m_bbs_question->bbs_question_max_idx_select();
$max_idx = $result['max_idx']+1;
$now_date = date("Y-m-d H:i:s");
$req_data = array();
$req_data['title'] = $title;
$req_data['content'] = $content;
$req_data['idx'] = $max_idx;
$req_data['p_idx'] = $max_idx;
$req_data['s_idx'] = '1';
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['write_id'] = $SES_MEMBER_ID;
$req_data['write_name'] = $SES_MEMBER_NICNAME;
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = $SES_MEMBER_ID;
$req_data['update_date']= $now_date;
# insert
$this->m_bbs_question->bbs_question_insert($req_data);
gf_alert("등록되었습니다.", '/m/mypage/qna');
}
function fn_bookmark() {
# Request
$search_keyword_txt = trim($this->input->get('search_keyword', TRUE));
$page = trim($this->input->get('page', TRUE));
if($page=='') $page = '1';
$limit = 20;
$offset = ($page-1) * $limit;
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", 'back');
exit;
}
# 북마크
$req_data = array();
$req_data['search_type'] = 'total';
$req_data['search_keyword'] = isset($search_keyword_txt) ?$search_keyword_txt :"";
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['member_id'] = $SES_MEMBER_ID;
# model - list
$this->load->model('web/m_bookmark');
$total_count = $this->m_bookmark->bookmark_join_vw_content_list_total_count($req_data);
# paging 설정
$offset = ($page-1) * $limit;
$max_page = ceil($total_count / $limit);
$result = $this->m_bookmark->bookmark_join_vw_content_list($req_data);
$pagination = gf_paging($limit, $page, $max_page, '/m/mypage/bookmark?search_keyword='.$search_keyword_txt.'&page=');
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['search_keyword'] = $search_keyword_txt;
$return_data['pagination'] = $pagination;
# view
return $this->load->view('/m/mypage/bookmark', $return_data, true);
}
function fn_delivery(){
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", 'back');
exit;
}
return $this->load->view('/m/mypage/delivery',null,true);
}
#---------------------------------------------------------------------------
# PURPOSE : delivery list
# CREATE : 2018-05-07
#---------------------------------------------------------------------------
function fn_ajax_delivery_list() {
# request
$page = trim($this->input->get_post('page', TRUE));
$content_type = trim($this->input->get_post('content_type', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$limit = 15;
$offset = ($page-1) * $limit;
$this->load->model('web/m_delivery');
# 채널
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['offset'] = $offset < 0 ? 0 : $offset;
$req_data['limit'] = $limit;
$req_data['member_id'] = $SES_MEMBER_ID;
if($content_type == '2') {
# model
$list = $this->m_delivery->delivery_join_partner_list($req_data);
$total_count = $this->m_delivery->delivery_join_partner_list_total_count($req_data);
} else if($content_type == '3') {
# model
$list = $this->m_delivery->delivery_join_channel_list($req_data);
$total_count = $this->m_delivery->delivery_join_channel_list_total_count($req_data);
} else if($content_type == '9') {
# model
$list = $this->m_delivery->delivery_join_tag_list($req_data);
$total_count = $this->m_delivery->delivery_join_tag_list_total_count($req_data);
}
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
$this->load->view("/m/mypage/delivery_list", $return_data);
}
function fn_req_password() {
return $this->load->view("/m/mypage/req_password",null,true);
}
function fn_member_edit() {
$this->load->helper('cookie');
$crossmap_passwd_check = get_cookie('crossmap_passwd_check');
if($crossmap_passwd_check != 'Y') {
gf_alert("잘못된 접근입니다.", '/m/mypage/req_password');
exit;
}
// set_cookie('crossmap_passwd_check', 'N', 0);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", 'back');
exit;
}
# model - list
$this->load->model('web/m_member');
$result = $this->m_member->member_where_member_id_select($SES_MEMBER_ID);
if(count($result) == 0){
gf_alert("잘못된 접근입니다.2", '/m');
exit;
}
# view data
$return_data = array();
$return_data['result'] = $result;
# view
return $this->load->view('/m/mypage/member_edit', $return_data, true);
}
function fn_user_comment(){
if(!isset($_GET['id'])){
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", 'back');
exit;
}
}
return $this->load->view('/m/mypage/user_comment_inc',null, true);
}
#---------------------------------------------------------------------------
# PURPOSE : user_comment list
# CREATE : 2018-05-08
#---------------------------------------------------------------------------
function fn_ajax_user_comment_list() {
# request
$page = trim($this->input->get_post('page', TRUE));
$content_type = trim($this->input->get_post('content_type', TRUE));
$write_id = trim($this->input->get_post('write_id', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
switch ($sort) {
case '4': $sort_column = 'reply_count'; $sort_type = 'desc'; break;
case '3': $sort_column = 'reg_date'; $sort_type = 'asc'; break;
case '2': $sort_column = 'reg_date'; $sort_type = 'desc'; break;
case '1': $sort_column = 'like_count'; $sort_type = 'desc'; break;
default : $sort_column = 'reg_date'; $sort_type = 'desc'; break;
}
$this->load->helper('cookie');
$comment_sns_id = get_cookie('crossmap_comment_sns_id');
$limit = 15;
$offset = ($page-1) * $limit;
$is_comment_view = 'N';
if($comment_sns_id != '') {
if($content_type =='3') {
if($write_id==$comment_sns_id) $is_comment_view = 'Y';
} else {
$is_comment_view = 'Y';
}
}
$total_count = 0;
$list = array();
if($is_comment_view == 'Y') {
# 댓글
$this->load->model('web/m_comment');
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['write_id'] = $write_id;
# 총댓글수 + 답글
$total_count = $this->m_comment->comment_join_vw_content_where_write_id_list_count($req_data);
# 댓글 리스트
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['sort_column'] = $sort_column;
$req_data['sort_type'] = $sort_type;
$req_data['write_id'] = $write_id;
# list
$list = $this->m_comment->comment_join_vw_content_where_write_id_list($req_data);
}
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
$return_data = array();
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
# view
return $this->load->view("/m/mypage/user_comment_list", $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 댓글 삭제
# CREATE : 2018-05-07
#---------------------------------------------------------------------------
function fn_ajax_user_comment_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$this->load->helper('cookie');
$comment_sns_id = get_cookie('crossmap_comment_sns_id');
if($comment_sns_id == '') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
# model
$this->load->model('web/m_comment');
$this->load->model('web/m_comment_setting');
$req_data = array();
$req_data['idx'] = $idx;
$req_data['write_id'] = $comment_sns_id;
$arr_comment = $this->m_comment->comment_member_id_idx_select($req_data);
if(count($arr_comment) == 0) {
throw new Cm_Exception('json', '9999', '삭제할수 없는 댓글입니다.');
} else {
$content_type = $arr_comment['content_type'];
$comment_org = $arr_comment['comment'];
$arr_setting = $this->m_comment_setting->comment_setting_where_content_idx_select($content_type);
$comment = '작성자에 의해 삭제된 댓글입니다.';
if(isset($arr_setting['self_del_contnet'])==true) {
$comment = $arr_setting['self_del_contnet'];
}
$req_data = array();
$req_data['idx'] = $idx;
$req_data['comment'] = $comment;
$req_data['comment_org'] = $comment_org;
$req_data['del_date'] = date("Y-m-d H:i:s");
$req_data['is_del'] = 'Y';
$req_data['comment_status'] = '4';
$result = $this->m_comment->comment_is_del_update($req_data);
}
if($result) {
$return_data['result'] = array('code' => '0000');
} else {
$return_data['result'] = array('code' => '9999');
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
function fn_ajax_comment_reply_list() {
# request
$p_idx = trim($this->input->get_post('comment_idx', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
$type = trim($this->input->get_post('type', TRUE));
switch ($sort) {
case '4': $sort_column = 'like_count'; $sort_type = 'desc'; break;
case '3': $sort_column = 'reg_date'; $sort_type = 'asc'; break;
case '2': $sort_column = 'reg_date'; $sort_type = 'desc'; break;
case '1': $sort_column = 'like_count'; $sort_type = 'desc'; break;
default : $sort_column = 'reg_date'; $sort_type = 'desc'; break;
}
# paging 설정
if($page == '') $page = 1;
$limit = 10;
if($type == 'user_comment') $limit = 50;
$offset = ($page-1) * $limit;
# 검색
$req_data = array();
$req_data['p_idx'] = $p_idx;
$req_data['sort_column'] = $sort_column;
$req_data['sort_type'] = $sort_type;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_comment');
# 총댓글수
$total_count = $this->m_comment->comment_where_p_idx_count($p_idx);
$arr_comment = $this->m_comment->comment_child_list($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
# view data
$return_data = array();
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['arr_comment'] = $arr_comment;
$return_data['more_list'] = $more_list;
# view
if($type == 'user_comment') {
return $this->load->view('/m/mypage/user_comment_reply_list', $return_data);
} else {
return $this->load->view('/m/mypage/comment_reply_list', $return_data);
}
}
}

View File

@@ -0,0 +1,660 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class news extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 뷰
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function fn_news_view() {
# Request
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '1';
$bookmark_count = 0;
$arr_review = array();
if($SES_MEMBER_ID !='') {
# 게시물 열람 불가 체크
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['limit_type'] = '2';
# model
$this->load->model('web/m_blind_limit');
$arr_blind = $this->m_blind_limit->blind_limit_where_member_id_limit_type_select($req_data);
if(count($arr_blind) > 0) {
$return_data['arr_blind'] = $arr_blind;
$return_data['url'] = '/web/news/';
# view
return $this->load->view('/web/comm/blind_view_alert', $return_data, true);
}
# model - bookmark
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_bookmark');
$bookmark_count = $this->m_bookmark->bookmark_member_id_content_idx_count($req_data);
# model - review
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_review_log');
$arr_review = $this->m_review_log->review_log_where_member_id_content_idx_select($req_data);
}
# hit count update
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$this->load->library('comm');
$this->comm->fn_hit_count_update($req_data);
# model - news view
$this->load->model('web/m_news');
$result = $this->m_news->news_join_news_section_press_select($idx);
# 연관글
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_relation_article');
$arr_relation_news = $this->m_relation_article->relation_article_join_news_list($req_data);
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_where_news_idx_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_relation_news'] = $arr_relation_news;
$return_data['arr_weather'] = $arr_weather;
$return_data['arr_review'] = $arr_review;
$return_data['bookmark_count'] = $bookmark_count;
$return_data['result'] = $result;
# view
return $this->load->view('/m/news/news_view', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 컬럼 메인
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_column() {
# 칼럼
$req_data = array();
$req_data['sort_column'] = 'reg_date';
$req_data['offset'] = 0;
$req_data['limit'] = 6;
# model - list
$this->load->model('web/m_column');
$result = $this->m_column->column_list($req_data);
$total_count = $this->m_column->column_total_count();
# 칼럼리스트
$req_data = array();
$req_data['member_group_idx'] = 7;
$req_data['sort_column'] = 'display_sort';
$this->load->model('web/m_partner');
$arr_columnist = $this->m_partner->partner_all_list($req_data);
# 테마
# 7: 헤드라인칼럼
$theme_types = array('7', '15');
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = $theme_types;
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
$arr_recomm_life = array();
$arr_headline_column = array();
foreach ($arr_theme as $val) {
if($val['theme_type'] == 7) $arr_headline_column[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'column_name'=> $val['column_name'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx'], 'partner_idx' => $val['partner_idx'], 'content' => $val['content']);
if($val['theme_type'] == 15) $arr_recomm_life[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
}
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['arr_columnist'] = $arr_columnist;
$return_data['arr_headline_column'] = $arr_headline_column;
$return_data['arr_recomm_life'] = $arr_recomm_life;
# view
return $this->load->view('/m/news/column', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : column list more
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_ajax_column_list_more() {
# request
$page = trim($this->input->get_post('page', TRUE));
# paging 설정 -- 2page 부터 시작이고 1페이지는 6개였음.
$limit = 10;
$offset = ($page-2) * $limit;
$offset = $offset + 6;
# 검색
$req_data = array();
$req_data['sort_column'] = 'reg_date';
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_column');
$arr_column = $this->m_column->column_list($req_data);
$total_count = $this->m_column->column_total_count();
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
# view data
$return_data = array();
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $arr_column;
$return_data['more_list'] = $more_list;
# view
return $this->load->view('/m/news/column_list_more', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 컬럼 뷰
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_column_view() {
# Request
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '2';
$bookmark_count = 0;
if($SES_MEMBER_ID !='') {
# 게시물 열람 불가 체크
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['limit_type'] = '2';
# model
$this->load->model('web/m_blind_limit');
$arr_blind = $this->m_blind_limit->blind_limit_where_member_id_limit_type_select($req_data);
if(count($arr_blind) > 0) {
$return_data['arr_blind'] = $arr_blind;
$return_data['url'] = '/web/news/column';
# view
return $this->load->view('/web/comm/blind_view_alert', $return_data, true);
}
# bookmark
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_bookmark');
$bookmark_count = $this->m_bookmark->bookmark_member_id_content_idx_count($req_data);
}
# hit count update
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$this->load->library('comm');
$this->comm->fn_hit_count_update($req_data);
# model - column view
$this->load->model('web/m_column');
$result = $this->m_column->column_select($idx);
# 연관글
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_relation_article');
$arr_relation_column = $this->m_relation_article->relation_article_join_column_list($req_data);
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_where_news_idx_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_relation_column'] = $arr_relation_column;
$return_data['arr_weather'] = $arr_weather;
$return_data['bookmark_count'] = $bookmark_count;
$return_data['result'] = $result;
# view
return $this->load->view('/m/news/column_view', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 프린트
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function fn_nonskin_news_print() {
# view
return $this->load->view('/m/news/news_print', '');
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 칼럼니스트 메인
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_columnist() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$partner_idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '2';
# default setting
if($search_sort == '') $search_sort = '1';
if($page=='') $page = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
$column_delivery_count = 0;
if($SES_MEMBER_ID != '') {
# 배달여부
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['main_idx'] = $partner_idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$this->load->model('web/m_delivery');
$arr_column_delivery = $this->m_delivery->delivery_where_member_id_main_idx_select($req_data);
$column_delivery_count = count($arr_column_delivery);
}
# 칼럼정보
# model - list
$this->load->model('web/m_partner');
$arr_columnist = $this->m_partner->partner_select($partner_idx);
if(count($arr_columnist)==0) {
gf_alert("잘못된 접근입니다.", '/');
exit;
}
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
# 칼럼 리스트
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['search_type'] = 'partner_idx';
$req_data['search_key'] = $partner_idx;
# model - list
$this->load->model('web/m_column');
$result = $this->m_column->column_list($req_data);
$total_count = $this->m_column->column_list_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/news/columnist/'.$partner_idx.'?search_sort='.$search_sort.'&page=');
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['search_sort'] = $search_sort;
$return_data['pagination'] = $pagination;
$return_data['arr_columnist'] = $arr_columnist;
$return_data['column_delivery_count'] = $column_delivery_count;
# view
return $this->load->view('/m/news/columnist', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 랭킹
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_ranking() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$ranking_type = trim($this->input->get_post('ranking_type', TRUE));
$content_type = 1;
# default setting
if($ranking_type == '') $ranking_type = '1';
if($page=='') $page = '1';
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['ranking_type'] = $ranking_type;
$req_data['content_type'] = $content_type;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$this->load->model('web/m_ranking');
$result = $this->m_ranking->ranking_join_news_list($req_data);
$total_count = $this->m_ranking->ranking_join_news_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/news/ranking?ranking_type='.$ranking_type.'&page=');
# news setting
$this->load->model('web/m_contents_setting');
$arr_news_setting = $this->m_contents_setting->contents_setting_select(1);
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['list'] = $result;
$return_data['pagination'] = $pagination;
$return_data['ranking_type'] = $ranking_type;
$return_data['arr_news_setting'] = $arr_news_setting;
# view
return $this->load->view('/m/news/ranking', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 카테고리
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_category() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$category_code = $this->uri->segment(4);
$this->load->helper('url');
if($category_code=='') {
redirect(WWW_CROSSMAP.'/web/news/');
exit;
}
# default setting
if($search_sort == '') $search_sort = '1';
if($page=='') $page = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
# 뉴스
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['search_type'] = 'category_code';
$req_data['search_keyword'] = $category_code;
# model - list
$this->load->model('web/m_news');
$result = $this->m_news->news_list($req_data);
$total_count = $this->m_news->news_list_total_count($req_data);
$category_count = strlen($category_code);
$category_code1 = substr($category_code, 0, 2);
$category_code2 = ''; $category_code3 = '';
if($category_count == 6) $category_code3 = substr($category_code, 0, 6);
if($category_count == 4 || $category_count == 6) $category_code2 = substr($category_code, 0, 4);
# 카테고리
$this->load->model('web/m_news_section');
$arr_category = $this->m_news_section->news_section_select($category_code);
$arr_category1 = $this->m_news_section->news_section_select($category_code1);
$arr_category2 = array();
if($category_code2 != '') $arr_category2 = $this->m_news_section->news_section_select($category_code2);
$arr_category3 = array();
if($category_code3 != '') $arr_category3 = $this->m_news_section->news_section_select($category_code3);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/m/news/category/'.$category_code.'?search_sort='.$search_sort.'&page=');
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['list'] = $result;
$return_data['pagination'] = $pagination;
$return_data['search_sort'] = $search_sort;
$return_data['category_code'] = $category_code;
$return_data['arr_category'] = $arr_category;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['arr_category3'] = $arr_category3;
# view
return $this->load->view('/m/news/category', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 댓글
# CREATE : 2018-04-29
#---------------------------------------------------------------------------
function fn_news_comment() {
# Request
$idx = $this->uri->segment(4);
# model - news view
$this->load->model('web/m_news');
$result = $this->m_news->news_join_news_section_press_select($idx);
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_where_news_idx_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_weather'] = $arr_weather;
$return_data['result'] = $result;
# view
return $this->load->view('/m/news/news_comment', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 칼럼 댓글
# CREATE : 2018-05-14
#---------------------------------------------------------------------------
function fn_column_comment() {
# Request
$idx = $this->uri->segment(4);
# model - column view
$this->load->model('web/m_column');
$result = $this->m_column->column_select($idx);
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_where_news_idx_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_weather'] = $arr_weather;
$return_data['result'] = $result;
# view
return $this->load->view('/m/news/column_comment', $return_data, true);
}
function fn_ajax_news_more(){
$ci = $this;
$ci->db->from("news");
$ci->db->select("*, `news`.idx as content_idx");
$ci->db->join('press', 'press.idx = news.press_idx');
$ci->db->where("news.is_del","N");
$ci->db->where("news.is_display","Y");
$ci->db->order_by("news.reg_date","desc");
$offset = $_GET['page'] * 6;
$ci->db->limit(6,$offset);
$res = $ci->db->get();
$result = $res->result_array();
// echo $ci->db->last_query();
// exit();
# news setting
$this->load->model('web/m_contents_setting');
$arr_news_setting = $this->m_contents_setting->contents_setting_select(1);
foreach($result as $data):
?>
<div class="news_list_cont">
<div class="art-img2<?=($data['video_url']) ? " plays_b" : ""; ?>"><a href="/m/news/news_view/<?=$data['idx']?>"><img src="<?=$data['main_img']?>" width="160"></a></div>
<div class="art-info2">
<h2 class="art-title">
<a href="/m/news/news_view/<?=$data['idx']?>"><?=$data['title']?></a>
</h2>
<p class="art-info"><?
$a = time();
$b = strtotime($result[0]['update_date']);
echo floor(($a-$b)/3600);
?>시간 전
<? if($arr_news_setting['etc_char1']=='Y') {?>
|
<a href="<?=$data['homepage']?>"><?=$data['press_name']?></a>
<?}?>
<span class="feedback fr">
<img src="/img/mobile/img_comments.gif"> <?=$data['comment_count']?>+</span>
</p>
</div>
</div>
<?endforeach;
exit();
}
}
?>

View File

@@ -0,0 +1,77 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class prayer extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 메인
# CREATE : 2019-04-17
#---------------------------------------------------------------------------
function fn_index() {
// 말씀과 묵상
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 26;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '1';
$req_data['sort_column'] = 'a.reg_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 2;
$this->load->model('admin/life/m_life');
$this->load->model('web/m_channel');
// 열방을 위한 기도
$req_data['search_category_code2'] = '49';
$world = $this->m_channel->channel_join_category_select(49);
$world['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$world['data'] = $this->m_life->life_list($req_data);
//아침을 여는 기도
$req_data['search_category_code2'] = '18';
$moning = $this->m_channel->channel_join_category_select(18);
$moning['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$moning['data'] = $this->m_life->life_list($req_data);
// 순교자의 소리
$req_data['search_category_code2'] = '46';
$sound = $this->m_channel->channel_join_category_select(46);
$sound['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$sound['data'] = $this->m_life->life_list($req_data);
//Open door
$req_data['search_category_code2'] = '47';
$open_door = $this->m_channel->channel_join_category_select(47);
$open_door['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$open_door['data'] = $this->m_life->life_list($req_data);
//Open door
$req_data['search_category_code2'] = '47';
$corner_stone = $this->m_channel->channel_join_category_select(47);
$corner_stone['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$corner_stone['data'] = $this->m_life->life_list($req_data);
# view data
$return_data['channel'] = array();
$return_data['page_title_1'] = "기도공감";
array_push($return_data['channel'], $world, $moning, $sound, $open_door, $corner_stone);
// $return_data['arr_praise'] = ;
// $return_data['arr_testimony'] = ;
// $return_data['arr_talkshow'] = ;
# view
return $this->load->view('/m/cmtv/channel_recommend', $return_data, true);
}
}
?>

View File

@@ -0,0 +1,72 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class rules extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 서비스이용약관
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function fn_service() {
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$return_data = array();
$return_data['site_info'] = $site_info;
# view
return $this->load->view('/m/rules/service', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 개인정보 취급방침
# CREATE : 2018-05-07
#---------------------------------------------------------------------------
function fn_privacy() {
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$return_data = array();
$return_data['site_info'] = $site_info;
# view
return $this->load->view('/m/rules/privacy', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 개인정보 수집 및 이용
# CREATE : 2018-05-07
#---------------------------------------------------------------------------
function fn_privacy_agreement() {
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$return_data = array();
$return_data['site_info'] = $site_info;
# view
return $this->load->view('/m/rules/privacy_agreement', $return_data, true);
}
}
?>

View File

@@ -0,0 +1,690 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/m/cm_controller.php');
class search extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 검색메인
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function cookies($key){
$key = $key."|".date("m.d",time());
$check = get_cookie("pre_keyword");
if(isset($check)){
$keywords = json_decode($check);
if(count($keywords) >=5 ){
array_splice($keywords,0,1);
}
// $i = array_search($key,$keywords);
// var_dump($i);
// exit();
@$i = (string) array_search($key,$keywords);
@array_splice($keywords,$i,1);
array_unshift($keywords,$key);
}
else{
$keywords = array($key);
}
setcookie("pre_keyword",json_encode($keywords),0,'/');
//
// var_dump(get_cookie("pre_keyword"));
// exit();
}
function fn_index() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
# 연관검색어
$req_data = array();
$req_data['keyword'] = $search_keyword_tmp;
$req_data['offset'] = 0;
$req_data['limit'] = 10;
$this->load->model('web/m_search_keyword_relation');
$arr_search_keyword_relation = $this->m_search_keyword_relation->search_keyword_relation_list($req_data);
$search_keyword_txt = gf_search_keyword_fulltext_string($search_keyword_tmp);
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_txt;
$req_data['offset'] = 0;
$req_data['limit'] = 3;
$req_data['sort_column'] = 'display_date';
# 라이프
$this->load->model('web/m_life');
$arr_life = $this->m_life->life_list($req_data);
# 뉴스
$this->load->model('web/m_news');
$arr_news = $this->m_news->news_list($req_data);
# 칼럼
$this->load->model('web/m_column');
$arr_column = $this->m_column->column_list($req_data);
# 뉴스 - 관련 뉴스
$this->load->model('web/m_relation_article');
$arr_news_relation_article = array();
foreach($arr_news as $val) {
$req_data = array();
$req_data['content_type'] = '1';
$req_data['content_idx'] = $val['idx'];
$arr_news_relation_article[$val['idx']] = $this->m_relation_article->relation_article_join_news_list($req_data);
}
$search_keyword_txt = addslashes($search_keyword);
# 동영상
$req_data = array();
$req_data['search_type'] = 'main_search_and_video_url';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = 0;
$req_data['limit'] = 15;
$req_data['sort_column'] = 'display_date';
// $arr_life_video = $this->m_life->life_list($req_data);
// $arr_news_video = $this->m_news->news_list($req_data);
// $arr_column_video = $this->m_column->column_list($req_data);
// $arr_video = array_merge($arr_life_video, $arr_news_video, $arr_column_video);
$req_data['search_type'] = 'main_search_and_video_url';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = 0;
$req_data['limit'] = 15;
$this->load->model('web/m_vw_content');
$arr_video = $this->m_vw_content->vw_content_list($req_data);
$arr_display_date = array();
foreach ($arr_video as $key=>$val) {
$arr_display_date[$key] = $val['display_date'];
}
array_multisort($arr_display_date, SORT_DESC, $arr_video);
# 이미지
$arr_img = array_merge($arr_life, $arr_news, $arr_column);
$arr_display_date = array();
foreach ($arr_img as $key=>$val) {
$arr_display_date[$key] = $val['display_date'];
}
array_multisort($arr_display_date, SORT_DESC, $arr_img);
$total_count = count($arr_img);
$return_data = array();
$return_data['arr_life'] = $arr_life;
$return_data['arr_news'] = $arr_news;
$return_data['arr_column'] = $arr_column;
$return_data['search_keyword'] = $search_keyword;
$return_data['arr_search_keyword_relation'] = $arr_search_keyword_relation;
$return_data['arr_img'] = $arr_img;
$return_data['arr_video'] = $arr_video;
$return_data['total_count'] = $total_count;
$return_data['arr_news_relation_article'] = $arr_news_relation_article;
if($search_keyword != '')$this->cookies($search_keyword);
# view
return $this->load->view('/m/search/index', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 검색어 찾기
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function fn_ajax_search_keyword() {
# request
$keyword = trim($this->input->get_post('keyword', TRUE));
# select
$req_data = array();
$req_data['search_type'] = 'keyword';
$req_data['search_keyword'] = $keyword;
$req_data['offset'] = 0;
$req_data['limit'] = 15;
$this->load->model('web/m_search_keyword');
$result_tmp = $this->m_search_keyword->search_keyword_list($req_data);
$result = array();
foreach ($result_tmp as $key=>$val) {
$result[$key]['keyword'] = str_replace("'", "\\'", $val['keyword']);
}
if(count($result) > 0) {
$return_data['result'] = array('code' => '0000', 'data' => $result);
} else {
$return_data['result'] = array('code' => '9999');
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 검색어 찾기
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function fn_ajax_search_keyword_reg() {
# request
$keyword = trim($this->input->get_post('keyword', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$this->load->library('comm');
$this->load->model('web/m_search_keyword');
$this->load->model('web/m_search_keyword_relation');
$arr_keyword = explode(" ", $keyword);
if(count($arr_keyword) > 0) {
array_unshift($arr_keyword, $keyword);
foreach ($arr_keyword as $key =>$val) {
# 금칙어
$forbidden_word_count = $this->comm->fn_forbidden_word($val);
if($forbidden_word_count > 0) {
throw new Cm_Exception('json', '9999', '검색할수 없는 단어가 있습니다.');
exit;
}
# 검색키워드 넣기
$req_data = array();
$req_data['keyword'] = $val;
$result = $this->m_search_keyword->search_keyword_where_keyword_select($req_data);
if($result > 0) {
$this->m_search_keyword->search_keyword_search_count_update($result['idx']);
} else {
$req_data = array();
$req_data['keyword'] = $val;
$this->m_search_keyword->search_keyword_insert($req_data);
}
# 연관검색어
if($key > 1) {
$req_data = array();
$req_data['keyword'] = $arr_keyword[1];
$req_data['relation_keyword'] = $val;
$result1 = $this->m_search_keyword_relation->search_keyword_relation_where_keyword_relation_keyword_select($req_data);
if($result1 > 0) {
$this->m_search_keyword_relation->search_keyword_relation_search_count_update($result1['idx']);
} else {
$req_data = array();
$req_data['keyword'] = $arr_keyword[1];
$req_data['relation_keyword'] = $val;
$this->m_search_keyword_relation->search_keyword_relation_keyword_insert($req_data);
}
}
}
}
# log insert
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['keyword'] = $keyword;
$this->load->model('web/m_search_keyword_log');
$this->m_search_keyword_log->search_keyword_log_insert($req_data);
$return_data['result'] = array('code' => '0000');
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 이미지
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_image() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = 0;
$req_data['limit'] = 100;
$this->load->model('web/m_vw_content');
$total_count = $this->m_vw_content->vw_content_list_total_count($req_data);
$return_data = array();
$return_data['search_keyword'] = $search_keyword;
$return_data['total_count'] = $total_count;
$return_data['limit'] = 100;
# view
return $this->load->view('/m/search/image', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 이미지 더가져오기
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_ajax_image_list_more() {
# request
$page = trim($this->input->get_post('page', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
# paging 설정
$limit = 100;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$this->load->model('web/m_vw_content');
$list = $this->m_vw_content->vw_content_list($req_data);
$total_count = $this->m_vw_content->vw_content_list_total_count($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
# view data
$return_data = array();
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
$return_data['limit'] = $limit;
$return_data['page'] = $page;
$return_data['view_count'] = $offset;
$return_data['search_keyword_tmp'] = $search_keyword_tmp;
return $this->load->view('/m/search/image_list_more', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 이미지, 동영상 신고
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_ajax_spam_proc() {
$spam_type = trim($this->input->get_post('spam_type', TRUE));
$spam_list = $this->input->get_post('spam_list', TRUE);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($spam_type=='') throw new Cm_Exception('json', '9999', '신고할 내용이 없습니다.');
if(count($spam_list)==0) throw new Cm_Exception('json', '9999', '신고할 내용이 없습니다.');
if($SES_MEMBER_ID == '') throw new Cm_Exception('json', '9999', '로그인을 하셔야 가능합니다.');
$this->load->model('web/m_spam_media_log');
foreach ($spam_list as $val) {
$arr_content = explode("_", $val);
$content_type = $arr_content[0];
$content_idx = $arr_content[1];
if($content_type=='') throw new Cm_Exception('json', '9999', '신고할 내용이 없습니다.');
if($content_idx=='') throw new Cm_Exception('json', '9999', '신고할 내용이 없습니다.');
# insert
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['spam_type'] = $spam_type;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $content_idx;
$this->m_spam_media_log->spam_media_log_insert($req_data);
}
$return_data['result'] = array('code' => '0000');
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프, 칼럼
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_list() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$content_type = trim($this->input->get_post('content_type', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$content_type = $content_type ? $content_type : 3;
# default setting
if($page=='') $page = '1';
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
$search_keyword_txt = gf_search_keyword_fulltext_string($search_keyword_tmp);
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_txt;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['sort_column'] = 'display_date';
if($content_type == '3') {
# 라이프
$this->load->model('web/m_life');
$list = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
$page_title = '라이프';
} else if($content_type == '2') {
# 칼럼
$this->load->model('web/m_column');
$list = $this->m_column->column_list($req_data);
$total_count = $this->m_column->column_list_total_count($req_data);
$page_title = '칼럼';
}
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/m/search/list?search_keyword='.urlencode($search_keyword).'&content_type='.$content_type.'&page=');
$start_row = $offset+1;
$end_row = $limit*$page;
if($end_row >= $total_count) $end_row = $total_count;
$return_data = array();
$return_data['search_keyword'] = $search_keyword;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
$return_data['page'] = $page;
$return_data['start_row'] = $start_row;
$return_data['end_row'] = $end_row;
$return_data['pagination'] = $pagination;
$return_data['page_title'] = $page_title;
$return_data['content_type'] = $content_type;
$this->cookies($search_keyword);
# view
return $this->load->view('/m/search/list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 영상
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_video() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$page = trim($this->input->get_post('page', TRUE));
# default setting
if($page=='') $page = '1';
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['search_type'] = 'main_search_and_video_url';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$this->load->model('web/m_vw_content');
$list = $this->m_vw_content->vw_content_list($req_data);
$total_count = $this->m_vw_content->vw_content_list_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/m/search/video?search_keyword='.urlencode($search_keyword).'&page=');
$start_row = $offset+1;
$end_row = $limit*$page;
if($end_row >= $total_count) $end_row = $total_count;
$return_data = array();
$return_data['search_keyword'] = $search_keyword;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
$return_data['page'] = $page;
$return_data['start_row'] = $start_row;
$return_data['end_row'] = $end_row;
$return_data['pagination'] = $pagination;
$this->cookies($search_keyword);
# view
return $this->load->view('/m/search/video', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_news() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$content_idx = trim($this->input->get_post('content_idx', TRUE));
# default setting
if($search_sort == '') $search_sort = '1';
if($page=='') $page = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; $sort_type = 'desc'; $sorting = SORT_DESC; break;
case '2': $sort_column = 'display_date'; $sort_type = 'asc'; $sorting = SORT_ASC; break;
default : $sort_column = 'display_date'; $sort_type = 'desc'; $sorting = SORT_DESC; break;
}
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
$search_keyword_txt = gf_search_keyword_fulltext_string($search_keyword_tmp);
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_txt;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['sort_column'] = $sort_column;
$req_data['sort_type'] = $sort_type;
$news_type = '';
$arr_news_relation_article = array();
if($content_idx == '') {
# 뉴스
$this->load->model('web/m_news');
$list = $this->m_news->news_list($req_data);
$total_count = $this->m_news->news_list_total_count($req_data);
} else {
# 뉴스
$this->load->model('web/m_news');
$list[] = $this->m_news->news_select($content_idx);
}
# 뉴스 - 관련 뉴스
$this->load->model('web/m_relation_article');
foreach($list as $val) {
$req_data = array();
$req_data['content_type'] = '1';
$req_data['content_idx'] = $val['idx'];
$arr_news_relation_article[$val['idx']] = $this->m_relation_article->relation_article_join_news_list($req_data);
}
if($content_idx != '') {
$list = array_merge($list, $arr_news_relation_article[$content_idx]);
$total_count = count($list);
$news_type='relation';
$arr_news_relation_article = array();
$arr_display_date = array();
foreach ($list as $key=>$val) {
$arr_display_date[$key] = $val['display_date'];
}
array_multisort($arr_display_date, $sorting, $list);
}
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/m/search/news?search_keyword='.urlencode($search_keyword).'&content_idx='.$content_idx.'&search_sort='.$search_sort.'&page=');
$start_row = $offset+1;
$end_row = $limit*$page;
if($end_row >= $total_count) $end_row = $total_count;
$return_data = array();
$return_data['search_keyword'] = $search_keyword;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
$return_data['page'] = $page;
$return_data['start_row'] = $start_row;
$return_data['end_row'] = $end_row;
$return_data['pagination'] = $pagination;
$return_data['search_sort'] = $search_sort;
$return_data['arr_news_relation_article'] = $arr_news_relation_article;
$return_data['news_type'] = $news_type;
$return_data['content_idx'] = $content_idx;
$this->cookies($search_keyword);
# view
return $this->load->view('/m/search/news', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 이미지 뷰
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function fn_image_view() {
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = 0;
$req_data['limit'] = 100;
$this->load->model('web/m_vw_content');
$total_count = $this->m_vw_content->vw_content_list_total_count($req_data);
$return_data = array();
$return_data['search_keyword'] = $search_keyword;
$return_data['total_count'] = $total_count;
$return_data['limit'] = 100;
return $this->load->view('/m/search/image_view', $return_data,true);
}
}
?>

View File

@@ -0,0 +1,26 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
class News extends CI_Controller
{
public function __construct() {
parent::__construct();
$this->load->library('user_agent');
$this->load->library('Post', '', 'post');
}
public function index() {
$post = $this->db->limit(1)->order_by('reg_date', 'desc')
->select('main_img mainImg, news.*')
->get('news')->row();
$this->load->view('news/news', array('post' => $post));
}
public function category() {
$post = $this->db->limit(1)->order_by('reg_date', 'desc')
->select('main_img mainImg, news.*')
->get('news')->row();
$this->load->view('news/category', array('post' => $post));
}
}

View File

@@ -0,0 +1,183 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Reference extends CI_Controller
{
private $categoryDescription = array(
30 => '언제나 하나님 안에서 글을 품는 여행작가',
31 => '삶과 믿음의 지혜와 지식',
32 => '매일매일 은혜를 채우는 시간',
33 => '영어로 성경을 읽어봐요',
34 => '신앙에 질문들 모조리 답해드립니다',
46 => '자료실',
);
private $graceCategories = array(30, 31, 32, 33, 34, 46);
private $graceCategoryDetail = array();
public function __construct()
{
parent::__construct();
$this->load->library('Post', '', 'post');
$this->load->model('life_model');
$this->load->model('editor_model');
$this->load->model('category_model');
$this->load->model('config_model');
$graceCategoryDetail = $this->category_model->findByParentId(35)->result();
foreach ($graceCategoryDetail as $category) {
$this->graceCategoryDetail[$category->idx] = $category;
}
}
private function getIndexSlide()
{
$query = $this->db->query("SELECT
`p`.`idx` `editorId`,
`p`.`partner_img` `editorImg`,
`p`.`main_img` `editorMainImg`,
`p`.`partner_name` `editorName`,
`p`.`partner_intro` `editorIntro`,
`l`.`title`,
`l`.`head_title`,
`l`.`sub_title`,
`l`.`content`,
`l`.`category_idx` `categoryId`,
`l`.`idx`,
`l`.`main_img` `mainImg`,
`l`.`hit_count` `views`,
`l`.`like_count` `likes`,
`l`.`comment_count` `comments`,
`l`.*
FROM
`life` `l`
LEFT JOIN
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
inner join cm_config c on l.idx = c.PostId
WHERE
c.Type = 'grace' and c.Page = 'gracehometop'
AND `l`.`is_display` = 'Y'
AND `l`.`is_del` = 'N' order by c.OrderNum");
return $this->post->urify($query->result());
}
public function likes() {
$this->index();
}
public function index()
{
$categoryTitle = '자료실';
$categoryId = 46;
if (!$categoryId) {
show_404();
}
$orderByLikes = $this->uri->segment(2);
$cmConfig = $this->config_model->findByTypeAndNameAndPage('display', 'grace', 'submenu-top')->get();
if ($cmConfig->num_rows()) {
$cfPostId = array();
foreach ($cmConfig->result() as $cf) {
array_push($cfPostId, $cf->PostId);
}
$configuredPosts = $this->post->getPostJoin1(implode(",", $cfPostId));
if ($configuredCount = count($configuredPosts)) {
if ($configuredCount < 6) {
$slide = $this->post->getPostsByCategoryId($this->graceCategories, 6 - $configuredCount, 'reg_date', 'desc', $cfPostId);
$slide = array_merge($this->post->urify($configuredPosts), $slide);
} else {
$slide = $this->post->urify($configuredPosts);
}
} else {
$slide = $this->post->getPostsByCategoryId($this->graceCategories, 6, 'reg_date');
}
} else {
$slide = $this->post->getPostsByCategoryId($categoryId, 6, 'reg_date');
}
// print_r($slide);die;
$slideIdx = array();
foreach ($slide as $s) {
array_push($slideIdx, $s->idx);
}
$posts = $this->post->getPostsByCategoryId($categoryId, 16, $orderByLikes ? 'like_count' : 'update_date', 'desc', $slideIdx);
$postIds = array();
foreach ($posts as $p) {
array_push($postIds, $p->idx);
}
$editorTotal = $this->editor_model->findByCategoryId($categoryId)->count_all_results();
$data = array(
'slide' => $slide,
'posts' => $posts,
'post' => &$posts[0],
'editorTotal' => $editorTotal,
'isLikesOrder' => $orderByLikes,
'editors' => $this->editor_model->findByCategoryId($categoryId)->limit(6)->get()->result(),
'graceCategories' => $this->graceCategoryDetail,
'categoryTitle' => empty($this->graceCategoryDetail[$categoryId]) ? $categoryTitle : $this->graceCategoryDetail[$categoryId]->category_name,
'categoryId' => $categoryId,
'categoryDescription' => '',
'pageInitPostIds' => array_merge($slideIdx, $postIds),
);
$this->load->view('reference', $data);
}
public function editor()
{
$orderByLikes = $this->uri->segment(5);
$editorId = $this->uri->segment(4);
$posts = $this->post->getEditorPosts($editorId, 16, $orderByLikes ? 'like_count' : 'update_date');
$this->load->view('grace/editor', array(
'posts' => $posts,
'post' => &$posts[0],
'editor' => $this->editor_model->findById($this->uri->segment(4)),
'graceCategories' => $this->graceCategoryDetail,
'isLikesOrder' => $orderByLikes,
'pageInitPostIds' => array_map(function ($p) {return $p->idx;}, $posts),
));
}
public function view()
{
$postId = $this->uri->segment(3);
$data = array('post' => $this->post->getPost($postId), 'graceCategories' => $this->graceCategoryDetail);
if ($data['post']) {
$data['editorPosts'] = $this->post->getEditorPosts($data['post']->partner_idx, 4, 'update_date', 'desc', [$data['post']->idx]);
$excepts = array($data['post']->idx);
foreach ($data['editorPosts'] as $p) {
array_push($excepts, $p->idx);
}
$data['iLike'] = $this->session->userdata('C_Member_Id') ? $this->db->where('content_idx', $postId)->where('content_type', 3)->where('member_id', $this->session->userdata('C_Member_Id'))->from('like_log')->count_all_results() : false;
$data['recentPosts'] = $this->post->getPostsByCategoryId($this->graceCategories, 8, 'update_date', 'desc', $excepts);
$this->load->view('grace/view', $data);
} else {
header('location:/grace');
}
}
public function posts()
{
$excepts = $this->input->post('excepts') ? explode(',', $this->input->post('excepts')) : array(0);
$page = $this->input->post('page');
$pageId = $this->input->post('pageId');
$orderByLikes = $this->input->post('orderBy');
if($page == 'editor') {
$posts = $this->post->getEditorPosts($pageId, 16, $orderByLikes ? 'like_count' : 'update_date', 'desc', $excepts);
}else if($page == 'category') {
$posts = $this->post->getPostsByCategoryId($pageId, 16, $orderByLikes ? 'like_count' : 'update_date', 'desc', $excepts);
}else {
$posts = $this->post->getEditorPosts($pageId, 16, $orderByLikes ? 'like_count' : 'update_date', 'desc', $excepts);
}
foreach ($posts as $k => $p) {
$posts[$k]->editorNameUrl = cleanUrl($posts[$k]->editorName);
$posts[$k]->mainImg = imgSrc($posts[$k]->mainImg);
}
echo json_encode(array('code' => 200, 'message' => 'success', 'data' => $posts));
}
}

View File

@@ -0,0 +1,75 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class cmtv extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 메인
# CREATE : 2019-04-17
#---------------------------------------------------------------------------
function fn_index() {
$this->load->library('user_agent');
if ($this->agent->is_mobile()){
$this->load->helper('url');
redirect($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].'/m/cmtv/', 'refresh');
}
// 말씀과 묵상
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 22;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '1';
$req_data['sort_column'] = 'a.reg_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 4;
$this->load->model('admin/life/m_life');
$this->load->model('web/m_channel');
// 말씀영상
$req_data['search_category_code2'] = '42';
$arr_words = $this->m_channel->channel_join_category_select(42);
$arr_words['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_words['data'] = $this->m_life->life_list($req_data);
//찬양영상
$req_data['search_category_code2'] = '43';
$arr_praise = $this->m_channel->channel_join_category_select(43);
$arr_praise['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_praise['data'] = $this->m_life->life_list($req_data);
// 간증
$req_data['search_category_code2'] = '44';
$arr_testimony = $this->m_channel->channel_join_category_select(44);
$arr_testimony['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_testimony['data'] = $this->m_life->life_list($req_data);
//토크쇼
$req_data['search_category_code2'] = '45';
$arr_talkshow = $this->m_channel->channel_join_category_select(45);
$arr_talkshow['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$arr_talkshow['data'] = $this->m_life->life_list($req_data);
# view data
$return_data['channel'] = array();
array_push($return_data['channel'], $arr_words, $arr_praise, $arr_testimony, $arr_talkshow);
// $return_data['arr_praise'] = ;
// $return_data['arr_testimony'] = ;
// $return_data['arr_talkshow'] = ;
# view
return $this->load->view('/web/cmtv/channel_recommend', $return_data, true);
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,254 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class cs extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 공지사항
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function fn_notice() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
# default setting
if($page=='') $page = '1';
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
# 공지사항
$req_data = array();
$req_data['search_type'] = 'total';
$req_data['search_keyword'] = $search_keyword;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_bbs_notice');
$result = $this->m_bbs_notice->bbs_notice_list($req_data);
$total_count = $this->m_bbs_notice->bbs_notice_list_total_count($req_data);
$row = $this->m_bbs_notice->bbs_notice_order_by_reg_date_limit1_select();
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/cs/notice?search_keyword='.$search_keyword.'&page=');
$data_num = ($total_count + $limit)-($page*$limit);
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['search_keyword'] = $search_keyword;
$return_data['list'] = $result;
$return_data['row'] = $row;
$return_data['pagination'] = $pagination;
$return_data['data_num'] = $data_num;
# view
return $this->load->view('/web/cs/notice', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 공지사항 뷰
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function fn_notice_view() {
# Request
$idx = $this->uri->segment(4);
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$data_num = trim($this->input->get_post('data_num', TRUE));
# model - list
$this->load->model('web/m_bbs_notice');
$result = $this->m_bbs_notice->bbs_notice_select($idx);
$row = $this->m_bbs_notice->bbs_notice_order_by_reg_date_limit1_select();
# total count
$req_data = array();
$req_data['search_type'] = 'total';
$req_data['search_keyword'] = $search_keyword;
$total_count = $this->m_bbs_notice->bbs_notice_list_total_count($req_data);
$next_list = array();
if($data_num == '' || $data_num == '0') {
$data_num = 1;
} else {
# next_list
$req_data = array();
$req_data['search_type'] = 'total';
$req_data['search_keyword'] = $search_keyword;
$req_data['offset'] = 0;
$req_data['limit'] = 4;
$req_data['idx'] = $idx;
$next_list = $this->m_bbs_notice->bbs_notice_next_list($req_data);
}
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['result'] = $result;
$return_data['next_list'] = $next_list;
$return_data['row'] = $row;
$return_data['search_keyword'] = $search_keyword;
$return_data['total_count'] = $total_count;
$return_data['data_num'] = $data_num;
# view
return $this->load->view('/web/cs/notice_view', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : faq
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function fn_faq() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_category1 = trim($this->input->get_post('search_category1', TRUE));
$search_category2 = trim($this->input->get_post('search_category2', TRUE));
# default setting
if($page=='') $page = '1';
# 카테고리 가져오기
$this->load->model('web/m_bbs_faq_category');
$arr_category = $this->m_bbs_faq_category->bbs_faq_category_all_list();
$arr_category1 = array(); $arr_category2 = array();
foreach ($arr_category as $val) {
if($val['depth']=='1') $arr_category1[] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name'], 'idx'=> $val['idx']);
if($val['depth']=='2') $arr_category2[$val['p_category_code']][] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name'], 'idx'=> $val['idx']);
}
if($search_category1 == '') $search_category1 = $arr_category1[0]['category_code'];
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
# faq
$req_data = array();
$req_data['search_type'] = 'title';
$req_data['search_keyword'] = $search_keyword;
$req_data['faq_category_code1'] = $search_category1;
$req_data['faq_category_code2'] = $search_category2;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_bbs_faq');
$result = $this->m_bbs_faq->bbs_faq_list($req_data);
$total_count = $this->m_bbs_faq->bbs_faq_list_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/cs/faq?search_keyword='.$search_keyword.'&search_category1='.$search_category1.'&search_category2='.$search_category2.'&page=');
$data_num = ($total_count + $limit)-($page*$limit);
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category1'] = $search_category1;
$return_data['search_category2'] = $search_category2;
$return_data['list'] = $result;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['pagination'] = $pagination;
$return_data['data_num'] = $data_num;
# view
return $this->load->view('/web/cs/faq', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : faq 뷰
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function fn_faq_view() {
# Request
$idx = $this->uri->segment(4);
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_category1 = trim($this->input->get_post('search_category1', TRUE));
$search_category2 = trim($this->input->get_post('search_category2', TRUE));
$data_num = trim($this->input->get_post('data_num', TRUE));
# 카테고리 가져오기
$this->load->model('web/m_bbs_faq_category');
$arr_category = $this->m_bbs_faq_category->bbs_faq_category_all_list();
$arr_category1 = array(); $arr_category2 = array();
foreach ($arr_category as $val) {
if($val['depth']=='1') $arr_category1[] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name'], 'idx'=> $val['idx']);
if($val['depth']=='2') $arr_category2[$val['p_category_code']][] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name'], 'idx'=> $val['idx']);
}
if($search_category1 == '') $search_category1 = $arr_category1[0]['category_code'];
# model - list
$this->load->model('web/m_bbs_faq');
$result = $this->m_bbs_faq->bbs_faq_select($idx);
# faq
$req_data = array();
$req_data['search_type'] = 'title';
$req_data['search_keyword'] = $search_keyword;
$req_data['faq_category_code1'] = $search_category1;
$req_data['faq_category_code2'] = $search_category2;
$req_data['offset'] = 0;
$req_data['limit'] = 4;
$req_data['idx'] = $idx;
$next_list = $this->m_bbs_faq->bbs_faq_next_list($req_data);
$total_count = $this->m_bbs_faq->bbs_faq_list_total_count($req_data);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['result'] = $result;
$return_data['next_list'] = $next_list;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category1'] = $search_category1;
$return_data['search_category2'] = $search_category2;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['total_count'] = $total_count;
$return_data['data_num'] = $data_num;
# view
return $this->load->view('/web/cs/faq_view', $return_data, true);
}
}
?>

View File

@@ -0,0 +1,985 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller_test.php');
class life_test extends cm_Controller_test {
#---------------------------------------------------------------------------
# PURPOSE : 메인
# CREATE : 2018-04-10
#---------------------------------------------------------------------------
function fn_index() {
# Request
$search_date = trim($this->input->get_post('search_date', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$popular_page = trim($this->input->get_post('popular_page', TRUE));
$search_popular = trim($this->input->get_post('search_popular', TRUE));
# default setting
if($search_sort == '') $search_sort = '1';
if($search_date=='') $search_date = date('Y-m');
if($search_popular=='') $search_popular = '1';
# 해당월의 마지막 날짜
$end_day = date("t", strtotime($search_date));
$start_date = $search_date.'-01';
$end_date = $search_date.'-'.$end_day;
# 년월 구하기
$month = date('m', strtotime($start_date));
$month_txt = date("Y", strtotime($start_date)).'년 '.(int)$month.'월';
# 이전달
$prev_date = date('Y-m', strtotime($start_date." -1 month"));
# 다음달
$next_date = date('Y-m', strtotime($start_date." +1 month"));
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# paging 설정
$limit = 15;
$offset = 0;
# 라이프
$req_data = array();
$req_data['start_date'] = $start_date;
$req_data['end_date'] = $end_date;
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_life');
$result = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
# 인기채널
# paging 설정
if($popular_page=='') $popular_page = '1';
$popular_limit = 8;
$popular_offset = ($popular_page-1) * $popular_limit;
$req_data = array();
$req_data['offset'] = $popular_offset;
$req_data['limit'] = $popular_limit;
$req_data['sort_column'] = 'popular_count';
if($search_popular == 1) {
# model - channel
$this->load->model('web/m_channel');
$arr_popular = $this->m_channel->channel_list($req_data);
$popular_total_count = $this->m_channel->channel_list_total_count();
} if($search_popular == 2) {
$req_data['member_group_idx'] = 6;
# model - editor
$this->load->model('web/m_partner');
$arr_popular = $this->m_partner->partner_list($req_data);
$popular_total_count = $this->m_partner->partner_list_total_count($req_data);
}
$popular_max_page = ceil($popular_total_count / $popular_limit);
# channel_page
$this->load->helper('crossmap/tool_helper');
$pagination = gf_paging($popular_limit, $popular_page, $popular_max_page, '/web/life/?search_date='.$search_date.'&search_sort='.$search_sort.'&search_popular='.$search_popular.'&popular_page=');
# view data
$return_data = array();
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['start_date'] = $start_date;
$return_data['end_date'] = $end_date;
$return_data['search_date'] = $search_date;
$return_data['search_sort'] = $search_sort;
$return_data['search_popular'] = $search_popular;
$return_data['month_txt'] = $month_txt;
$return_data['prev_date'] = $prev_date;
$return_data['next_date'] = $next_date;
$return_data['list'] = $result;
$return_data['arr_popular'] = $arr_popular;
$return_data['popular_total_count'] = $popular_total_count;
$return_data['pagination'] = $pagination;
# view
return $this->load->view('/web/life/index', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 뷰
# CREATE : 2018-04-11
#---------------------------------------------------------------------------
function fn_life_view() {
# Request
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '3';
# model - list
$this->load->model('web/m_life');
$result = $this->m_life->life_join_editor_category_channel_select($idx);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/web/life');
exit;
}
$bookmark_count = 0;
if($SES_MEMBER_ID !='') {
# 게시물 열람 불가 체크
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['limit_type'] = '2';
# model
$this->load->model('web/m_blind_limit');
$arr_blind = $this->m_blind_limit->blind_limit_where_member_id_limit_type_select($req_data);
if(count($arr_blind) > 0) {
$return_data['arr_blind'] = $arr_blind;
$return_data['url'] = '/web/life/';
# view
return $this->load->view('/web/comm/blind_view_alert', $return_data, true);
}
# model - bookmark
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_bookmark');
$bookmark_count = $this->m_bookmark->bookmark_member_id_content_idx_count($req_data);
}
# hit count update
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$this->load->library('comm');
$this->comm->fn_hit_count_update($req_data);
# 이전글
$arr_prev = $this->m_life->life_prev_select($idx);
# 이후글
$arr_next = $this->m_life->life_next_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_prev'] = $arr_prev;
$return_data['arr_next'] = $arr_next;
$return_data['bookmark_count'] = $bookmark_count;
$return_data['result'] = $result;
# view
return $this->load->view('/web/life/life_view_test', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 뷰
# CREATE : 2018-04-11
#---------------------------------------------------------------------------
function fn_life_view2() {
# Request
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '3';
# model - list
$this->load->model('web/m_life');
$result = $this->m_life->life_join_editor_category_channel_select($idx);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/web/life');
exit;
}
$bookmark_count = 0;
if($SES_MEMBER_ID !='') {
# 게시물 열람 불가 체크
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['limit_type'] = '2';
# model
$this->load->model('web/m_blind_limit');
$arr_blind = $this->m_blind_limit->blind_limit_where_member_id_limit_type_select($req_data);
if(count($arr_blind) > 0) {
$return_data['arr_blind'] = $arr_blind;
$return_data['url'] = '/web/life/';
# view
return $this->load->view('/web/comm/blind_view_alert', $return_data, true);
}
# model - bookmark
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_bookmark');
$bookmark_count = $this->m_bookmark->bookmark_member_id_content_idx_count($req_data);
}
# hit count update
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$this->load->library('comm');
$this->comm->fn_hit_count_update($req_data);
# 이전글
$arr_prev = $this->m_life->life_prev_select($idx);
# 이후글
$arr_next = $this->m_life->life_next_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_prev'] = $arr_prev;
$return_data['arr_next'] = $arr_next;
$return_data['bookmark_count'] = $bookmark_count;
$return_data['result'] = $result;
# view
return $this->load->view('/web/life/life_view2', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 댓글 삭제
# CREATE : 2018-05-07
#---------------------------------------------------------------------------
function fn_ajax_user_comment_refresh_proc() {
$ci=& get_instance();
$ci->load->library('comm');
# request
$idx = trim($this->input->get_post('idx', TRUE));
$write_id = trim($this->input->get_post('write_id', TRUE));
$content_type = trim($this->input->get_post('content_type', TRUE));
# model
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['offset'] = 0;
$req_data['limit'] = 15;
$req_data['sort_column'] = 'reg_date';
$req_data['sort_type'] = 'desc';
$req_data['write_id'] = $write_id;
$arr_comment_result = $ci->comm->fn_comment($req_data);
$comment_my_delete_count = $arr_comment_result['comment_my_delete_count'];
if(count($arr_comment_result) == 0) {
throw new Cm_Exception('json', '9999', '알 수 없는 오류가 발생하였습니다.');
}
if($arr_comment_result) {
$return_data['result'] = array('code' => '0000');
} else {
$return_data['result'] = array('code' => '9999');
}
$return_data['delete_cnt'] = $comment_my_delete_count;
# view
echo json_encode($return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 댓글
# CREATE : 2018-04-29
#---------------------------------------------------------------------------
function fn_life_comment() {
# Request
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '3';
# model - list
$this->load->model('web/m_life');
$result = $this->m_life->life_join_editor_category_channel_select($idx);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/web/life');
exit;
}
# 북마크
$bookmark_count = 0;
if($SES_MEMBER_ID !='') {
# model - bookmark
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_bookmark');
$bookmark_count = $this->m_bookmark->bookmark_member_id_content_idx_count($req_data);
}
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['bookmark_count'] = $bookmark_count;
$return_data['result'] = $result;
# view
return $this->load->view('/web/life/life_comment', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 랭킹
# CREATE : 2018-04-29
#---------------------------------------------------------------------------
function fn_ranking() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$ranking_type = trim($this->input->get_post('ranking_type', TRUE));
$content_type = 3;
# default setting
if($ranking_type == '') $ranking_type = '1';
if($page=='') $page = '1';
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['ranking_type'] = $ranking_type;
$req_data['content_type'] = $content_type;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$this->load->model('web/m_ranking');
$result = $this->m_ranking->ranking_join_life_list($req_data);
$total_count = $this->m_ranking->ranking_join_life_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/life/ranking?ranking_type='.$ranking_type.'&page=');
# right
$theme_types = array('13', '14');
$this->load->library('comm');
$arr_life_right_comm = $this->comm->fn_life_right_comm($theme_types);
$arr_life_style = $arr_life_right_comm['arr_life_style'];
$arr_boomup_life = $arr_life_right_comm['arr_boomup_life'];
$arr_life_ranking = $arr_life_right_comm['arr_life_ranking'];
if(count($arr_life_style) > 0) {
array_splice($arr_life_style, 2, count($arr_life_style));
}
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['list'] = $result;
$return_data['arr_life_style'] = $arr_life_style;
$return_data['arr_boomup_life'] = $arr_boomup_life;
$return_data['arr_life_ranking'] = $arr_life_ranking;
$return_data['pagination'] = $pagination;
$return_data['ranking_type'] = $ranking_type;
# view
return $this->load->view('/web/life/ranking', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 채널 홈
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_channel() {
# Request
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '3';
# channel 정보
$this->load->model('web/m_channel');
$result = $this->m_channel->channel_join_category_select($idx);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/web/life');
exit;
}
if($search_sort == '') $search_sort = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# 배달여부
$this->load->model('web/m_delivery');
$channel_delivery_count = 0;
if($SES_MEMBER_ID != '') {
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['main_idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$arr_column_delivery = $this->m_delivery->delivery_where_member_id_main_idx_select($req_data);
$channel_delivery_count = count($arr_column_delivery);
}
# 채널글
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = 0;
$req_data['limit'] = 15;
$req_data['search_type'] = 'channel_idx';
$req_data['search_key'] = $idx;
# model - list
$this->load->model('web/m_life');
$list = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
# 배달수
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['main_idx'] = $idx;
$channel_delivery_total_count = $this->m_delivery->delivery_where_main_idx_count($req_data);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['search_sort'] = $search_sort;
$return_data['channel_delivery_count'] = $channel_delivery_count;
$return_data['result'] = $result;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
$return_data['channel_delivery_total_count'] = $channel_delivery_total_count;
# view
return $this->load->view('/web/life/channel', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : life_list_more
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_ajax_life_list_more() {
# request
$sort = trim($this->input->get_post('sort', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$channel_idx = trim($this->input->get_post('channel_idx', TRUE));
$partner_idx = trim($this->input->get_post('partner_idx', TRUE));
$type = trim($this->input->get_post('type', TRUE));
$start_date = trim($this->input->get_post('start_date', TRUE));
$end_date = trim($this->input->get_post('end_date', TRUE));
switch ($sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
if($type == 'main') {
$limit = 15;
$offset = ($page-1) * $limit;
# 라이프
$req_data = array();
$req_data['start_date'] = $start_date;
$req_data['end_date'] = $end_date;
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$view_url = '/web/life/life_main_list_more';
} else {
if($partner_idx!='') {
$search_type = 'partner_idx';
$search_key = $partner_idx;
$limit = 8;
$offset = ($page-1) * $limit;
$view_url = '/web/life/editor_life_list_more';
} else {
$search_type = 'channel_idx';
$search_key = $channel_idx;
$limit = 15;
$offset = ($page-1) * $limit;
$view_url = '/web/life/life_list_more';
}
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['search_type'] = $search_type;
$req_data['search_key'] = $search_key;
}
# model - list
$this->load->model('web/m_life');
$list = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
if(count($list) > 0) {
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
$return_data['page'] = $page;
} else {
$return_data['result_code'] = '9999';
}
# view
return $this->load->view($view_url, $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 에디터 홈
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_editor() {
# Request
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$idx = $this->uri->segment(4);
# editor 정보
$this->load->model('web/m_partner');
$result = $this->m_partner->partner_join_category_channel_select($idx);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/web/life');
exit;
}
if($search_sort == '') $search_sort = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# 에디터글
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = 0;
$req_data['limit'] = 8;
$req_data['search_type'] = 'partner_idx';
$req_data['search_key'] = $idx;
# model - list
$this->load->model('web/m_life');
$list = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['search_sort'] = $search_sort;
$return_data['result'] = $result;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
# view
return $this->load->view('/web/life/editor', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 추천채널
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_channel_recommend() {
# 추천채널
$etc_section_type = 1;
$this->load->model('web/m_life_etc_section');
$arr_etc_section = $this->m_life_etc_section->life_etc_section_join_channel_list($etc_section_type);
$result = $this->m_life_etc_section->life_etc_section_detail_join_life_list($etc_section_type);
$arr_etc_section_detail = array();
foreach ($result as $val) {
$arr_etc_section_detail[$val['life_etc_section_idx']][$val['rank']] = array('head_title'=>$val['head_title'], 'title'=>$val['title'], 'partner_idx' => $val['partner_idx'], 'editor_name' => $val['editor_name'], 'main_img' => $val['main_img'], 'content_idx' => $val['content_idx']);
}
# view data
$return_data = array();
$return_data['arr_etc_section'] = $arr_etc_section;
$return_data['arr_etc_section_detail'] = $arr_etc_section_detail;
# view
return $this->load->view('/web/life/channel_recommend', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프 카테고리
# CREATE : 2018-04-30
#---------------------------------------------------------------------------
function fn_category() {
# Request
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$category_idx = $this->uri->segment(4);
if($search_sort == '') $search_sort = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'reg_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'reg_date'; break;
}
# 카테고리
$this->load->model('web/m_category');
$arr_category = $this->m_category->category_all_list();
if(count($arr_category)==0) {
gf_alert("등록된 카테고리가 없습니다.", '/web/life');
exit;
}
if($category_idx == '') {
$category_idx = $arr_category[0]['idx'];
$category_name = $arr_category[0]['category_name'];
$swiper_page = 0;
} else {
foreach($arr_category as $key => $val) {
if($val['idx'] == $category_idx) {
$swiper_page = $key;
$category_name = $val['category_name'];
break;
}
}
}
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = 0;
$req_data['limit'] = 8;
$req_data['search_type'] = 'category_idx';
$req_data['search_key'] = $category_idx;
$req_data['member_group_idx'] = '6';
# editor list
$this->load->model('web/m_partner');
$result = $this->m_partner->partner_life_aritcle_count_list($req_data);
$total_count = $this->m_partner->partner_list_total_count($req_data);
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['search_sort'] = $search_sort;
$return_data['arr_category'] = $arr_category;
$return_data['category_idx'] = $category_idx;
$return_data['category_name'] = $category_name;
$return_data['swiper_page'] = $swiper_page;
# view
return $this->load->view('/web/life/category', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : editor_list_more
# CREATE : 2018-05-01
#---------------------------------------------------------------------------
function fn_ajax_editor_list_more() {
# request
$sort = trim($this->input->get_post('sort', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$category_idx = trim($this->input->get_post('category_idx', TRUE));
switch ($sort) {
case '2': $sort_column = 'popular_count'; break;
case '1': $sort_column = 'reg_date'; break;
default : $sort_column = 'reg_date'; break;
}
$limit = 8;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['search_type'] = 'category_idx';
$req_data['search_key'] = $category_idx;
$req_data['member_group_idx'] = '6';
# editor list
$this->load->model('web/m_partner');
$list = $this->m_partner->partner_life_aritcle_count_list($req_data);
$total_count = $this->m_partner->partner_list_total_count($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
if(count($list) > 0) {
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
} else {
$return_data['result_code'] = '9999';
}
# view
return $this->load->view("/web/life/editor_list_more", $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : tag
# CREATE : 2018-05-01
#---------------------------------------------------------------------------
function fn_tag() {
# Request
$tag = $this->uri->segment(4);
$content_type = '3';
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$tag = urldecode($tag);
# tag
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['tag'] = $tag;
$this->load->model('web/m_tag');
$total_count = $this->m_tag->tag_join_life_list_total_count($req_data);
if($total_count == 0) {
gf_alert("등록된 태그가 없습니다.", '/web/life');
exit;
}
# 배달여부
$this->load->model('web/m_delivery');
$tag_delivery_count = 0;
if($SES_MEMBER_ID != '') {
$req_data = array();
$req_data['content_type'] = '9';
$req_data['main_idx'] = $tag;
$req_data['member_id'] = $SES_MEMBER_ID;
$arr_column_delivery = $this->m_delivery->delivery_where_member_id_main_idx_select($req_data);
$tag_delivery_count = count($arr_column_delivery);
}
$this->load->model('web/m_tag');
# 연관태그
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['tag'] = $tag;
$arr_relation_tag = $this->m_tag->tag_join_tag_list($req_data);
# 태그글
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['tag'] = $tag;
$req_data['offset'] = 0;
$req_data['limit'] = 9;
$result = $this->m_tag->tag_join_life_list($req_data);
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['tag_delivery_count'] = $tag_delivery_count;
$return_data['tag'] = $tag;
$return_data['arr_relation_tag'] = $arr_relation_tag;
# view
return $this->load->view('/web/life/tag', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : tag_list_more
# CREATE : 2018-05-01
#---------------------------------------------------------------------------
function fn_ajax_tag_list_more() {
# request
$page = trim($this->input->get_post('page', TRUE));
$tag = trim($this->input->get_post('tag', TRUE));
$content_type = '3';
$limit = 9;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['tag'] = $tag;
$req_data['content_type'] = $content_type;
$this->load->model('web/m_tag');
$list = $this->m_tag->tag_join_life_list($req_data);
$total_count = $this->m_tag->tag_join_life_list_total_count($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
if(count($list) > 0) {
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
} else {
$return_data['result_code'] = '9999';
}
# view
return $this->load->view("/web/life/tag_list_more", $return_data);
}
}
?>

View File

@@ -0,0 +1,294 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
include_once(APPPATH.'core/web/cm_exceptions.php');
class main extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->library('user_agent');
$this->load->helper('crossmap/tool_helper');
$this->load->helper('crossmap/exception_helper');
}
public function index()
{
/*
from _remap
*/
$this->load->helper('cookie');
$session_id = get_cookie('crossmap_save_id');
# session
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($session_id != '' && $SES_MEMBER_ID=='') {
# model - session 가져오기
$this->load->model('web/m_ci_sessions');
$session_result = $this->m_ci_sessions->ci_sessions_select($session_id);
session_decode($session_result['data']);
}
if($SES_MEMBER_ID!='') {
$expire_date = date("Y-m-d H:i:s", strtotime("+10 minutes"));
# model - 중복로그인 체크용
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
$req_data['expire_date'] = $expire_date;
$this->load->model('web/m_member_login');
$this->m_member_login->member_login_member_id_member_ip_update($req_data);
}
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$controller = $this->uri->segment(2);
#광고
$this->load->model('web/m_advertisement');
$advertisement = $this->m_advertisement->find_ad_by_page_key('Main');
// $this->config->load('filecache',TRUE);
// $filecache = $this->config->item('file_cache_path','filecache');
// $this->load->library('advertisement_lib',['file_cache_path'=>$filecache]);
// $advertisement = json_decode($this->advertisement_lib->get_ad_cache());
/*
from fn_index()
*/
$now_date = date("Y-m-d");
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_list();
# 오늘의 말씀
$this->load->model('web/m_today_word');
$arr_today_word = $this->m_today_word->today_word_where_display_date_select($now_date);
# 테마
# theme_type = 1 (헤드라인뉴스), theme_type = 8 (오늘의칼럼), theme_type = 11 (라이프홈), theme_type = 12 (데일리큐티)
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = array('1', '11', '12');
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
$arr_headline_news = array();
$arr_life_home = array();
$arr_daily_cutie = array();
foreach ($arr_theme as $val) {
if($val['theme_type'] == 1) $arr_headline_news[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['main_img'] ? $val['main_img'] : $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 11) $arr_life_home[$val['rank']] = array('title' => $val['title'], 'sub_title'=> $val['sub_title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 12) $arr_daily_cutie[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
}
// 오늘의 칼럼
$req_data['theme_types'] = array('8');
$arr_today_column = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
# 카드뉴스 - 기타섹션 테마
$this->load->model('web/m_etc_section');
$etc_section_type = 4;
$arr_card_news = $this->m_etc_section->etc_section_where_theme_type_list($etc_section_type);
# 언론
$this->load->model('web/m_press');
$arr_press = $this->m_press->press_all_list();
# 카테고리별
$this->load->model('web/m_main_category_company');
$arr_company = $this->m_main_category_company->main_category_company_all_list();
$arr_content = array();
$content_idx = $this->uri->segment(4);
// 모아보기
// 말씀과 묵상
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 6;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '1';
$req_data['sort_column'] = 'a.display_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 6;
$this->load->model('admin/life/m_life');
// 1-1 웹툰 모아보기
$this->load->model('maptoon/m_maptoon');
$mt_rquset['idx']='0';
$mt_rquset['limit']='6';
$mt_rquset['div']='main';
$maptoon=$this->m_maptoon->get_display_episodes($mt_rquset);
$arr_maptoon=array();
// 1-1. 이야기QT
$req_data['search_category_code1'] = 8;
$req_data['search_category_code2'] = 5;
$this->load->model('admin/life/m_life');
$arr_heart_opening_story = $this->m_life->life_list($req_data);
$req_data['search_category_code2'] = '';
// 1-3. 은혜한구절
$req_data['search_category_code1'] = 10;
$req_data['search_category_code2'] = 7;
$this->load->model('admin/life/m_life');
$arr_gracious_verse = $this->m_life->life_list($req_data);
$req_data['search_category_code2'] = '';
/*
// 1-1. 찬양
$req_data['limit'] = 6;
$arr_praise = $this->m_life->life_list($req_data);
// 1-2. 말씀
$req_data['search_category_code1'] = 5;
$this->load->model('admin/life/m_life');
$arr_gospel = $this->m_life->life_list($req_data);
// 1-3. 성경 지식인
$req_data['search_category_code1'] = 10;
$this->load->model('admin/life/m_life');
$arr_knowledge = $this->m_life->life_list($req_data);
*/
// 2.크로스맵TV
// 2-1.말씀영상
$req_data['search_category_code1'] = 22;
$req_data['search_category_code2'] = 42;
$req_data['limit'] = 7;
$this->load->model('admin/life/m_life');
$arr_tv_gospel = $this->m_life->life_list($req_data);
// 2-2.찬양영상
$req_data['search_category_code2'] = 43;
$this->load->model('admin/life/m_life');
$arr_tv_praise = $this->m_life->life_list($req_data);
// 2-3.간증
$req_data['search_category_code2'] = 44;
$this->load->model('admin/life/m_life');
$arr_tv_testimony = $this->m_life->life_list($req_data);
// 2-4.토크쇼
$req_data['search_category_code2'] = 45;
$this->load->model('admin/life/m_life');
$arr_tv_talkshow = $this->m_life->life_list($req_data);
// 3.이런건 어때?
// 3-1.은혜
// $req_data['search_category_code1'] = 18;
// $req_data['search_category_code2'] = '';
// $req_data['limit'] = 24;
// $this->load->model('admin/life/m_life');
// $arr_grace = $this->m_life->life_list($req_data);
// 3-2.사랑
// $req_data['search_category_code1'] = 19;
// $this->load->model('admin/life/m_life');
// $arr_love = $this->m_life->life_list($req_data);
// 3-4.마무리
// $req_data['search_category_code1'] = 21;
// $this->load->model('admin/life/m_life');
// $arr_completion = $this->m_life->life_list($req_data);
/*
// 3-3.크리스마스
$req_data['search_category_code1'] = 20;
$this->load->model('admin/life/m_life');
$arr_christmas = $this->m_life->life_list($req_data);
*/
// 3-1.운율이 있는 묵상
$req_data['search_category_code1'] = 8;
$req_data['search_category_code2'] = 6;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_meditation_contemplation = $this->m_life->life_list($req_data);
// 3-2.말씀엽서
$req_data['search_category_code1'] = 5;
$req_data['search_category_code2'] = 3;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_bible_postcard = $this->m_life->life_list($req_data);
// 3-3.책 읽는 크리스천
$req_data['search_category_code1'] = 17;
$req_data['search_category_code2'] = 26;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_christian_reading = $this->m_life->life_list($req_data);
// 3-4. 함께 기도해요
$req_data['search_category_code1'] = 26;
$req_data['search_category_code2'] = '';
$req_data['search_click2'] = 1;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_Prayer = $this->m_life->life_list($req_data);
$i=0;
foreach($maptoon as $v){
$arr_maptoon[]=$v;
$arr_maptoon[$i]['title']=$v['name'].'-'.$v['title'];
$arr_maptoon[$i]['div']="mt";
$i++;
}
$melon_json = '';//file_get_contents('http://35.224.33.187/melon.json');
$melon_json = file_get_contents(dirname(__FILE__). '/melon.json');
if($melon_json!='')
$melon_arr = json_decode($melon_json,true);
else
$melon_arr = array();
# view data
$return_data = array();
$return_data['site_info'] = $site_info;
$return_data['advertisement'] = $advertisement;
$return_data['arr_weather'] = $arr_weather;
$return_data['arr_today_word'] = $arr_today_word;
$return_data['arr_headline_news'] = $arr_headline_news;
$return_data['arr_life_home'] = $arr_life_home;
$return_data['arr_daily_cutie'] = $arr_daily_cutie;
$return_data['arr_card_news'] = $arr_card_news;
$return_data['arr_press'] = $arr_press;
$return_data['arr_company'] = $arr_company;
$return_data['arr_heart_opening_story'] = $arr_heart_opening_story;
$return_data['arr_maptoon'] = $arr_maptoon;
$return_data['arr_gracious_verse'] = $arr_gracious_verse;
// $return_data['arr_praise'] = $arr_praise;
// $return_data['arr_gospel'] = $arr_gospel;
// $return_data['arr_knowledge'] = $arr_knowledge;
$return_data['arr_tv_gospel'] = $arr_tv_gospel;
$return_data['arr_tv_praise'] = $arr_tv_praise;
$return_data['arr_tv_testimony'] = $arr_tv_testimony;
$return_data['arr_tv_talkshow'] = $arr_tv_talkshow;
// $return_data['arr_grace'] = $arr_grace;
// $return_data['arr_love'] = $arr_love;
// $return_data['arr_christmas'] = $arr_christmas;
// $return_data['arr_completion'] = $arr_completion;
$return_data['arr_today_column'] = $arr_today_column;
$return_data['arr_melon_ccm'] = $melon_arr;
$return_data['arr_meditation_contemplation'] = $arr_meditation_contemplation;
$return_data['arr_bible_postcard'] = $arr_bible_postcard;
$return_data['arr_christian_reading'] = $arr_christian_reading;
$return_data['arr_Prayer'] = $arr_Prayer;
$this->load->library('user_agent');
if($this->agent->is_mobile()) {
$return_data['is_mobile'] = true;
} else {
$return_data['is_mobile'] = false;
}
$this->load->view('/web/index3', $return_data);
}
}

View File

@@ -0,0 +1,77 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class main_bak extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 메인
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function fn_index() {
$now_date = date("Y-m-d");
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_list();
# 오늘의 말씀
$this->load->model('web/m_today_word');
$arr_today_word = $this->m_today_word->today_word_where_display_date_select($now_date);
# 테마
# theme_type = 1 (헤드라인뉴스), theme_type = 8 (오늘의칼럼), theme_type = 11 (라이프홈), theme_type = 12 (데일리큐티)
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = array('1', '11', '12');
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
$arr_headline_news = array();
$arr_life_home = array();
$arr_daily_cutie = array();
foreach ($arr_theme as $val) {
if($val['theme_type'] == 1) $arr_headline_news[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 11) $arr_life_home[$val['rank']] = array('title' => $val['title'], 'sub_title'=> $val['sub_title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 12) $arr_daily_cutie[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
}
# 카드뉴스 - 기타섹션 테마
$this->load->model('web/m_etc_section');
$etc_section_type = 4;
$arr_card_news = $this->m_etc_section->etc_section_where_theme_type_list($etc_section_type);
# 언론
$this->load->model('web/m_press');
$arr_press = $this->m_press->press_all_list();
# 카테고리별
$this->load->model('web/m_main_category_company');
$arr_company = $this->m_main_category_company->main_category_company_all_list();
# view data
$return_data = array();
$return_data['arr_weather'] = $arr_weather;
$return_data['arr_today_word'] = $arr_today_word;
$return_data['arr_headline_news'] = $arr_headline_news;
$return_data['arr_life_home'] = $arr_life_home;
$return_data['arr_daily_cutie'] = $arr_daily_cutie;
$return_data['arr_card_news'] = $arr_card_news;
$return_data['arr_press'] = $arr_press;
$return_data['arr_company'] = $arr_company;
# view
return $this->load->view('/web/index', $return_data, true);
}
}
?>

View File

@@ -0,0 +1,255 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
include_once(APPPATH.'core/web/cm_exceptions.php');
class main_bak2 extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->library('user_agent');
$this->load->helper('crossmap/tool_helper');
$this->load->helper('crossmap/exception_helper');
}
public function index()
{
/*
from _remap
*/
$this->load->helper('cookie');
$session_id = get_cookie('crossmap_save_id');
# session
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($session_id != '' && $SES_MEMBER_ID=='') {
# model - session 가져오기
$this->load->model('web/m_ci_sessions');
$session_result = $this->m_ci_sessions->ci_sessions_select($session_id);
session_decode($session_result['data']);
}
if($SES_MEMBER_ID!='') {
$expire_date = date("Y-m-d H:i:s", strtotime("+10 minutes"));
# model - 중복로그인 체크용
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
$req_data['expire_date'] = $expire_date;
$this->load->model('web/m_member_login');
$this->m_member_login->member_login_member_id_member_ip_update($req_data);
}
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$controller = $this->uri->segment(2);
/*
from fn_index()
*/
$now_date = date("Y-m-d");
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_list();
# 오늘의 말씀
$this->load->model('web/m_today_word');
$arr_today_word = $this->m_today_word->today_word_where_display_date_select($now_date);
# 테마
# theme_type = 1 (헤드라인뉴스), theme_type = 8 (오늘의칼럼), theme_type = 11 (라이프홈), theme_type = 12 (데일리큐티)
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = array('1', '11', '12');
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
$arr_headline_news = array();
$arr_life_home = array();
$arr_daily_cutie = array();
foreach ($arr_theme as $val) {
if($val['theme_type'] == 1) $arr_headline_news[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 11) $arr_life_home[$val['rank']] = array('title' => $val['title'], 'sub_title'=> $val['sub_title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 12) $arr_daily_cutie[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
}
// 오늘의 칼럼
$req_data['theme_types'] = array('8');
$arr_today_column = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
# 카드뉴스 - 기타섹션 테마
$this->load->model('web/m_etc_section');
$etc_section_type = 4;
$arr_card_news = $this->m_etc_section->etc_section_where_theme_type_list($etc_section_type);
# 언론
$this->load->model('web/m_press');
$arr_press = $this->m_press->press_all_list();
# 카테고리별
$this->load->model('web/m_main_category_company');
$arr_company = $this->m_main_category_company->main_category_company_all_list();
$arr_content = array();
$content_idx = $this->uri->segment(4);
// 모아보기
// 말씀과 묵상
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 6;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '';
$req_data['sort_column'] = 'a.reg_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 7;
$this->load->model('admin/life/m_life');
//찬양
$arr_praise = $this->m_life->life_list($req_data);
//말씀
$req_data['search_category_code1'] = 5;
$this->load->model('admin/life/m_life');
$arr_gospel = $this->m_life->life_list($req_data);
//지식인
$req_data['search_category_code1'] = 10;
$this->load->model('admin/life/m_life');
$arr_knowledge = $this->m_life->life_list($req_data);
// 2.크로스맵TV
// 2-1.말씀영상
$req_data['search_category_code1'] = 22;
$req_data['search_category_code2'] = 42;
$req_data['limit'] = 8;
$this->load->model('admin/life/m_life');
$arr_tv_gospel = $this->m_life->life_list($req_data);
// 2-2.찬양영상
$req_data['search_category_code2'] = 43;
$this->load->model('admin/life/m_life');
$arr_tv_praise = $this->m_life->life_list($req_data);
// 2-3.간증
$req_data['search_category_code2'] = 44;
$this->load->model('admin/life/m_life');
$arr_tv_testimony = $this->m_life->life_list($req_data);
// 2-4.토크쇼
$req_data['search_category_code2'] = 45;
$this->load->model('admin/life/m_life');
$arr_tv_talkshow = $this->m_life->life_list($req_data);
// 3.이런건 어때?
// 3-1.은혜
$req_data['search_category_code1'] = 18;
$req_data['search_category_code2'] = '';
$req_data['limit'] = 7;
$this->load->model('admin/life/m_life');
$arr_grace = $this->m_life->life_list($req_data);
// 3-2.사랑
$req_data['search_category_code1'] = 19;
$this->load->model('admin/life/m_life');
$arr_love = $this->m_life->life_list($req_data);
// 3-3.크리스마스
$req_data['search_category_code1'] = 20;
$this->load->model('admin/life/m_life');
$arr_christmas = $this->m_life->life_list($req_data);
// 3-4.마무리
$req_data['search_category_code1'] = 21;
$this->load->model('admin/life/m_life');
$arr_completion = $this->m_life->life_list($req_data);
// 1-1. 이야기QT
$req_data['search_category_code1'] = 8;
$req_data['search_category_code2'] = 5;
$this->load->model('admin/life/m_life');
$arr_heart_opening_story = $this->m_life->life_list($req_data);
$req_data['search_category_code2'] = '';
$melon_json = file_get_contents('http://35.224.33.187/melon.json');
if($melon_json!='')
$melon_arr = json_decode($melon_json,true);
else
$melon_arr = array();
// 3-4. 함께 기도해요
$req_data['search_category_code1'] = 9;
$req_data['search_category_code2'] = '';
$req_data['search_click2'] = 1;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_Prayer = $this->m_life->life_list($req_data);
// 1-3. 은혜한구절
$req_data['search_category_code1'] = 10;
$req_data['search_category_code2'] = 7;
$this->load->model('admin/life/m_life');
$arr_gracious_verse = $this->m_life->life_list($req_data);
$req_data['search_category_code2'] = '';
// 3-1.운율이 있는 묵상
$req_data['search_category_code1'] = 8;
$req_data['search_category_code2'] = 6;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_meditation_contemplation = $this->m_life->life_list($req_data);
// 3-2.말씀엽서
$req_data['search_category_code1'] = 5;
$req_data['search_category_code2'] = 3;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_bible_postcard = $this->m_life->life_list($req_data);
// 3-3.책 읽는 크리스천
$req_data['search_category_code1'] = 17;
$req_data['search_category_code2'] = 26;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_christian_reading = $this->m_life->life_list($req_data);
# view data
$return_data = array();
$return_data['site_info'] = $site_info;
$return_data['arr_weather'] = $arr_weather;
$return_data['arr_today_word'] = $arr_today_word;
$return_data['arr_headline_news'] = $arr_headline_news;
$return_data['arr_life_home'] = $arr_life_home;
$return_data['arr_daily_cutie'] = $arr_daily_cutie;
$return_data['arr_card_news'] = $arr_card_news;
$return_data['arr_press'] = $arr_press;
$return_data['arr_company'] = $arr_company;
$return_data['arr_praise'] = $arr_praise;
$return_data['arr_gospel'] = $arr_gospel;
$return_data['arr_knowledge'] = $arr_knowledge;
$return_data['arr_tv_gospel'] = $arr_tv_gospel;
$return_data['arr_tv_praise'] = $arr_tv_praise;
$return_data['arr_tv_testimony'] = $arr_tv_testimony;
$return_data['arr_tv_talkshow'] = $arr_tv_talkshow;
$return_data['arr_grace'] = $arr_grace;
$return_data['arr_love'] = $arr_love;
$return_data['arr_christmas'] = $arr_christmas;
$return_data['arr_completion'] = $arr_completion;
$return_data['arr_today_column'] = $arr_today_column;
$return_data['arr_heart_opening_story'] = $arr_heart_opening_story;
$return_data['arr_Prayer'] = $arr_Prayer;
$return_data['arr_gracious_verse'] = $arr_gracious_verse;
$return_data['arr_meditation_contemplation'] = $arr_meditation_contemplation;
$return_data['arr_bible_postcard'] = $arr_bible_postcard;
$return_data['arr_christian_reading'] = $arr_christian_reading;
$return_data['arr_melon_ccm'] = $melon_arr;
$this->load->library('user_agent');
if($this->agent->is_mobile()) {
$return_data['is_mobile'] = true;
} else {
$return_data['is_mobile'] = false;
}
$this->load->view('/web/index2', $return_data);
}
}

View File

@@ -0,0 +1,297 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
include_once(APPPATH.'core/web/cm_exceptions.php');
include_once(APPPATH.'core/web/cm_controller.php');
class testmain extends cm_Controller {
function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->library('user_agent');
$this->load->helper('crossmap/tool_helper');
$this->load->helper('crossmap/exception_helper');
}
public function fn_index()
{
/*
from _remap
*/
$this->load->helper('cookie');
$session_id = get_cookie('crossmap_save_id');
# session
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($session_id != '' && $SES_MEMBER_ID=='') {
echo "여기 작동한다";
# model - session 가져오기
$this->load->model('web/m_ci_sessions');
$session_result = $this->m_ci_sessions->ci_sessions_select($session_id);
echo $session_result;
print_r($session_result);
session_decode($session_result['data']);
}
if($SES_MEMBER_ID!='') {
$expire_date = date("Y-m-d H:i:s", strtotime("+10 minutes"));
# model - 중복로그인 체크용
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
$req_data['expire_date'] = $expire_date;
$this->load->model('web/m_member_login');
$this->m_member_login->member_login_member_id_member_ip_update($req_data);
}
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$controller = $this->uri->segment(2);
#광고
// $this->load->model('web/m_advertisement');
// $advertisement = $this->m_advertisement->find_ad_by_page_key('Main');
$this->config->load('filecache',TRUE);
$filecache = $this->config->item('file_cache_path','filecache');
$this->load->library('advertisement_lib',['file_cache_path'=>$filecache]);
$advertisement = json_decode($this->advertisement_lib->get_ad_cache());
/*
from fn_index()
*/
$now_date = date("Y-m-d");
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_list();
# 오늘의 말씀
$this->load->model('web/m_today_word');
$arr_today_word = $this->m_today_word->today_word_where_display_date_select($now_date);
# 테마
# theme_type = 1 (헤드라인뉴스), theme_type = 8 (오늘의칼럼), theme_type = 11 (라이프홈), theme_type = 12 (데일리큐티)
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = array('1', '11', '12');
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
$arr_headline_news = array();
$arr_life_home = array();
$arr_daily_cutie = array();
foreach ($arr_theme as $val) {
if($val['theme_type'] == 1) $arr_headline_news[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 11) $arr_life_home[$val['rank']] = array('title' => $val['title'], 'sub_title'=> $val['sub_title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 12) $arr_daily_cutie[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
}
// 오늘의 칼럼
$req_data['theme_types'] = array('8');
$arr_today_column = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
# 카드뉴스 - 기타섹션 테마
$this->load->model('web/m_etc_section');
$etc_section_type = 4;
$arr_card_news = $this->m_etc_section->etc_section_where_theme_type_list($etc_section_type);
# 언론
$this->load->model('web/m_press');
$arr_press = $this->m_press->press_all_list();
# 카테고리별
$this->load->model('web/m_main_category_company');
$arr_company = $this->m_main_category_company->main_category_company_all_list();
$arr_content = array();
$content_idx = $this->uri->segment(4);
// 모아보기
// 말씀과 묵상
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 6;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '1';
$req_data['sort_column'] = 'a.reg_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 6;
$this->load->model('admin/life/m_life');
// 1-1 웹툰 모아보기
$this->load->model('maptoon/m_maptoon');
$mt_rquset['idx']='0';
$mt_rquset['limit']='6';
$mt_rquset['div']='main';
$maptoon=$this->m_maptoon->get_display_episodes($mt_rquset);
$arr_maptoon=array();
$i=0;
// 1-1. 이야기QT
$req_data['search_category_code1'] = 8;
$req_data['search_category_code2'] = 5;
$this->load->model('admin/life/m_life');
$arr_heart_opening_story = $this->m_life->life_list($req_data);
$req_data['search_category_code2'] = '';
// 1-3. 은혜한구절
$req_data['search_category_code1'] = 10;
$req_data['search_category_code2'] = 7;
$this->load->model('admin/life/m_life');
$arr_gracious_verse = $this->m_life->life_list($req_data);
$req_data['search_category_code2'] = '';
/*
// 1-1. 찬양
$req_data['limit'] = 6;
$arr_praise = $this->m_life->life_list($req_data);
// 1-2. 말씀
$req_data['search_category_code1'] = 5;
$this->load->model('admin/life/m_life');
$arr_gospel = $this->m_life->life_list($req_data);
// 1-3. 성경 지식인
$req_data['search_category_code1'] = 10;
$this->load->model('admin/life/m_life');
$arr_knowledge = $this->m_life->life_list($req_data);
*/
// 2.크로스맵TV
// 2-1.말씀영상
$req_data['search_category_code1'] = 22;
$req_data['search_category_code2'] = 42;
$req_data['limit'] = 7;
$this->load->model('admin/life/m_life');
$arr_tv_gospel = $this->m_life->life_list($req_data);
// 2-2.찬양영상
$req_data['search_category_code2'] = 43;
$this->load->model('admin/life/m_life');
$arr_tv_praise = $this->m_life->life_list($req_data);
// 2-3.간증
$req_data['search_category_code2'] = 44;
$this->load->model('admin/life/m_life');
$arr_tv_testimony = $this->m_life->life_list($req_data);
// 2-4.토크쇼
$req_data['search_category_code2'] = 45;
$this->load->model('admin/life/m_life');
$arr_tv_talkshow = $this->m_life->life_list($req_data);
// 3.이런건 어때?
// 3-1.은혜
// $req_data['search_category_code1'] = 18;
// $req_data['search_category_code2'] = '';
// $req_data['limit'] = 24;
// $this->load->model('admin/life/m_life');
// $arr_grace = $this->m_life->life_list($req_data);
// 3-2.사랑
// $req_data['search_category_code1'] = 19;
// $this->load->model('admin/life/m_life');
// $arr_love = $this->m_life->life_list($req_data);
// 3-4.마무리
// $req_data['search_category_code1'] = 21;
// $this->load->model('admin/life/m_life');
// $arr_completion = $this->m_life->life_list($req_data);
/*
// 3-3.크리스마스
$req_data['search_category_code1'] = 20;
$this->load->model('admin/life/m_life');
$arr_christmas = $this->m_life->life_list($req_data);
*/
// 3-1.운율이 있는 묵상
$req_data['search_category_code1'] = 8;
$req_data['search_category_code2'] = 6;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_meditation_contemplation = $this->m_life->life_list($req_data);
// 3-2.말씀엽서
$req_data['search_category_code1'] = 5;
$req_data['search_category_code2'] = 3;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_bible_postcard = $this->m_life->life_list($req_data);
// 3-3.책 읽는 크리스천
$req_data['search_category_code1'] = 17;
$req_data['search_category_code2'] = 26;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_christian_reading = $this->m_life->life_list($req_data);
// 3-4. 함께 기도해요
$req_data['search_category_code1'] = 9;
$req_data['search_category_code2'] = '';
$req_data['search_click2'] = 1;
$req_data['limit'] = 24;
$this->load->model('admin/life/m_life');
$arr_Prayer = $this->m_life->life_list($req_data);
foreach($maptoon as $v){
$arr_maptoon[]=$v;
$arr_maptoon[$i]['title']=$v['name'].'-'.$v['title'];
$arr_maptoon[$i]['div']="mt";
$i++;
}
$melon_json = file_get_contents('http://35.224.33.187/melon.json');
if($melon_json!='')
$melon_arr = json_decode($melon_json,true);
else
$melon_arr = array();
# view data
$return_data = array();
$return_data['site_info'] = $site_info;
$return_data['advertisement'] = $advertisement;
$return_data['arr_weather'] = $arr_weather;
$return_data['arr_today_word'] = $arr_today_word;
$return_data['arr_headline_news'] = $arr_headline_news;
$return_data['arr_life_home'] = $arr_life_home;
$return_data['arr_daily_cutie'] = $arr_daily_cutie;
$return_data['arr_card_news'] = $arr_card_news;
$return_data['arr_press'] = $arr_press;
$return_data['arr_company'] = $arr_company;
$return_data['arr_heart_opening_story'] = $arr_heart_opening_story;
$return_data['arr_maptoon'] = $arr_maptoon;
$return_data['arr_gracious_verse'] = $arr_gracious_verse;
// $return_data['arr_praise'] = $arr_praise;
// $return_data['arr_gospel'] = $arr_gospel;
// $return_data['arr_knowledge'] = $arr_knowledge;
$return_data['arr_tv_gospel'] = $arr_tv_gospel;
$return_data['arr_tv_praise'] = $arr_tv_praise;
$return_data['arr_tv_testimony'] = $arr_tv_testimony;
$return_data['arr_tv_talkshow'] = $arr_tv_talkshow;
// $return_data['arr_grace'] = $arr_grace;
// $return_data['arr_love'] = $arr_love;
// $return_data['arr_christmas'] = $arr_christmas;
// $return_data['arr_completion'] = $arr_completion;
$return_data['arr_today_column'] = $arr_today_column;
$return_data['arr_melon_ccm'] = $melon_arr;
$return_data['arr_meditation_contemplation'] = $arr_meditation_contemplation;
$return_data['arr_bible_postcard'] = $arr_bible_postcard;
$return_data['arr_christian_reading'] = $arr_christian_reading;
$return_data['arr_Prayer'] = $arr_Prayer;
$this->load->library('user_agent');
if($this->agent->is_mobile()) {
$return_data['is_mobile'] = true;
} else {
$return_data['is_mobile'] = false;
}
$this->load->view('/web/index3test', $return_data);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
class main extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->library('user_agent');
$this->load->helper('crossmap/tool_helper');
$this->load->helper('crossmap/exception_helper');
$this->load->library('Post', '', 'post');
$this->load->model('config_model');
$this->load->model('web/m_advertisement');
}
public function index()
{
$this->load->helper('cookie');
$session_id = get_cookie('crossmap_save_id');
# session
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if ($session_id != '' && $SES_MEMBER_ID == '') {
# model - session 가져오기
$this->load->model('web/m_ci_sessions');
$session_result = $this->m_ci_sessions->ci_sessions_select($session_id);
session_decode($session_result['data']);
}
if ($SES_MEMBER_ID != '') {
$expire_date = date("Y-m-d H:i:s", strtotime("+10 minutes"));
# model - 중복로그인 체크용
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
$req_data['expire_date'] = $expire_date;
$this->load->model('web/m_member_login');
$this->m_member_login->member_login_member_id_member_ip_update($req_data);
}
$graceCategories = array('result' => $this->category_model->findById(array_values($this->config->item('categories')['grace']))->result());
foreach ($graceCategories['result'] as $gcategory) {
$graceCategories[$gcategory->idx] = $gcategory;
}
$arr_bible_postcard = $this->post->getPostsByCategoryId(array($this->config->item('categories')['grace']['postcard']), 24);
$arr_christian_reading = $this->post->getPostsByCategoryId(array($this->config->item('categories')['grace']['book']), 24);
$arr_heart_opening_story = $this->post->getPostsByCategoryId(array($this->config->item('categories')['grace']['dailyQT']), 18);
$arr_heart_opening_story1 = array_slice($arr_heart_opening_story, 0, 2);
$arr_heart_opening_story2 = array_slice($arr_heart_opening_story, 2, 15);
$arr_heart_opening_story = array_merge($arr_heart_opening_story1, array(
array(
'banner_url' => 'https://dramabible.org/',
'main_img' => '/assets/images/banner-2020-342343.jpg',
'title' => '<span style="color:#26bcb7">AD</span> 성경 듣기! 드라마 바이블로 더욱 생동감있게!!',
),
));
$arr_heart_opening_story = array_merge($arr_heart_opening_story, $arr_heart_opening_story2);
$arr_gracious_verse = $this->post->getPostsByCategoryId(array($this->config->item('categories')['grace']['enQT']), 18);
$arr_qna = $this->post->getPostsByCategoryId(array($this->config->item('categories')['grace']['qna']), 18);
$arr_headline_news = $this->getHomeTopNews();
$photoHeadlineNewsPostId = array();
foreach ($arr_headline_news as $k => $phn) {
$photoHeadlineNewsPostId[] = $phn['idx'];
$arr_headline_news[$k]['theme_img'] = $phn['main_img'];
$arr_headline_news[$k]['content_idx'] = $phn['idx'];
}
$lackingNews = $this->db->order_by('reg_date', 'desc')
->where('is_del', 'N')->where('is_display', 'Y')
->limit(24 - count($arr_headline_news))->where_not_in('idx', $photoHeadlineNewsPostId)->get('news')->result_array();
foreach ($lackingNews as $val) {
array_push($arr_headline_news, array('title' => $val['title'],
'theme_img' => $val['main_img'] ? $val['main_img'] : $val['theme_img'], 'content_idx' => $val['idx']));
}
$return_data = array();
$return_data['advertisement'] = $this->m_advertisement->find_ad_by_page_key('Main');
$return_data['arr_today_word'] = $this->getHomeTodayWord();
$return_data['arr_headline_news'] = $arr_headline_news;
$return_data['arr_daily_cutie'] = $this->getDailyQt();
$return_data['arr_heart_opening_story'] = $arr_heart_opening_story;
$return_data['arr_gracious_verse'] = $arr_gracious_verse;
$return_data['arr_qna'] = $arr_qna;
$return_data['arr_tv_gospel'] = $this->post->getPostsByCategoryId(array(40), 16);
$return_data['arr_tv_praise'] = $this->post->getPostsByCategoryId(array(38), 16);
$return_data['arr_tv_testimony'] = $this->post->getPostsByCategoryId(array(39), 16);
$return_data['arr_tv_talkshow'] = $this->post->getPostsByCategoryId(array(41), 16);
$return_data['arr_bible_postcard'] = $arr_bible_postcard;
$return_data['arr_christian_reading'] = $arr_christian_reading;
$return_data['arr_Prayer'] = $this->post->getPostsByCategoryId(array(26), 24);
$return_data['graceCategories'] = $graceCategories;
$this->load->library('user_agent');
if ($this->agent->is_mobile()) {
$return_data['is_mobile'] = true;
} else {
$return_data['is_mobile'] = false;
}
$this->load->view('/web/nmain', $return_data);
}
private function getDailyQt()
{
$config = $this->config_model->findByTypeAndPage('home', 'homedailyqt')->get()->result();
if (count($config)) {
$today = date('Y-m-d');
foreach($config as $c) {
if(strstr($c->DpTime, $today)) {
return $this->post->getPost($c->PostId);
}
}
}
return $this->post->getPostsByCategoryId($this->config->item('categories')['grace']['dailyQT'], 1)[0];
}
private function getHomeTopNews()
{
$config = $this->config_model->findByTypeAndPage('home', 'hometopnews')->get()->result();
if (count($config)) {
$posts = array();
foreach ($config as $c) {
$posts[] = $c->PostId;
}
$news = $this->db->where_in('idx', $posts)->get('news')->result_array();
$nnews = array();
foreach ($config as $c) {
foreach($news as $n) {
if($n['idx'] == $c->PostId) {
$nnews[$c->OrderNum] = $n;
}
}
}
ksort($nnews);
return array_values($nnews);
} else {
return $this->post->getPostsByCategoryId($this->config->item('categories')['grace']['dailyQT'], 1)[0];
}
}
private function getHomeTodayWord() {
$config = $this->config_model->findByTypeAndPage('home', 'hometodayword')->get()->result_array();
if(count($config)) {
$today = date('Y-m-d');
foreach($config as $c) {
if(strstr($c['DpTime'], $today)) {
return array('word' => $c['Title'], 'title' => $c['Headline']);
}
}
}return array('word' => '', 'title' => '');
}
}

View File

@@ -0,0 +1,489 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once (APPPATH . 'core/web/cm_controller.php');
class maptoon extends cm_Controller
{
function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->library('user_agent');
$this->load->helper('crossmap/tool_helper');
$this->load->helper('crossmap/exception_helper');
//header('location:/');
//exit(3);
}
/*
* extract part of widget data
*/
function get_widget_data($orig_arr, $key, $num)
{
if (is_array($orig_arr) == FALSE || trim($key) == '' || is_numeric($num) == FALSE || $num <= 0) {
return FALSE;
}
array_multisort(array_column($orig_arr, $key), SORT_DESC, $orig_arr);
$ret = array_slice($orig_arr, 0, $num);
return $ret;
}
function fn_index()
{
$this->config->load('filecache', TRUE);
$filecache = $this->config->item('file_cache_path', 'filecache');
$this->load->library('maptoon_lib', [
'file_cache_path' => $filecache
]);
// 1. get slideshow
$slideshow = $this->maptoon_lib->get_category_cache(8);
$slideshow_arr = json_decode($slideshow, TRUE);
// 2. 뜨끈뜨끈한 신작
$new_release = $this->maptoon_lib->get_category_cache(9);
$new_release_arr = json_decode($new_release, TRUE);
$new_release_date = $this->get_widget_data($new_release_arr, 'reg_date', 6);
$new_release_count = $this->get_widget_data($new_release_arr, 'view_count', 6);
$new_release_grade = $this->get_widget_data($new_release_arr, 'grade', 6);
// 3. 성경을 재미있게
$fun = $this->maptoon_lib->get_category_cache(10);
$fun_arr = json_decode($fun, TRUE);
$fun_date = $this->get_widget_data($fun_arr, 'reg_date', 3);
$fun_count = $this->get_widget_data($fun_arr, 'view_count', 3);
$fun_grade = $this->get_widget_data($fun_arr, 'grade', 3);
$faith = $this->maptoon_lib->get_category_cache(11);
$faith_arr = json_decode($faith, TRUE);
$faith_date = $this->get_widget_data($faith_arr, 'reg_date', 9);
$faith_count = $this->get_widget_data($faith_arr, 'view_count', 9);
$faith_grade = $this->get_widget_data($faith_arr, 'grade', 9);
$menu_home = 1;
$return_data = [
'slideshow' => $slideshow_arr,
'new_release' => $new_release_arr,
'new_release_date' => $new_release_date,
'new_release_count' => $new_release_count,
'new_release_grade' => $new_release_grade,
'fun_date' => $fun_date,
'fun_count' => $fun_count,
'fun_grade' => $fun_grade,
'faith_date' => $faith_date,
'faith_count' => $faith_count,
'faith_grade' => $faith_grade,
'menu_home' => $menu_home
];
return $this->load->view('/web/maptoon/maptoon_main', $return_data, true);
}
/*
* 완결 웹툰 페이지
*/
function fn_completed()
{
$this->config->load('filecache', TRUE);
$filecache = $this->config->item('file_cache_path', 'filecache');
// today webtoon
$this->load->model('maptoon/m_maptoon');
$today = $this->m_maptoon->get_today_maptoon();
$today_date = strtolower(date("D"));
$completed = $this->db->select('l.*, c.name cartoonist')
->join('mt_cartoonists c', 'l.mt_cartoonists_idx=c.idx')
->get_where('mt_list l', [
'status' => 1
])
->result();
// menu
$menu_completed = 1;
$return_data = [
'completed' => $completed,
'today' => $today,
'today_date' => $today_date,
'menu_completed' => $menu_completed
];
return $this->load->view('/web/maptoon/maptoon_completed', $return_data, true);
}
/*
* 연재 웹툰 페이지
*/
function fn_ongoing()
{
$this->config->load('filecache', TRUE);
$filecache = $this->config->item('file_cache_path', 'filecache');
// today webtoon
$this->load->model('maptoon/m_maptoon');
$today = $this->m_maptoon->get_today_maptoon();
$today_date = strtolower(date("D"));
$this->load->library('maptoon_lib', [
'file_cache_path' => $filecache
]);
$recomm = $this->maptoon_lib->get_category_cache(13);
$recomm_arr = json_decode($recomm, TRUE);
$recomm_date = $this->get_widget_data($recomm_arr, 'reg_date', 6);
$recomm_count = $this->get_widget_data($recomm_arr, 'view_count', 6);
$recomm_grade = $this->get_widget_data($recomm_arr, 'grade', 6);
$story = $this->maptoon_lib->get_category_cache(14);
$story_arr = json_decode($story, TRUE);
$story_date = $this->get_widget_data($story_arr, 'reg_date', 3);
$story_count = $this->get_widget_data($story_arr, 'view_count', 3);
$story_grade = $this->get_widget_data($story_arr, 'grade', 3);
$read = $this->maptoon_lib->get_category_cache(15);
$read_arr = json_decode($read, TRUE);
$read_date = $this->get_widget_data($read_arr, 'reg_date', 3);
$read_count = $this->get_widget_data($read_arr, 'view_count', 3);
$read_grade = $this->get_widget_data($read_arr, 'grade', 3);
// menu
$menu_ongoing = 1;
$return_data = [
'recomm_date' => $recomm_date,
'recomm_count' => $recomm_count,
'recomm_grade' => $recomm_grade,
'story_date' => $story_date,
'story_count' => $story_count,
'story_grade' => $story_grade,
'read_date' => $read_date,
'read_count' => $read_count,
'read_grade' => $read_grade,
'today' => $today,
'today_date' => $today_date,
'menu_ongoing' => $menu_ongoing
];
return $this->load->view('/web/maptoon/maptoon_ongoing', $return_data, true);
}
// ---------------------------------------------------------------------------
// PURPOSE : maptoon list page
// CREATE : 2019-03-19
// ---------------------------------------------------------------------------
function fn_list()
{
$mt_id = $this->input->get('mtId');
if ($mt_id == null) {
header("Location: /web/maptoon");
} else {
$req_data['idx'] = $mt_id;
$this->load->model('maptoon/m_maptoon');
// 맵툰 정보
$mt_data = $this->m_maptoon->get_maptoon_list($req_data);
if (count($mt_data) == 0) {
header("Location: /web/maptoon");
}
// 공지사항
$notices = $this->m_maptoon->get_announcement_list($mt_id);
$arr_notice = array();
if (count($notices) != 0) {
$c_date = date("Y-m-d H:i:s");
foreach ($notices as $val) {
if ($val['s_date'] <= $c_date && $c_date <= $val['e_date']) {
array_push($arr_notice, $val['contents']);
}
}
}
$this->input->get('page') == null ? $page = 1 : $page = $this->input->get('page');
$limit = 10; // 페이지 당 표시할 에피소드
$offset = ($page - 1) * $limit;
$req_data['offset'] = ($page - 1) * $limit;
$req_data['limit'] = $limit;
// display episode 가져오기
$episodes = $this->m_maptoon->get_display_episodes($req_data);
// print_r($episodes);
// paging 설정
if ($page == '')
$page = 1;
// pagination
$page_data = array();
$page_data['total_count'] = $this->m_maptoon->get_totalcount_episodes($mt_id); // 전체 에피소드 수
$page_data['limit'] = $limit;
$page_data['base_url'] = '/web/maptoon/list';
$this->load->library('mt_pagination');
$pagination = $this->mt_pagination->create_pagenation($page_data);
$return_data = $page_data;
$return_data['page'] = $page;
$menu_list = 1;
$return_data['menu_list'] = $menu_list;
$return_data['pagination'] = $pagination; // page
$return_data['notice'] = $arr_notice; // 공지사항
$return_data['mt_data'] = $mt_data; // 맵툰 정보
$return_data['episodes'] = $episodes; // 에피소드 array
return $this->load->view('/web/maptoon/maptoon_list', $return_data, true);
}
}
// ---------------------------------------------------------------------------
// PURPOSE : maptoon article page
// CREATE : 2019-03-19
// ---------------------------------------------------------------------------
function fn_article()
{
$mt_idx = $this->input->get('mtId');
$episode_no = $this->input->get('no');
$req_data["mt_list_idx"] = $mt_idx;
$req_data["ep_no"] = $episode_no;
$this->load->model('maptoon/m_maptoon');
$episode = $this->m_maptoon->get_episode_by_mt_idx_episode_no($req_data);
if ($episode == false || $episode == NULL || count($episode) == 0) {
header("Location: /web/maptoon");
return false;
}
$user_id = $this->session->userdata('C_Member_Id');
$req_data2 = array(
'user_id' => $user_id,
'ep_idx' => $episode['idx']
);
// 좋아요 & 별점 참여 유무 확인
if ($user_id != '' || isset($user_id)) {
$is_data = $this->m_maptoon->ep_is_like_grade($req_data2);
}
if (isset($is_data)) {
$return_data['is_like'] = $is_data['is_like'];
$return_data['is_grade'] = $is_data['is_grade'];
} else {
$return_data['is_like'] = 0;
$return_data['is_grade'] = 0;
}
// 페이징 데이터 가져오기
$req_data["ep_idx"] = $episode['idx'];
$te_req_data['idx'] = $mt_idx;
$list = $this->m_maptoon->get_display_episodes($te_req_data);
$return_data['total_ep_count'] = $this->m_maptoon->get_totalcount_episodes($mt_idx);
// 맵툰 정보 공유 하기 위해
$mt_req_data['idx'] = $mt_idx;
// 조회수 업데이트
$this->m_maptoon->ep_hit_count($req_data2);
// 누적인기 웹툰
$mt_pop_rank = $this->m_maptoon->get_mt_pop_rank();
$mt_data = $this->m_maptoon->get_maptoon_list($mt_req_data);
$return_data["menu_article"] = 1;
$return_data["data"] = $episode;
$return_data["mt_data"] = $mt_data;
$return_data['mt_pop_rank'] = $mt_pop_rank;
$return_data['list'] = $list;
return $this->load->view('/web/maptoon/maptoon_article', $return_data, true);
}
// ---------------------------------------------------------------------------
// PURPOSE : recommened click function ajax
// CREATE : 2019-03-21
// ---------------------------------------------------------------------------
function fn_ajax_recommened()
{
$user_id = $this->session->userdata('C_Member_Id');
$response_data = array();
if ($user_id == '' || ! isset($user_id)) {
$message = "로그인이 필요한 서비스입니다.";
$response_data = array(
'message' => $message,
'state' => 0
);
} else {
$ep_idx = $this->input->post('ep_idx');
$mt_list_idx = $this->input->post('mt_list_idx');
$req_data = array(
'user_id' => $user_id,
'ep_idx' => $ep_idx,
'mt_list_idx' => $mt_list_idx
);
$this->load->model('maptoon/m_maptoon');
$response_data = $this->m_maptoon->like($req_data);
}
echo json_encode($response_data);
}
// ---------------------------------------------------------------------------
// PURPOSE : starScore click function ajax
// CREATE : 2019-03-25
// ---------------------------------------------------------------------------
function fn_ajax_star_score()
{
$user_id = $this->session->userdata('C_Member_Id');
$response_data = array();
if ($user_id == '' || ! isset($user_id)) {
$message = "로그인이 필요한 서비스입니다.";
$response_data = array(
'message' => $message,
'state' => 0
);
} else {
$ep_idx = $this->input->post('ep_idx');
$score = $this->input->post('score');
$req_data = array(
'user_id' => $user_id,
'ep_idx' => $ep_idx,
'score' => $score
);
$this->load->model('maptoon/m_maptoon');
$response_data = $this->m_maptoon->star_score($req_data);
}
echo json_encode($response_data);
}
function fn_ajax_mt_recommend()
{
$user_id = $this->session->userdata('C_Member_Id');
$mt_idx = $this->input->post('mt_list_idx');
if ($user_id == '' || ! isset($user_id)) {
$message = "로그인이 필요한 서비스입니다.";
$response_data = array(
'message' => $message,
'state' => 0
);
} else {
$req_data = array(
'user_id' => $user_id,
'mt_idx' => $mt_idx
);
$this->load->model('maptoon/m_maptoon');
$response_data = $this->m_maptoon->mt_recommend($req_data);
}
echo json_encode($response_data);
}
function fn_ongoing_1()
{
$this->config->load('filecache', TRUE);
$filecache = $this->config->item('file_cache_path', 'filecache');
// today webtoon
$this->load->model('maptoon/m_maptoon');
$today = $this->m_maptoon->get_today_maptoon();
$today_date = strtolower(date("D"));
$this->load->library('maptoon_lib', [
'file_cache_path' => $filecache
]);
$recomm = $this->maptoon_lib->get_category_cache(13);
$recomm_arr = json_decode($recomm, TRUE);
$recomm_date = $this->get_widget_data($recomm_arr, 'reg_date', 6);
$recomm_count = $this->get_widget_data($recomm_arr, 'view_count', 6);
$recomm_grade = $this->get_widget_data($recomm_arr, 'grade', 6);
$story = $this->maptoon_lib->get_category_cache(14);
$story_arr = json_decode($story, TRUE);
$story_date = $this->get_widget_data($story_arr, 'reg_date', 3);
$story_count = $this->get_widget_data($story_arr, 'view_count', 3);
$story_grade = $this->get_widget_data($story_arr, 'grade', 3);
$read = $this->maptoon_lib->get_category_cache(15);
$read_arr = json_decode($read, TRUE);
$read_date = $this->get_widget_data($read_arr, 'reg_date', 3);
$read_count = $this->get_widget_data($read_arr, 'view_count', 3);
$read_grade = $this->get_widget_data($read_arr, 'grade', 3);
// menu
$menu_ongoing = 1;
$return_data = [
'recomm_date' => $recomm_date,
'recomm_count' => $recomm_count,
'recomm_grade' => $recomm_grade,
'story_date' => $story_date,
'story_count' => $story_count,
'story_grade' => $story_grade,
'read_date' => $read_date,
'read_count' => $read_count,
'read_grade' => $read_grade,
'today' => $today,
'today_date' => $today_date,
'menu_ongoing' => $menu_ongoing
];
return $this->load->view('/web/maptoon/maptoon_ongoing_1', $return_data, true);
}
function fn_comments()
{
$mt_idx = $this->input->get('mtId');
$episode_no = $this->input->get('no');
$req_data["mt_list_idx"] = $mt_idx;
$req_data["ep_no"] = $episode_no;
$this->load->model('maptoon/m_maptoon');
$episode = $this->m_maptoon->get_episode_by_mt_idx_episode_no($req_data);
if ($episode == false || $episode == NULL || count($episode) == 0) {
header("Location: /web/maptoon");
return false;
}
$user_id = $this->session->userdata('C_Member_Id');
$req_data2 = array(
'user_id' => $user_id,
'ep_idx' => $episode['idx']
);
// 좋아요 & 별점 참여 유무 확인
if ($user_id != '' || isset($user_id)) {
$is_data = $this->m_maptoon->ep_is_like_grade($req_data2);
}
if (isset($is_data)) {
$return_data['is_like'] = $is_data['is_like'];
$return_data['is_grade'] = $is_data['is_grade'];
} else {
$return_data['is_like'] = 0;
$return_data['is_grade'] = 0;
}
// 페이징 데이터 가져오기
$req_data["ep_idx"] = $episode['idx'];
$te_req_data['idx'] = $mt_idx;
$list = $this->m_maptoon->get_display_episodes($te_req_data);
$return_data['total_ep_count'] = $this->m_maptoon->get_totalcount_episodes($mt_idx);
// 맵툰 정보 공유 하기 위해
$mt_req_data['idx'] = $mt_idx;
// 조회수 업데이트
$this->m_maptoon->ep_hit_count($req_data2);
// 누적인기 웹툰
$mt_pop_rank = $this->m_maptoon->get_mt_pop_rank();
$mt_data = $this->m_maptoon->get_maptoon_list($mt_req_data);
$return_data["menu_article"] = 1;
$return_data["data"] = $episode;
$return_data["mt_data"] = $mt_data;
$return_data['mt_pop_rank'] = $mt_pop_rank;
$return_data['list'] = $list;
return $this->load->view('/web/maptoon/maptoon_comments', $return_data, true);
}
}

View File

@@ -0,0 +1 @@
[["https://cdnimg.melon.co.kr/cm/album/images/102/39/610/10239610_500.jpg/melon/resize/120/quality/80/optimize", "\ub208\ubb3c\uc758 \ud638\ub9ac\ubcd1", "\uc815\uba85\ud76c"], ["https://cdnimg.melon.co.kr/cm/album/images/102/39/569/10239569_500.jpg/melon/resize/120/quality/80/optimize", "\ub0b4 \uae30\ub3c4\ud558\ub294 \uadf8 \uc2dc\uac04", "\uc870\uc5d8 \ub9ac (Joel Lee)"], ["https://cdnimg.melon.co.kr/cm/album/images/102/39/562/10239562_500.jpg/melon/resize/120/quality/80/optimize", "\ub0b4\uac8c \uc788\ub294 \ud5a5\uc720 \uc625\ud569 (I Surrender All)", "\uc88c\uc131\uc544(Sungah Chua)"], ["https://cdnimg.melon.co.kr/cm/album/images/102/39/513/10239513_500.jpg/melon/resize/120/quality/80/optimize", "\ud558\ub098\ub2d8\uc758 \uc601\uc73c\ub85c", "\ubcc0\uc815\ubbf8"], ["https://cdnimg.melon.co.kr/cm/album/images/102/39/345/10239345_500.jpg/melon/resize/120/quality/80/optimize", "\uc8fc\ub2d8\uc758 \ub9d0\uc500\uc740", "\uae40\ud55c\ub098"], ["https://cdnimg.melon.co.kr/cm/album/images/102/39/340/10239340_500.jpg/melon/resize/120/quality/80/optimize", "\uadc0\ud55c \uc8fc\ub2d8\uc758 \uc0ac\ub791", "\uc2a4\ud504\ub77c\uae30\uc2a4"], ["https://cdnimg.melon.co.kr/cm/album/images/102/39/262/10239262_500.jpg/melon/resize/120/quality/80/optimize", "\ub098\uc758 \uac08 \uae38 \ub2e4 \uac00\ub3c4\ub85d (Arr.\ubc15\uc0ac\ubb34\uc5d8) (384\uc7a5)", "\ud544\ub370\uc774\ube0c\uc2a4\ud29c\ub514\uc624"], ["https://cdnimg.melon.co.kr/cm/album/images/102/39/243/10239243_500.jpg/melon/resize/120/quality/80/optimize", "Vanity", "\uc0ac\uc6b4\ub529\ub77c\uc774\uce20"], ["https://cdnimg.melon.co.kr/cm/album/images/102/39/187/10239187_500.jpg/melon/resize/120/quality/80/optimize", "\uba3c\ud6d7\ub0a0\uc5d0", ""], ["https://cdnimg.melon.co.kr/cm/album/images/102/39/182/10239182_500.jpg/melon/resize/120/quality/80/optimize", "\uc6b0\ub9ac \ubcf4\uc88c \uc55e\uc5d0 \ubaa8\uc600\ub124 (Vision)", "\uc88c\uc131\uc544(Sungah Chua)"]]

View File

@@ -0,0 +1,850 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class member extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 아이디중복체크
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function fn_ajax_member_id_check_proc() {
# request
$member_id = trim($this->input->get_post('member_id', TRUE));
# model
$this->load->model('web/m_member');
$member_count = $this->m_member->member_where_member_id_count($member_id);
if($member_count == 0) {
$return_data['result'] = array('result_code' => '0000');
} else {
$return_data['result'] = array('result_code' => '9999');
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 일반회원 로그인
# CREATE : 2018-04-05
#---------------------------------------------------------------------------
function fn_ajax_login_proc(){
$this->load->helper('cookie');
# Request
$member_id = trim($this->input->get_post('member_id', TRUE)); // 아이디
$member_pwd = trim($this->input->get_post('member_pwd', TRUE)); // 비밀번호
$_url = urldecode(trim($this->input->get_post('url', TRUE))); // return url
$save_login = trim($this->input->get_post('save_login', TRUE)); //로그인 상태 유지
# valid Check
if (empty($member_id) == true) throw new Cm_Exception('json', '9999', '회원아이디와 비밀번호를 확인해주세요.');
if (empty($member_pwd) == true) throw new Cm_Exception('json', '9999', '회원아이디와 비밀번호를 확인해주세요.');
# 로그인
$req_data = array();
$req_data['member_id'] = $member_id;
$req_data['member_pwd'] = $member_pwd;
# model
$this->load->model('web/m_member');
$result = $this->m_member->member_join_member_group_where_member_id_member_pwd_select($req_data);
if(count($result) == 0) {
throw new Cm_Exception('json', '9999', '회원아이디와 비밀번호를 확인해주세요.');
}
# 비밀번호 변경확인
$now_date = date("Y-m-d");
$last_pwd_change_date = date("Y-m-d", strtotime($result['last_pwd_change_date'].' + 3month'));
if($now_date >= $last_pwd_change_date) {
$this->session->set_userdata('C_Member_Password_Change', 'Y');
}
$result['save_login'] = $save_login;
$this->load->library('comm');
$msg = $this->comm->fn_login_proc($result);
$return_data = array();
$return_data['result'] = array('code' => '0000', 'msg'=>$msg, 'url'=>$_url);
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 로그아웃
# CREATE : 2018-04-10
#---------------------------------------------------------------------------
function fn_logout_proc(){
$this->load->helper('url');
$this->load->library('comm');
$this->comm->fn_logout_proc();
# 메인으로 이동
redirect($_SERVER['HTTP_REFERER']);
}
#---------------------------------------------------------------------------
# PURPOSE : 비밀번호 확인
# CREATE : 2018-04-11
#---------------------------------------------------------------------------
function fn_ajax_password_check_proc(){
# Request
$member_id = trim($this->input->get_post('member_id', TRUE)); // 아이디
$member_pwd = trim($this->input->get_post('member_pwd', TRUE)); // 비밀번호
# 로그인
$req_data = array();
$req_data['member_id'] = $member_id;
$req_data['member_pwd'] = $member_pwd;
# model
$this->load->model('web/m_member');
$result = $this->m_member->member_join_member_group_where_member_id_member_pwd_select($req_data);
if(count($result) == 0) {
throw new Cm_Exception('json', '9999', '비밀번호를 확인해주세요.');
}
$this->load->helper('cookie');
set_cookie('crossmap_passwd_check', 'Y', 0);
$return_data = array();
$return_data['result'] = array('code' => '0000');
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 회원가입
# CREATE : 2018-04-24
#---------------------------------------------------------------------------
function fn_member_join_proc() {
# Request
$social_id = trim($this->input->get_post('social_id', TRUE));
$sns_profile_img = trim($this->input->get_post('sns_profile_img', TRUE));
$is_mobile_auth = trim($this->input->get_post('is_mobile_auth', TRUE));
$member_gender = trim($this->input->get_post('member_gender', TRUE));
$parent_gender = trim($this->input->get_post('parent_gender', TRUE));
$is_parent_auth = trim($this->input->get_post('is_parent_auth', TRUE));
$is_under14 = trim($this->input->get_post('is_under14', TRUE));
$agree1 = trim($this->input->get_post('agree1', TRUE));
$agree2 = trim($this->input->get_post('agree2', TRUE));
$agree3 = trim($this->input->get_post('agree3', TRUE));
$member_id = trim($this->input->get_post('member_id', TRUE));
$member_pwd = trim($this->input->get_post('member_pwd', TRUE));
$member_name = trim($this->input->get_post('member_name', TRUE));
$birth_year = trim($this->input->get_post('birth_year', TRUE));
$birth_month = trim($this->input->get_post('birth_month', TRUE));
$birth_day = trim($this->input->get_post('birth_day', TRUE));
$member_calendar = trim($this->input->get_post('member_calendar', TRUE));
$parent_name = trim($this->input->get_post('parent_name', TRUE));
$parent_mobile_company = trim($this->input->get_post('parent_mobile_company', TRUE));
$parent_mobile = trim($this->input->get_post('parent_mobile', TRUE));
$under14_member_email = trim($this->input->get_post('under14_member_email', TRUE));
$email1 = trim($this->input->get_post('email1', TRUE));
$email2 = trim($this->input->get_post('email2', TRUE));
$country_phone_no = trim($this->input->get_post('country_phone_no', TRUE));
$mobile1 = trim($this->input->get_post('mobile1', TRUE));
$mobile2 = trim($this->input->get_post('mobile2', TRUE));
$mobile3 = trim($this->input->get_post('mobile3', TRUE));
$member_church = trim($this->input->get_post('member_church', TRUE));
$etc1 = trim($this->input->get_post('etc1', TRUE));
$etc2 = trim($this->input->get_post('etc2', TRUE));
$etc3 = trim($this->input->get_post('etc3', TRUE));
$etc4 = trim($this->input->get_post('etc4', TRUE));
$etc5 = trim($this->input->get_post('etc5', TRUE));
$mobile_CI = trim($this->input->get_post('mobile_CI', TRUE));
$under14_member_name = trim($this->input->get_post('under14_member_name', TRUE));
$nickname = trim($this->input->get_post('nickname', TRUE));
# helper
$this->load->helper('url');
$this->load->helper('cookie');
# valid check
$this->load->library('form_validation');
$this->form_validation->set_rules('agree1', '', 'required|in_list[Y]');
$this->form_validation->set_rules('agree2', '', 'required|in_list[Y]');
$this->form_validation->set_rules('agree3', '', 'required|in_list[Y]');
$this->form_validation->set_rules('member_gender', '', 'required');
if($social_id == '') {
$this->form_validation->set_rules('member_id', '', 'required');
$this->form_validation->set_rules('member_pwd', '', 'required');
}
$this->form_validation->set_rules('member_name', '', 'required');
$this->form_validation->set_rules('nickname', '', 'required');
$this->form_validation->set_rules('birth_year', '', 'required');
$this->form_validation->set_rules('birth_month', '', 'required');
$this->form_validation->set_rules('birth_day', '', 'required');
$this->form_validation->set_rules('member_calendar', '', 'required');
$this->form_validation->set_rules('is_mobile_auth', '', 'required|in_list[Y]');
$this->form_validation->set_rules('mobile_CI', '', 'required');
if($this->form_validation->run() == false){
gf_alert("잘못된 접근입니다.1", '/');
exit;
}
$parent_CI = '';$parent_real_name = '';
if($is_under14=='Y') { // 14세 미만
$this->form_validation->set_rules('parent_name', '', 'required');
$this->form_validation->set_rules('parent_mobile_company', '', 'required');
$this->form_validation->set_rules('parent_mobile', '', 'required');
if($this->form_validation->run() == false){
gf_alert("잘못된 접근입니다.2", '/');
exit;
}
$member_email = $under14_member_email;
$member_mobile = '';
$parent_real_name = $member_name;
$member_name = $under14_member_name;
$parent_CI = $mobile_CI;
$mobile_CI = '';
$is_parent_auth = $is_mobile_auth;
$is_mobile_auth = 'N';
} else {
$this->form_validation->set_rules('email1', '', 'required');
$this->form_validation->set_rules('email2', '', 'required');
$this->form_validation->set_rules('country_phone_no', '', 'required');
$this->form_validation->set_rules('mobile1', '', 'required');
$this->form_validation->set_rules('mobile2', '', 'required');
if($this->form_validation->run() == false){
gf_alert("잘못된 접근입니다.3", '/');
exit;
}
$member_email = $email1.'@'.$email2;
$member_mobile = $mobile1.'-'.$mobile2.'-'.$mobile3;
}
$now_date = date("Y-m-d H:i:s");
$filename = '';
$social_type = '';
$token = '';
$token_secret = '';
$refresh_token = '';
$token_expires_date = $now_date;
$member_group_idx = 1;
if($social_id!='') { // sns 가입
# model
$this->load->model('web/m_tmp_social_member');
$arr_social = $this->m_tmp_social_member->tmp_social_member_select($social_id);
$social_type = $arr_social['social_type'];
$token = $arr_social['token'];
$token_secret = $arr_social['token_secret'];
$refresh_token = $arr_social['refresh_token'];
$token_expires_date = $arr_social['token_expires_date'];
$member_group_idx = 2;
$member_id_prefix = '';
switch ($social_type) {
case '1': $member_id_prefix = 'FB_'; break;
case '2': $member_id_prefix = 'TW_'; break;
case '3': $member_id_prefix = 'KK_'; break;
case '4': $member_id_prefix = 'NB_'; break;
}
$member_id = $member_id_prefix.$social_id;
$member_pwd = time();
$upload_path = './files/profile/' . date("Y") . "/" . date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
if($sns_profile_img!='') {
$arr_img_type = explode('.', $sns_profile_img);
$last_key = count($arr_img_type)-1;
$img_type = '';
if(isset($arr_img_type[$last_key])==true) {
$img_type = $arr_img_type[$last_key];
}
$img_name = $social_id.time().".".$img_type;
copy($sns_profile_img, $upload_path.'/'.$img_name);
$filename = '/files/profile/' . date("Y") . "/" . date("m").'/'.$img_name;
}
}
# model - 아이디 중복체크
$this->load->model('web/m_member');
$member_count = $this->m_member->member_where_member_id_count($member_id);
if($member_count > 0) {
gf_alert("잘못된 접근입니다.4", '/');
exit;
}
# 이미지업로드
if($_FILES['member_img']['name']!='') {
# image upload
$upload_path = './files/profile/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('member_img')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", '/');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
}
$member_birth = $birth_year.'-'.$birth_month.'-'.$birth_day;
$now_year = date("Y");
$member_age = floor((($now_year+1)-$birth_year)/10)*10;
# update data
$req_data = array();
$req_data['member_img'] = $filename;
$req_data['member_id'] = $member_id;
$req_data['member_name'] = $member_name;
$req_data['member_group_idx'] = $member_group_idx;
$req_data['member_pwd'] = MD5($member_pwd);
$req_data['member_email'] = $member_email;
$req_data['member_birth'] = $member_birth;
$req_data['member_calendar'] = $member_calendar;
$req_data['member_age'] = $member_age;
$req_data['member_gender'] = $member_gender;
$req_data['country_phone_no'] = $country_phone_no;
$req_data['member_mobile'] = $member_mobile;
$req_data['is_member_auth'] = $is_mobile_auth;
$req_data['member_church'] = $member_church;
$req_data['etc1'] = $etc1;
$req_data['etc2'] = $etc2;
$req_data['etc3'] = $etc3;
$req_data['etc4'] = $etc4;
$req_data['etc5'] = $etc5;
$req_data['member_church'] = $member_church;
$req_data['last_login_date'] = $now_date;
$req_data['last_pwd_change_date'] = $now_date;
$req_data['visit_count'] = 1;
$req_data['sns_type'] = $social_type;
$req_data['sns_id'] = $social_id;
$req_data['sns_token'] = $token;
$req_data['sns_token_secret'] = $token_secret;
$req_data['sns_refresh_token'] = $refresh_token;
$req_data['sns_token_expires_date'] = $token_expires_date;
$req_data['is_under14'] = $is_under14;
$req_data['parent_name'] = $parent_name;
$req_data['parent_mobile_company'] = $parent_mobile_company;
$req_data['parent_mobile'] = $parent_mobile;
$req_data['parent_real_name'] = $parent_real_name;
$req_data['parent_CI'] = $parent_CI;
$req_data['is_parent_auth'] = $is_parent_auth;
$req_data['member_status'] = 1;
$req_data['reg_date'] = $now_date;
$req_data['reg_id'] = $member_id;
$req_data['update_date'] = $now_date;
$req_data['update_id'] = $member_id;
$req_data['mobile_CI'] = $mobile_CI;
$req_data['member_nickname'] = $nickname;
# model
$this->load->model('web/m_member');
$member_idx = $this->m_member->member_insert($req_data);
if($member_idx==0 || $member_idx=='') {
gf_alert("회원가입에 실패했습니다.", 'back');
exit;
}
// 이메일발송
$content ='크리스천들의 놀이터! <p></p>';
$content.=$member_name.'님의 크로스맵 회원가입을 진심으로 축하합니다! <p></p>';
$content.='크리스천 놀이터 크로스맵에 자주 놀러 오실 거죠? <p></p><p>&nbsp;</p>';
$content.='아이디: '.$member_id.'<p></p>';
$content.='이름/닉네임: '.$member_name.'<p></p>';
$content.='가입일시: '.date("Y").'년 '.date("m").'월 '.date("d").'일 '.date("H").'시 '.date("i").'분 '.date("s").'초<p></p><p>&nbsp;</p>';
$content.='닉네임 등 프로필 정보는 &#39;내 정보관리&#39; 에서 수정할 수 있어요:) <p></p>';
$content.='<a href="'.$_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].'" target="_blank">-> 크로스맵에 놀러 가기!</a> <p></p><p>&nbsp;</p>';
$content.='P.S) 하나님의 은혜와 평강이 '.$member_name.'님의 삶 가운데 늘 가득하기를 <p></p>';
$content.='크로스맵이 응원하고 기도합니다! <p></p><p>&nbsp;</p>';
$content.=' - 크로스맵 일동 올림 - <p></p>';
$mail_result['content'] = $content;
$message = $this->load->view('/web/comm/mail_template', $mail_result, TRUE);
$this->load->library('email');
$config = array();
$config['wordwrap'] = true;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from(CROSSMAP_EMAIL, CROSSMAP_EMAIL_NAME);
$this->email->to($member_email);
$this->email->subject('크로스맵 회원가입을 진심으로 축하합니다!');
$this->email->message($message);
$this->email->send();
$req_data['idx'] = $member_idx;
$req_data['member_nickname'] = $nickname;
$req_data['member_intro'] = '';
$this->load->library('comm');
$this->comm->fn_login_proc($req_data);
$this->session->set_userdata('C_Member_First', 'Y');
# 메인으로 이동
redirect(WWW_CROSSMAP);
}
#---------------------------------------------------------------------------
# PURPOSE : 이메일 중복체크
# CREATE : 2018-04-24
#---------------------------------------------------------------------------
function fn_ajax_member_email_check_proc() {
# request
$member_email = trim($this->input->get_post('email', TRUE));
# model
$this->load->model('web/m_member');
$member_count = $this->m_member->member_where_email_count($member_email);
if($member_count == 0) {
$return_data['result'] = array('result_code' => '0000');
} else {
$return_data['result'] = array('result_code' => '9999');
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 비밀번호 변경
# CREATE : 2018-04-24
#---------------------------------------------------------------------------
function fn_ajax_password_change_proc() {
# request
$now_pwd = trim($this->input->get_post('now_pwd', TRUE));
$new_member_pwd = trim($this->input->get_post('new_member_pwd', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
# 현재 비밀번호 체크
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_pwd'] = $now_pwd;
# model
$this->load->model('web/m_member');
$result = $this->m_member->member_join_member_group_where_member_id_member_pwd_select($req_data);
if(count($result) == 0) {
throw new Cm_Exception('json', '9999', '현재 비밀번호를 확인해주세요.');
}
$now_date = date("Y-m-d");
$next_change_date = date("Y-m-d", strtotime($now_date.' + 3month'));
$now_date = str_replace("-", ".", $now_date);
$next_change_date = str_replace("-", ".", $next_change_date);
$member_email = $result['member_email'];
$member_name = $result['member_name'];
# 비밀번호 update
$req_data = array();
$req_data['idx'] = $result['idx'];
$req_data['member_pwd'] = md5($new_member_pwd);
$req_data['last_pwd_change_date'] = $now_date;
$req_data['update_id'] = $SES_MEMBER_ID;
$this->m_member->member_update($req_data);
$this->load->library('comm');
$this->comm->fn_logout_proc();
if($member_email!='') {
// 이메일발송
$content =$member_name.'님, '.date("Y").'년 '.date("m").'월 '.date("d").'일 '.date("H").'시 '.date("i").'분 '.date("s").'초에 계정 비밀번호 정보를 변경하였습니다.<p></p>';
$content.='혹시, 변경한 적이 없는 경우 1:1 고객센터로 문의해 주시면, 도움 드리도록 하겠습니다.<p></p>';
$content.='* 소중한 개인정보, 잊어버리지 않도록 유의해 주세요. <p></p><p>&nbsp;</p>';
$content.='P.S) 하나님의 은혜와 평강이 '.$member_name.'님의 삶 가운데 늘 가득하기를 <p></p>';
$content.='크로스맵이 응원하고 기도합니다! <p></p><p>&nbsp;</p>';
$content.=' - 크로스맵 일동 올림 - <p></p>';
$mail_result['content'] = $content;
$message = $this->load->view('/web/comm/mail_template', $mail_result, TRUE);
$this->load->library('email');
$config = array();
$config['wordwrap'] = true;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from(CROSSMAP_EMAIL, CROSSMAP_EMAIL_NAME);
$this->email->to($member_email);
$this->email->subject('개인 비밀번호 정보 변경 안내 메일입니다.');
$this->email->message($message);
$this->email->send();
$arr_email = explode("@", $member_email);
$email1 = mb_substr($arr_email[0], 0, 1).'**'.mb_substr($arr_email[0], 3, 1).'***';
$email2 = mb_substr($arr_email[1], 0, 1).'******';
$member_email = $email1.'@'.$email2;
}
$member_id = $result['member_id'];
$member_id = mb_substr($member_id, 0, 4).'****';
$data = array('now_date'=>$now_date, 'next_change_data'=>$next_change_date, 'member_id'=>$member_id, 'member_email'=> $member_email);
$return_data = array();
$return_data['result'] = array('code' => '0000', 'data'=>$data);
$this->session->set_userdata('C_Member_Login', 'Y');
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 닉네임 중복체크
# CREATE : 2018-04-25
#---------------------------------------------------------------------------
function fn_ajax_member_nickname_check_proc() {
# request
$member_nickname = trim($this->input->get_post('member_nickname', TRUE));
# model
$this->load->model('web/m_member');
$member_count = $this->m_member->member_where_member_nickname_count($member_nickname);
if($member_count == 0) {
$return_data['result'] = array('result_code' => '0000');
} else {
$return_data['result'] = array('result_code' => '9999');
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 내 이메일 체크
# CREATE : 2018-04-25
#---------------------------------------------------------------------------
function fn_ajax_member_my_email_check_proc() {
# request
$member_email = trim($this->input->get_post('email', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
# model
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_email'] = $member_email;
$this->load->model('web/m_member');
$member_count = $this->m_member->member_where_member_id_email_count($req_data);
if($member_count > 0) {
$return_data['result'] = array('result_code' => '0000');
} else {
$return_data['result'] = array('result_code' => '9999');
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 이메일 변경
# CREATE : 2018-04-25
#---------------------------------------------------------------------------
function fn_ajax_member_email_edit_proc() {
# request
$member_email = trim($this->input->get_post('email', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_NAME = $this->session->userdata('C_Member_Name');
$this->load->model('web/m_member');
$result = $this->m_member->member_where_member_id_select($SES_MEMBER_ID);
if(count($result)==0) {
throw new Cm_Exception('json', '9999', '잘못된 접근입니다.');
}
$org_email = $result['member_email'];
# 이메일 update
$req_data = array();
$req_data['member_email'] = $member_email;
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['update_id'] = $SES_MEMBER_ID;
$result = $this->m_member->member_where_member_id_update($req_data);
$return_data = array();
if($result) {
$content =$SES_MEMBER_NAME.'님, '.date("Y").'년 '.date("m").'월 '.date("d").'일 '.date("H").'시 '.date("i").'분 '.date("s").'초에 이메일주소 정보를 변경하셨습니다. <p></p>';
$content.='변경된 주소는 '.$member_email.' 입니다. <p></p><p>&nbsp;</p>';
$content.='혹시, 변경한 적이 없는 경우 1:1 고객센터로 문의 해 주시면, 도움 드리도록 하겠습니다.<p></p>';
$content.='* 소중한 개인정보, 잊어버리지 않도록 유의해 주세요.<p></p><p>&nbsp;</p>';
$content.='P.S) 하나님의 은혜와 평강이 '.$SES_MEMBER_NAME.'님의 삶 가운데 늘 가득하기를 <p></p>';
$content.='크로스맵이 응원하고 기도합니다! <p></p><p>&nbsp;</p>';
$content.=' - 크로스맵 일동 올림 - <p></p>';
$mail_result['content'] = $content;
$message = $this->load->view('/web/comm/mail_template', $mail_result, TRUE);
$this->load->library('email');
$config = array();
$config['wordwrap'] = true;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from(CROSSMAP_EMAIL, CROSSMAP_EMAIL_NAME);
$this->email->to($org_email, $member_email);
$this->email->subject('개인 이메일 정보 변경 안내 메일입니다.');
$this->email->message($message);
$this->email->send();
if($member_email!='') {
$this->session->set_userdata('C_Member_Email', $member_email);
$arr_email = explode("@", $member_email);
$email1 = mb_substr($arr_email[0], 0, 2).'******';
$arr_email2 = explode(".", $arr_email[1]);
$email2 = mb_substr($arr_email[1], 0, 1).'*******'.str_replace($arr_email2[0], '', $arr_email[1]);
$member_email = $email1.'@'.$email2;
}
$return_data['result'] = array('code' => '0000', 'data'=>$member_email);
} else {
$return_data['result'] = array('code' => '9999');
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 비밀번호 확인
# CREATE : 2018-04-25
#---------------------------------------------------------------------------
function fn_ajax_member_pwd_check_proc(){
# Request
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$member_pwd = trim($this->input->get_post('member_pwd', TRUE)); // 비밀번호
# 로그인
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_pwd'] = MD5($member_pwd);
# model
$this->load->model('web/m_member');
$count = $this->m_member->member_where_member_id_member_pwd_count($req_data);
if($count == 0) {
throw new Cm_Exception('json', '9999', '비밀번호를 확인해주세요.');
}
$return_data = array();
$return_data['result'] = array('code' => '0000');
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 회원탈퇴
# CREATE : 2018-04-25
#---------------------------------------------------------------------------
function fn_ajax_member_leave_proc(){
# Request
$member_pwd = trim($this->input->get_post('member_pwd', TRUE)); // 비밀번호
$SES_MEMBER_EMAIL = $this->session->userdata('C_Member_Email');
$SES_MEMBER_NAME = $this->session->userdata('C_Member_Name');
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
# 로그인
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_pwd'] = MD5($member_pwd);
# model
$this->load->model('web/m_member');
$result = $this->m_member->member_where_member_id_member_pwd_select($req_data);
if(count($result) == 0) {
throw new Cm_Exception('json', '9999', '잘못된 접근입니다.');
}
# 상태 update
$req_data = array();
$req_data['idx'] = $result['idx'];
$req_data['member_status'] = '2';
$req_data['update_id'] = $SES_MEMBER_ID;
$this->m_member->member_update($req_data);
$content =$SES_MEMBER_NAME.'님의 계정 탈퇴가 완료 되었습니다. <p></p>';
$content.='크로스맵이 마음에 들지 않으셨나요? <p></p>';
$content.='더 나은 서비스를 위해 최선을 다해 노력하겠습니다.__)<p></p>';
$content.='개인정보 및 이용기록은 영구삭제 되며<p></p>';
$content.='동일한 아이디로 재가입 하실 수 없습니다. <p></p>';
$content.='좋아요, 댓글 등의 사용 기록은 삭제되지 않으니 양지 부탁 드리겠습니다. <p></p><p>&nbsp;</p>';
$content.='P.S) 하나님의 은혜와 평강이 '.$SES_MEMBER_NAME.'님의 삶 가운데 늘 가득하기를 <p></p>';
$content.='크로스맵이 응원하고 기도합니다! <p></p><p>&nbsp;</p>';
$content.=' - 크로스맵 일동 올림 - <p></p>';
$mail_result['content'] = $content;
$message = $this->load->view('/web/comm/mail_template', $mail_result, TRUE);
$this->load->library('email');
$config = array();
$config['wordwrap'] = true;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from(CROSSMAP_EMAIL, CROSSMAP_EMAIL_NAME);
$this->email->to($SES_MEMBER_EMAIL);
$this->email->subject($SES_MEMBER_NAME.'님의 크로스맵 회원탈퇴가 완료 되었습니다.');
$this->email->message($message);
$this->email->send();
$this->load->library('comm');
$this->comm->fn_logout_proc();
$return_data = array();
$return_data['result'] = array('code' => '0000');
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 휴대폰 번호 변경
# CREATE : 2018-06-04
#---------------------------------------------------------------------------
function fn_ajax_member_mobile_change_proc(){
# Request
$mobile = trim($this->input->get_post('mobile', TRUE)); // 비밀번호
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$member_mobile = mb_substr($mobile, 0, 3).'-'.mb_substr($mobile, 3, 4).'-'.mb_substr($mobile, 7, 4);
# 휴대폰 번호 update
$req_data = array();
$req_data['member_mobile'] = $member_mobile;
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['update_id'] = $SES_MEMBER_ID;
$this->load->model('web/m_member');
$this->m_member->member_where_member_id_update($req_data);
$member_mobile = mb_substr($member_mobile, 1, 4).'***-***'.mb_substr($member_mobile, 12, 1);
$return_data = array();
$return_data['result'] = array('code' => '0000', 'data'=>$member_mobile);
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
}
?>

View File

@@ -0,0 +1,680 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class mypage extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 회원수정
# CREATE : 2018-04-11
#---------------------------------------------------------------------------
function fn_member_edit() {
$this->load->helper('cookie');
$crossmap_passwd_check = get_cookie('crossmap_passwd_check');
if($crossmap_passwd_check != 'Y') {
gf_alert("잘못된 접근입니다.", '/');
exit;
}
set_cookie('crossmap_passwd_check', 'N', 0);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", '/');
exit;
}
# model - list
$this->load->model('web/m_member');
$result = $this->m_member->member_where_member_id_select($SES_MEMBER_ID);
if(count($result) == 0){
gf_alert("잘못된 접근입니다.", '/');
exit;
}
# view data
$return_data = array();
$return_data['result'] = $result;
# view
return $this->load->view('/web/mypage/member_edit', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 북마크
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function fn_bookmark() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$limit = 10;
$offset = 0;
$search_keyword_txt = addslashes($search_keyword);
# 북마크
$req_data = array();
$req_data['search_type'] = 'total';
$req_data['search_keyword'] = $search_keyword_txt;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['member_id'] = $SES_MEMBER_ID;
# model - list
$this->load->model('web/m_bookmark');
$result = $this->m_bookmark->bookmark_join_vw_content_list($req_data);
$total_count = $this->m_bookmark->bookmark_join_vw_content_list_total_count($req_data);
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['search_keyword'] = $search_keyword;
# view
return $this->load->view('/web/mypage/bookmark', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 이미지 더가져오기
# CREATE : 2018-05-05
#---------------------------------------------------------------------------
function fn_ajax_bookmark_list_more() {
# request
$page = trim($this->input->get_post('page', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($SES_MEMBER_ID == '') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
# 북마크
$req_data = array();
$req_data['search_type'] = 'total';
$req_data['search_keyword'] = $search_keyword;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['member_id'] = $SES_MEMBER_ID;
# model - list
$this->load->model('web/m_bookmark');
$list = $this->m_bookmark->bookmark_join_vw_content_list($req_data);
$total_count = $this->m_bookmark->bookmark_join_vw_content_list_total_count($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
# view data
$return_data = array();
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
# view
return $this->load->view('/web/mypage/bookmark_list_more', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function fn_qna() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", '/');
exit;
}
# default setting
if($page=='') $page = '1';
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
# 1:1문의
$req_data = array();
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = $search_keyword;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['member_id'] = $SES_MEMBER_ID;
# model - list
$this->load->model('web/m_bbs_question');
$result = $this->m_bbs_question->bbs_question_where_member_id_list($req_data);
$total_count = $this->m_bbs_question->bbs_question_where_member_id_list_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/mypage/qna?search_type='.$search_type.'&search_keyword='.$search_keyword.'&page=');
$data_num = ($total_count + $limit)-($page*$limit);
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['data_num'] = $data_num;
$return_data['pagination'] = $pagination;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
# view
return $this->load->view('/web/mypage/qna', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 - 글쓰기
# CREATE : 2018-05-05
#---------------------------------------------------------------------------
function fn_qna_add() {
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", '/');
exit;
}
# view
return $this->load->view('/web/mypage/qna_add', '', true);
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 - 글쓰기저장
# CREATE : 2018-05-05
#---------------------------------------------------------------------------
function fn_qna_add_proc() {
# Request
$title = trim($this->input->get_post('title', TRUE));
$content = trim($this->input->get_post('content', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_NICNAME = $this->session->userdata('C_Member_Nicname');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", '/');
exit;
}
# model
$this->load->model('web/m_bbs_question');
# max idx 가져오기
$result = $this->m_bbs_question->bbs_question_max_idx_select();
$max_idx = $result['max_idx']+1;
$now_date = date("Y-m-d H:i:s");
$req_data = array();
$req_data['title'] = $title;
$req_data['content'] = $content;
$req_data['idx'] = $max_idx;
$req_data['p_idx'] = $max_idx;
$req_data['s_idx'] = '1';
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['write_id'] = $SES_MEMBER_ID;
$req_data['write_name'] = $SES_MEMBER_NICNAME;
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = $SES_MEMBER_ID;
$req_data['update_date']= $now_date;
# insert
$this->m_bbs_question->bbs_question_insert($req_data);
gf_alert("등록되었습니다.", '/web/mypage/qna');
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 - 삭제
# CREATE : 2018-05-05
#---------------------------------------------------------------------------
function fn_qna_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($SES_MEMBER_ID == '') {
gf_alert("회원로그인 후에 가능합니다.", '/web/mypage/qna');
exit;
}
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", '/');
exit;
}
# model
$this->load->model('web/m_bbs_question');
$now_date = date("Y-m-d H:i:s");
foreach ($arr_idx as $key=>$val) {
$req_data = array();
$req_data['idx'] = $val;
$req_data['write_id'] = $SES_MEMBER_ID;
$count = $this->m_bbs_question->bbs_question_write_id_idx_count($req_data);
if($count > 0) {
$arr_update_data1 = array();
$arr_update_data1[$key]['idx'] = $val;
$arr_update_data1[$key]['is_del'] = 'Y';
$arr_update_data1[$key]['update_id'] = $SES_MEMBER_ID;
$arr_update_data1[$key]['update_date'] = $now_date;
$this->m_bbs_question->bbs_question_is_del_update_batch($arr_update_data1);
$arr_update_data2 = array();
$arr_update_data2[$key]['p_idx'] = $val;
$arr_update_data2[$key]['is_del'] = 'Y';
$arr_update_data2[$key]['update_id'] = $SES_MEMBER_ID;
$arr_update_data2[$key]['update_date'] = $now_date;
$this->m_bbs_question->bbs_question_p_idx_is_del_update_batch($arr_update_data2);
}
}
gf_alert("삭제되었습니다.", '/web/mypage/qna');
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 - 보기
# CREATE : 2018-05-05
#---------------------------------------------------------------------------
function fn_qna_view() {
# Request
$idx = $this->uri->segment(4);
$page = trim($this->input->get_post('page', TRUE));
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$data_num = trim($this->input->get_post('data_num', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", '/');
exit;
}
$req_data = array();
$req_data['idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
# model
$this->load->model('web/m_bbs_question');
$result = $this->m_bbs_question->bbs_question_member_id_idx_select($req_data);
if(count($result)==0) {
gf_alert("잘못된 접근입니다.", '/web/mypage/qna');
exit;
}
# next
$req_data = array();
$req_data['idx'] = $idx;
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = $search_keyword;
$req_data['offset'] = 0;
$req_data['limit'] = 4;
$req_data['member_id'] = $SES_MEMBER_ID;
$next_list = $this->m_bbs_question->bbs_question_next_parent_list($req_data);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['result'] = $result;
$return_data['next_list'] = $next_list;
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['data_num'] = $data_num;
# view
return $this->load->view('/web/mypage/qna_view', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 - 삭제
# CREATE : 2018-05-05
#---------------------------------------------------------------------------
function fn_qna_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($SES_MEMBER_ID == '') {
gf_alert("회원로그인 후에 가능합니다.", '/web/mypage/qna');
exit;
}
$SES_MEMBER_GROUP_IDX = $this->session->userdata('C_Member_Group');
$SES_MEMBER_GROUP_Name = $this->session->userdata('C_Member_Group_Name');
if($SES_MEMBER_GROUP_IDX == '') {
$SES_MEMBER_GROUP_IDX ='8';
$SES_MEMBER_GROUP_Name = '비회원';
}
# 해당회원이 사용가능한지 확인
$req_data = array();
$req_data['member_group_idx'] = $SES_MEMBER_GROUP_IDX;
$req_data['menu_code'] = '3';
# model
$this->load->model('web/m_member_group_menu_auth');
$count = $this->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
if($count > 0) {
gf_alert($SES_MEMBER_GROUP_Name."은 해당 메뉴를 사용하실수 없습니다.", '/');
exit;
}
# model
$this->load->model('web/m_bbs_question');
$now_date = date("Y-m-d H:i:s");
$req_data = array();
$req_data['idx'] = $idx;
$req_data['write_id'] = $SES_MEMBER_ID;
$count = $this->m_bbs_question->bbs_question_write_id_idx_count($req_data);
if($count > 0) {
$arr_update_data1 = array();
$arr_update_data1[0]['idx'] = $idx;
$arr_update_data1[0]['is_del'] = 'Y';
$arr_update_data1[0]['update_id'] = $SES_MEMBER_ID;
$arr_update_data1[0]['update_date'] = $now_date;
$this->m_bbs_question->bbs_question_is_del_update_batch($arr_update_data1);
$arr_update_data2 = array();
$arr_update_data2[0]['p_idx'] = $idx;
$arr_update_data2[0]['is_del'] = 'Y';
$arr_update_data2[0]['update_id'] = $SES_MEMBER_ID;
$arr_update_data2[0]['update_date'] = $now_date;
$this->m_bbs_question->bbs_question_p_idx_is_del_update_batch($arr_update_data2);
}
gf_alert("삭제되었습니다.", '/web/mypage/qna');
}
#---------------------------------------------------------------------------
# PURPOSE : 회원수정
# CREATE : 2018-06-04
#---------------------------------------------------------------------------
function fn_member_edit_proc() {
# Request
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$org_profile_img = trim($this->input->get_post('org_profile_img', TRUE));
$member_nickname = trim($this->input->get_post('member_nickname', TRUE));
$member_intro = trim($this->input->get_post('member_intro', TRUE));
$is_nickname = trim($this->input->get_post('is_nickname', TRUE));
$is_agree_sms = trim($this->input->get_post('is_agree_sms', TRUE));
$is_agree_mail = trim($this->input->get_post('is_agree_mail', TRUE));
$is_agree_info_open = trim($this->input->get_post('is_agree_info_open', TRUE));
$member_edit_church = trim($this->input->get_post('member_edit_church', TRUE));
$member_edit_etc1 = trim($this->input->get_post('member_edit_etc1', TRUE));
$member_edit_etc2 = trim($this->input->get_post('member_edit_etc2', TRUE));
$member_edit_password = trim($this->input->get_post('member_edit_password', TRUE));
$member_edit_new_password = trim($this->input->get_post('member_edit_new_password', TRUE));
// 쿠키
$this->load->helper('cookie');
set_cookie('crossmap_passwd_check', 'Y', 0);
if($member_nickname!='' && $is_nickname=='N') {
gf_alert("닉네임 중복확인을 해주세요.", '/web/mypage/member_edit');
exit;
}
$member_nickname = addslashes($member_nickname);
$member_intro = addslashes($member_intro);
$member_edit_church = addslashes($member_edit_church);
$member_edit_password = addslashes($member_edit_password);
$member_edit_new_password = addslashes($member_edit_new_password);
$member_edit_etc1 = addslashes($member_edit_etc1);
$member_edit_etc2 = addslashes($member_edit_etc2);
# 이미지업로드
if($_FILES['member_img']['name']!='') {
# image upload
$upload_path = './files/profile/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('member_img')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", '/web/mypage/member_edit');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
$filename = $org_profile_img;
}
$now_date = date("Y-m-d H:i:s");
# update
$this->load->model('web/m_member');
$req_data = array();
if($member_edit_new_password!='') {
# 비밀번호 확인
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_pwd'] = MD5($member_edit_password);
$count = $this->m_member->member_where_member_id_member_pwd_count($req_data);
if($count==0) {
gf_alert("입력하신 현재 비밀번호가 맞지 않습니다.", '/web/mypage/member_edit');
exit;
}
$req_data['last_pwd_change_date'] = $now_date;
$req_data['member_pwd'] = MD5($member_edit_new_password);
}
$req_data['member_img'] = $filename;
$req_data['member_nickname'] = $member_nickname;
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_intro'] = $member_intro;
$req_data['member_church'] = $member_edit_church;
$req_data['etc1'] = $member_edit_etc1;
$req_data['etc2'] = $member_edit_etc2;
$req_data['is_agree_sms'] = $is_agree_sms;
$req_data['is_agree_mail'] = $is_agree_mail;
$req_data['is_agree_info_open'] = $is_agree_info_open;
$req_data['update_id'] = $SES_MEMBER_ID;
$req_data['update_date'] = $now_date;
$this->m_member->member_where_member_id_update($req_data);
if($member_edit_new_password!='') {
$result = $this->m_member->member_where_member_id_select($SES_MEMBER_ID);
$member_email = $result['member_email'];
$member_name = $result['member_name'];
if($member_email!='') {
// 이메일발송
$content =$member_name.'님, '.date("Y").'년 '.date("m").'월 '.date("d").'일 '.date("H").'시 '.date("i").'분 '.date("s").'초에 계정 비밀번호 정보를 변경하였습니다.<p></p>';
$content.='혹시, 변경한 적이 없는 경우 1:1 고객센터로 문의해 주시면, 도움 드리도록 하겠습니다.<p></p>';
$content.='* 소중한 개인정보, 잊어버리지 않도록 유의해 주세요. <p></p><p>&nbsp;</p>';
$content.='P.S) 하나님의 은혜와 평강이 '.$member_name.'님의 삶 가운데 늘 가득하기를 <p></p>';
$content.='크로스맵이 응원하고 기도합니다! <p></p><p>&nbsp;</p>';
$content.=' - 크로스맵 일동 올림 - <p></p>';
$mail_result['content'] = $content;
$message = $this->load->view('/web/comm/mail_template', $mail_result, TRUE);
$this->load->library('email');
$config = array();
$config['wordwrap'] = true;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from(CROSSMAP_EMAIL, CROSSMAP_EMAIL_NAME);
$this->email->to($member_email);
$this->email->subject('개인 비밀번호 정보 변경 안내 메일입니다.');
$this->email->message($message);
$this->email->send();
}
}
$this->session->set_userdata('C_Member_Nicname', $member_nickname);
$this->session->set_userdata('C_Member_Intro', $member_intro);
$this->session->set_userdata('C_Member_Profile', $filename);
gf_alert("회원정보가 수정되었습니다.", '/web/mypage/member_edit');
}
}
?>

View File

@@ -0,0 +1,671 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class news extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 메인
# CREATE : 2018-04-11
#---------------------------------------------------------------------------
function fn_index() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
# default setting
if($search_sort == '') $search_sort = '1';
if($page=='') $page = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
# 뉴스
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_news');
$result = $this->m_news->news_list($req_data);
$total_count = $this->m_news->news_list_total_count($req_data);
# news setting
$this->load->model('web/m_contents_setting');
$arr_news_setting = $this->m_contents_setting->contents_setting_select(1);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/news/?search_sort='.$search_sort.'&page=');
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['search_sort'] = $search_sort;
$return_data['list'] = $result;
$return_data['arr_news_setting'] = $arr_news_setting;
$return_data['pagination'] = $pagination;
# view
return $this->load->view('/web/news/index', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 뷰
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function fn_news_view() {
# Request
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '1';
$bookmark_count = 0;
$arr_review = array();
if($SES_MEMBER_ID !='') {
# 게시물 열람 불가 체크
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['limit_type'] = '2';
# model
$this->load->model('web/m_blind_limit');
$arr_blind = $this->m_blind_limit->blind_limit_where_member_id_limit_type_select($req_data);
if(count($arr_blind) > 0) {
$return_data['arr_blind'] = $arr_blind;
$return_data['url'] = '/web/news/';
# view
return $this->load->view('/web/comm/blind_view_alert', $return_data, true);
}
# model - bookmark
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_bookmark');
$bookmark_count = $this->m_bookmark->bookmark_member_id_content_idx_count($req_data);
# model - review
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_review_log');
$arr_review = $this->m_review_log->review_log_where_member_id_content_idx_select($req_data);
}
# hit count update
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$this->load->library('comm');
$this->comm->fn_hit_count_update($req_data);
# model - news view
$this->load->model('web/m_news');
$result = $this->m_news->news_join_news_section_press_select($idx);
# 연관글
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_relation_article');
$arr_relation_news = $this->m_relation_article->relation_article_join_news_list($req_data);
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_where_news_idx_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_relation_news'] = $arr_relation_news;
$return_data['arr_weather'] = $arr_weather;
$return_data['arr_review'] = $arr_review;
$return_data['bookmark_count'] = $bookmark_count;
$return_data['result'] = $result;
# view
return $this->load->view('/web/news/news_view', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 컬럼 메인
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_column() {
# 칼럼
$req_data = array();
$req_data['sort_column'] = 'reg_date';
$req_data['offset'] = 0;
$req_data['limit'] = 12;
# model - list
$this->load->model('web/m_column');
$result = $this->m_column->column_list($req_data);
$total_count = $this->m_column->column_total_count();
# 칼럼리스트
$req_data = array();
$req_data['member_group_idx'] = 7;
$req_data['sort_column'] = 'display_sort';
$this->load->model('web/m_partner');
$arr_columnist = $this->m_partner->partner_all_list($req_data);
# 테마
# 7: 헤드라인칼럼
$theme_types = array('7', '15');
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = $theme_types;
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
$arr_recomm_life = array();
$arr_headline_column = array();
foreach ($arr_theme as $val) {
if($val['theme_type'] == 7) $arr_headline_column[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'column_name'=> $val['column_name'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx'], 'partner_idx' => $val['partner_idx'], 'content' => $val['content']);
if($val['theme_type'] == 15) $arr_recomm_life[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
}
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['arr_columnist'] = $arr_columnist;
$return_data['arr_headline_column'] = $arr_headline_column;
$return_data['arr_recomm_life'] = $arr_recomm_life;
# view
return $this->load->view('/web/news/column', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : column list more
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_ajax_column_list_more() {
# request
$page = trim($this->input->get_post('page', TRUE));
# paging 설정 -- 2page 부터 시작이고 1페이지는 6개였음.
$limit = 10;
$offset = ($page-2) * $limit;
$offset = $offset + 6;
# 검색
$req_data = array();
$req_data['sort_column'] = 'reg_date';
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('web/m_column');
$arr_column = $this->m_column->column_list($req_data);
$total_count = $this->m_column->column_total_count();
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
# view data
$return_data = array();
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $arr_column;
$return_data['more_list'] = $more_list;
# view
return $this->load->view('/web/news/column_list_more', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 컬럼 뷰
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_column_view() {
# Request
$idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '2';
$bookmark_count = 0;
if($SES_MEMBER_ID !='') {
# 게시물 열람 불가 체크
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['limit_type'] = '2';
# model
$this->load->model('web/m_blind_limit');
$arr_blind = $this->m_blind_limit->blind_limit_where_member_id_limit_type_select($req_data);
if(count($arr_blind) > 0) {
$return_data['arr_blind'] = $arr_blind;
$return_data['url'] = '/web/news/column';
# view
return $this->load->view('/web/comm/blind_view_alert', $return_data, true);
}
# bookmark
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_bookmark');
$bookmark_count = $this->m_bookmark->bookmark_member_id_content_idx_count($req_data);
}
# hit count update
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$this->load->library('comm');
$this->comm->fn_hit_count_update($req_data);
# model - column view
$this->load->model('web/m_column');
$result = $this->m_column->column_select($idx);
# 연관글
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$this->load->model('web/m_relation_article');
$arr_relation_column = $this->m_relation_article->relation_article_join_column_list($req_data);
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_where_news_idx_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_relation_column'] = $arr_relation_column;
$return_data['arr_weather'] = $arr_weather;
$return_data['bookmark_count'] = $bookmark_count;
$return_data['result'] = $result;
# view
return $this->load->view('/web/news/column_view', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 프린트
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function fn_nonskin_news_print() {
# view
return $this->load->view('/web/news/news_print', '');
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 칼럼니스트 메인
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_columnist() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$partner_idx = $this->uri->segment(4);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$content_type = '2';
# default setting
if($search_sort == '') $search_sort = '1';
if($page=='') $page = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
$column_delivery_count = 0;
if($SES_MEMBER_ID != '') {
# 배달여부
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['main_idx'] = $partner_idx;
$req_data['member_id'] = $SES_MEMBER_ID;
$this->load->model('web/m_delivery');
$arr_column_delivery = $this->m_delivery->delivery_where_member_id_main_idx_select($req_data);
$column_delivery_count = count($arr_column_delivery);
}
# 칼럼정보
# model - list
$this->load->model('web/m_partner');
$arr_columnist = $this->m_partner->partner_select($partner_idx);
if(count($arr_columnist)==0) {
gf_alert("잘못된 접근입니다.", '/');
exit;
}
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
# 칼럼 리스트
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['search_type'] = 'partner_idx';
$req_data['search_key'] = $partner_idx;
# model - list
$this->load->model('web/m_column');
$result = $this->m_column->column_list($req_data);
$total_count = $this->m_column->column_list_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/news/columnist/'.$partner_idx.'?search_sort='.$search_sort.'&page=');
# view data
$return_data = array();
$return_data['list'] = $result;
$return_data['total_count'] = $total_count;
$return_data['search_sort'] = $search_sort;
$return_data['pagination'] = $pagination;
$return_data['arr_columnist'] = $arr_columnist;
$return_data['column_delivery_count'] = $column_delivery_count;
# view
return $this->load->view('/web/news/columnist', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 랭킹
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_ranking() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$ranking_type = trim($this->input->get_post('ranking_type', TRUE));
$content_type = 1;
# default setting
if($ranking_type == '') $ranking_type = '1';
if($page=='') $page = '1';
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['ranking_type'] = $ranking_type;
$req_data['content_type'] = $content_type;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$this->load->model('web/m_ranking');
$result = $this->m_ranking->ranking_join_news_list($req_data);
$total_count = $this->m_ranking->ranking_join_news_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/news/ranking?ranking_type='.$ranking_type.'&page=');
# news setting
$this->load->model('web/m_contents_setting');
$arr_news_setting = $this->m_contents_setting->contents_setting_select(1);
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['list'] = $result;
$return_data['pagination'] = $pagination;
$return_data['ranking_type'] = $ranking_type;
$return_data['arr_news_setting'] = $arr_news_setting;
# view
return $this->load->view('/web/news/ranking', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 카테고리
# CREATE : 2018-04-28
#---------------------------------------------------------------------------
function fn_category() {
# Request
$page = trim($this->input->get_post('page', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$category_code = $this->uri->segment(4);
$this->load->helper('url');
if($category_code=='') {
redirect(WWW_CROSSMAP.'/web/news/');
exit;
}
# default setting
if($search_sort == '') $search_sort = '1';
if($page=='') $page = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; break;
case '2': $sort_column = 'popular_count'; break;
default : $sort_column = 'display_date'; break;
}
# paging 설정
$limit = 10;
$offset = ($page-1) * $limit;
# 뉴스
$req_data = array();
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['search_type'] = 'category_code';
$req_data['search_keyword'] = $category_code;
# model - list
$this->load->model('web/m_news');
$result = $this->m_news->news_list($req_data);
$total_count = $this->m_news->news_list_total_count($req_data);
$category_count = strlen($category_code);
$category_code1 = substr($category_code, 0, 2);
$category_code2 = ''; $category_code3 = '';
if($category_count == 6) $category_code3 = substr($category_code, 0, 6);
if($category_count == 4 || $category_count == 6) $category_code2 = substr($category_code, 0, 4);
# 카테고리
$this->load->model('web/m_news_section');
$arr_category = $this->m_news_section->news_section_select($category_code);
$arr_category1 = $this->m_news_section->news_section_select($category_code1);
$arr_category2 = array();
if($category_code2 != '') $arr_category2 = $this->m_news_section->news_section_select($category_code2);
$arr_category3 = array();
if($category_code3 != '') $arr_category3 = $this->m_news_section->news_section_select($category_code3);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/news/category/'.$category_code.'?search_sort='.$search_sort.'&page=');
# view data
$return_data = array();
$return_data['total_count'] = $total_count;
$return_data['list'] = $result;
$return_data['pagination'] = $pagination;
$return_data['search_sort'] = $search_sort;
$return_data['category_code'] = $category_code;
$return_data['arr_category'] = $arr_category;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['arr_category3'] = $arr_category3;
# view
return $this->load->view('/web/news/category', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 댓글
# CREATE : 2018-04-29
#---------------------------------------------------------------------------
function fn_news_comment() {
# Request
$idx = $this->uri->segment(4);
# model - news view
$this->load->model('web/m_news');
$result = $this->m_news->news_join_news_section_press_select($idx);
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_where_news_idx_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_weather'] = $arr_weather;
$return_data['result'] = $result;
# view
return $this->load->view('/web/news/news_comment', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 칼럼 댓글
# CREATE : 2018-05-14
#---------------------------------------------------------------------------
function fn_column_comment() {
# Request
$idx = $this->uri->segment(4);
# model - column view
$this->load->model('web/m_column');
$result = $this->m_column->column_select($idx);
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_where_news_idx_select($idx);
# view data
$return_data = array();
$return_data['idx'] = $idx;
$return_data['arr_weather'] = $arr_weather;
$return_data['result'] = $result;
# view
return $this->load->view('/web/news/column_comment', $return_data, true);
}
}
?>

View File

@@ -0,0 +1,26 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
include_once(APPPATH.'core/web/cm_exceptions.php');
class Popup extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->library('user_agent');
$this->load->helper('crossmap/tool_helper');
$this->load->helper('crossmap/exception_helper');
}
public function index() {
$this->load->view('/web/popup');
}
public function find_id() {
$this->load->view('/web/find_id');
}
public function find_password() {
$this->load->view('/web/find_password');
}
}

View File

@@ -0,0 +1,80 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class prayer extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 메인
# CREATE : 2019-04-17
#---------------------------------------------------------------------------
function fn_index() {
$this->load->library('user_agent');
if ($this->agent->is_mobile()){
$this->load->helper('url');
redirect($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].'/m/prayer/', 'refresh');
}
// 말씀과 묵상
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 26;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '1';
$req_data['sort_column'] = 'a.reg_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 4;
$this->load->model('admin/life/m_life');
$this->load->model('web/m_channel');
// 열방을 위한 기도
$req_data['search_category_code2'] = '49';
$world = $this->m_channel->channel_join_category_select(49);
$world['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$world['data'] = $this->m_life->life_list($req_data);
//아침을 여는 기도
$req_data['search_category_code2'] = '18';
$moning = $this->m_channel->channel_join_category_select(18);
$moning['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$moning['data'] = $this->m_life->life_list($req_data);
// 순교자의 소리
$req_data['search_category_code2'] = '46';
$sound = $this->m_channel->channel_join_category_select(46);
$sound['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$sound['data'] = $this->m_life->life_list($req_data);
//Open door
$req_data['search_category_code2'] = '47';
$open_door = $this->m_channel->channel_join_category_select(47);
$open_door['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$open_door['data'] = $this->m_life->life_list($req_data);
//Corner stone
$req_data['search_category_code2'] = '50';
$corner_stone = $this->m_channel->channel_join_category_select(50);
$corner_stone['channel_article_count'] = $this->m_life->life_list_total_count($req_data);
$corner_stone['data'] = $this->m_life->life_list($req_data);
# view data
$return_data['channel'] = array();
$return_data['page_title'] = "기도공감";
array_push($return_data['channel'], $world, $moning, $sound, $open_door, $corner_stone);
// $return_data['arr_praise'] = ;
// $return_data['arr_testimony'] = ;
// $return_data['arr_talkshow'] = ;
# view
return $this->load->view('/web/cmtv/channel_recommend', $return_data, true);
}
}
?>

View File

@@ -0,0 +1,205 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
include_once(APPPATH.'core/web/cm_exceptions.php');
class Renew extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->library('user_agent');
$this->load->helper('crossmap/tool_helper');
$this->load->helper('crossmap/exception_helper');
}
public function index()
{
/*
from _remap
*/
$this->load->helper('cookie');
$session_id = get_cookie('crossmap_save_id');
# session
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($session_id != '' && $SES_MEMBER_ID=='') {
# model - session 가져오기
$this->load->model('web/m_ci_sessions');
$session_result = $this->m_ci_sessions->ci_sessions_select($session_id);
session_decode($session_result['data']);
}
if($SES_MEMBER_ID!='') {
$expire_date = date("Y-m-d H:i:s", strtotime("+10 minutes"));
# model - 중복로그인 체크용
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
$req_data['expire_date'] = $expire_date;
$this->load->model('web/m_member_login');
$this->m_member_login->member_login_member_id_member_ip_update($req_data);
}
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$controller = $this->uri->segment(2);
/*
from fn_index()
*/
$now_date = date("Y-m-d");
# 영적기상도
$this->load->model('web/m_weather');
$arr_weather = $this->m_weather->weather_join_relation_article_join_news_list();
# 오늘의 말씀
$this->load->model('web/m_today_word');
$arr_today_word = $this->m_today_word->today_word_where_display_date_select($now_date);
# 테마
# theme_type = 1 (헤드라인뉴스), theme_type = 8 (오늘의칼럼), theme_type = 11 (라이프홈), theme_type = 12 (데일리큐티)
$this->load->model('web/m_theme');
$req_data = array();
$req_data['theme_types'] = array('1', '11', '12');
$arr_theme = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
$arr_headline_news = array();
$arr_life_home = array();
$arr_daily_cutie = array();
foreach ($arr_theme as $val) {
if($val['theme_type'] == 1) $arr_headline_news[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 11) $arr_life_home[$val['rank']] = array('title' => $val['title'], 'sub_title'=> $val['sub_title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
if($val['theme_type'] == 12) $arr_daily_cutie[$val['rank']] = array('title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
}
// 오늘의 칼럼
$req_data['theme_types'] = array('8');
$arr_today_column = $this->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
# 카드뉴스 - 기타섹션 테마
$this->load->model('web/m_etc_section');
$etc_section_type = 4;
$arr_card_news = $this->m_etc_section->etc_section_where_theme_type_list($etc_section_type);
# 언론
$this->load->model('web/m_press');
$arr_press = $this->m_press->press_all_list();
# 카테고리별
$this->load->model('web/m_main_category_company');
$arr_company = $this->m_main_category_company->main_category_company_all_list();
$arr_content = array();
$content_idx = $this->uri->segment(4);
// 모아보기
// 말씀과 묵상
$req_data = array();
$req_data['search_type'] = '';
$req_data['search_keyword'] = '';
$req_data['search_life_type'] = '';
$req_data['search_category_code1'] = 6;
$req_data['search_category_code2'] = '';
$req_data['search_click1'] = '';
$req_data['search_click2'] = '';
$req_data['sort_column'] = 'a.reg_date';
$req_data['search_write_id'] = '';
$req_data['offset'] = 0;
$req_data['limit'] = 7;
$this->load->model('admin/life/m_life');
//찬양
$arr_praise = $this->m_life->life_list($req_data);
//말씀
$req_data['search_category_code1'] = 5;
$this->load->model('admin/life/m_life');
$arr_gospel = $this->m_life->life_list($req_data);
//지식인
$req_data['search_category_code1'] = 10;
$this->load->model('admin/life/m_life');
$arr_knowledge = $this->m_life->life_list($req_data);
// 2.크로스맵TV
// 2-1.말씀영상
$req_data['search_category_code1'] = 22;
$req_data['search_category_code2'] = 42;
$req_data['limit'] = 8;
$this->load->model('admin/life/m_life');
$arr_tv_gospel = $this->m_life->life_list($req_data);
// 2-2.찬양영상
$req_data['search_category_code2'] = 43;
$this->load->model('admin/life/m_life');
$arr_tv_praise = $this->m_life->life_list($req_data);
// 2-3.간증
$req_data['search_category_code2'] = 44;
$this->load->model('admin/life/m_life');
$arr_tv_testimony = $this->m_life->life_list($req_data);
// 2-4.토크쇼
$req_data['search_category_code2'] = 45;
$this->load->model('admin/life/m_life');
$arr_tv_talkshow = $this->m_life->life_list($req_data);
// 3.이런건 어때?
// 3-1.은혜
$req_data['search_category_code1'] = 18;
$req_data['search_category_code2'] = '';
$req_data['limit'] = 7;
$this->load->model('admin/life/m_life');
$arr_grace = $this->m_life->life_list($req_data);
// 3-2.사랑
$req_data['search_category_code1'] = 19;
$this->load->model('admin/life/m_life');
$arr_love = $this->m_life->life_list($req_data);
// 3-3.크리스마스
$req_data['search_category_code1'] = 20;
$this->load->model('admin/life/m_life');
$arr_christmas = $this->m_life->life_list($req_data);
// 3-4.마무리
$req_data['search_category_code1'] = 21;
$this->load->model('admin/life/m_life');
$arr_completion = $this->m_life->life_list($req_data);
$melon_json = file_get_contents('http://35.224.33.187/melon.json');
if($melon_json!='')
$melon_arr = json_decode($melon_json,true);
else
$melon_arr = array();
# view data
$return_data = array();
$return_data['site_info'] = $site_info;
$return_data['arr_weather'] = $arr_weather;
$return_data['arr_today_word'] = $arr_today_word;
$return_data['arr_headline_news'] = $arr_headline_news;
$return_data['arr_life_home'] = $arr_life_home;
$return_data['arr_daily_cutie'] = $arr_daily_cutie;
$return_data['arr_card_news'] = $arr_card_news;
$return_data['arr_press'] = $arr_press;
$return_data['arr_company'] = $arr_company;
$return_data['arr_praise'] = $arr_praise;
$return_data['arr_gospel'] = $arr_gospel;
$return_data['arr_knowledge'] = $arr_knowledge;
$return_data['arr_tv_gospel'] = $arr_tv_gospel;
$return_data['arr_tv_praise'] = $arr_tv_praise;
$return_data['arr_tv_testimony'] = $arr_tv_testimony;
$return_data['arr_tv_talkshow'] = $arr_tv_talkshow;
$return_data['arr_grace'] = $arr_grace;
$return_data['arr_love'] = $arr_love;
$return_data['arr_christmas'] = $arr_christmas;
$return_data['arr_completion'] = $arr_completion;
$return_data['arr_today_column'] = $arr_today_column;
$return_data['arr_melon_ccm'] = $melon_arr;
$this->load->library('user_agent');
if($this->agent->is_mobile()) {
$return_data['is_mobile'] = true;
} else {
$return_data['is_mobile'] = false;
}
$this->load->view('/web/index2', $return_data);
}
}

View File

@@ -0,0 +1,72 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class rules extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 서비스이용약관
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function fn_service() {
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$return_data = array();
$return_data['site_info'] = $site_info;
# view
return $this->load->view('/web/rules/service', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 개인정보 취급방침
# CREATE : 2018-05-07
#---------------------------------------------------------------------------
function fn_privacy() {
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$return_data = array();
$return_data['site_info'] = $site_info;
# view
return $this->load->view('/web/rules/privacy', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 개인정보 수집 및 이용
# CREATE : 2018-05-07
#---------------------------------------------------------------------------
function fn_privacy_agreement() {
# model - 사이트 정보
$this->load->model('web/m_site_info');
$site_info = $this->m_site_info->site_info_select(1);
$return_data = array();
$return_data['site_info'] = $site_info;
# view
return $this->load->view('/web/rules/privacy_agreement', $return_data, true);
}
}
?>

View File

@@ -0,0 +1,689 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class search extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 검색메인
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function fn_index() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
# 연관검색어
$req_data = array();
$req_data['keyword'] = $search_keyword_tmp;
$req_data['offset'] = 0;
$req_data['limit'] = 10;
$this->load->model('web/m_search_keyword_relation');
$arr_search_keyword_relation = $this->m_search_keyword_relation->search_keyword_relation_list($req_data);
$search_keyword_txt = gf_search_keyword_fulltext_string($search_keyword_tmp);
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_txt;
$req_data['offset'] = 0;
$req_data['limit'] = 3;
$req_data['sort_column'] = 'display_date';
# 라이프
$this->load->model('web/m_life');
$arr_life = $this->m_life->life_list($req_data);
# 뉴스
$this->load->model('web/m_news');
$arr_news = $this->m_news->news_list($req_data);
# 칼럼
$this->load->model('web/m_column');
$arr_column = $this->m_column->column_list($req_data);
# 뉴스 - 관련 뉴스
$this->load->model('web/m_relation_article');
$arr_news_relation_article = array();
foreach($arr_news as $val) {
$req_data = array();
$req_data['content_type'] = '1';
$req_data['content_idx'] = $val['idx'];
$arr_news_relation_article[$val['idx']] = $this->m_relation_article->relation_article_join_news_list($req_data);
}
$search_keyword_txt = addslashes($search_keyword);
# 동영상
$req_data = array();
$req_data['search_type'] = 'main_search_and_video_url';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = 0;
$req_data['limit'] = 5;
$req_data['sort_column'] = 'display_date';
$arr_life_video = $this->m_life->life_list($req_data);
$arr_news_video = $this->m_news->news_list($req_data);
$arr_column_video = $this->m_column->column_list($req_data);
$arr_video = array_merge($arr_life_video, $arr_news_video, $arr_column_video);
$arr_display_date = array();
foreach ($arr_video as $key=>$val) {
$arr_display_date[$key] = $val['display_date'];
}
array_multisort($arr_display_date, SORT_DESC, $arr_video);
# 이미지
$arr_img = array_merge($arr_life, $arr_news, $arr_column);
$arr_display_date = array();
foreach ($arr_img as $key=>$val) {
$arr_display_date[$key] = $val['display_date'];
}
array_multisort($arr_display_date, SORT_DESC, $arr_img);
$total_count = count($arr_img);
$return_data = array();
$return_data['arr_life'] = $arr_life;
$return_data['arr_news'] = $arr_news;
$return_data['arr_column'] = $arr_column;
$return_data['search_keyword'] = $search_keyword;
$return_data['arr_search_keyword_relation'] = $arr_search_keyword_relation;
$return_data['arr_img'] = $arr_img;
$return_data['arr_video'] = $arr_video;
$return_data['total_count'] = $total_count;
$return_data['arr_news_relation_article'] = $arr_news_relation_article;
// $this->load->library('remotesearch');
// $return_data['wikiResult'] = $this->remotesearch->wikipedia($return_data['search_keyword']);
$return_data['wikiResult'] = [];
# view
return $this->load->view('/web/search/index', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 검색어 찾기
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function fn_ajax_search_keyword() {
# request
$keyword = trim($this->input->get_post('keyword', TRUE));
# select
$req_data = array();
$req_data['search_type'] = 'keyword';
$req_data['search_keyword'] = $keyword;
$req_data['offset'] = 0;
$req_data['limit'] = 15;
$this->load->model('web/m_search_keyword');
$result_tmp = $this->m_search_keyword->search_keyword_list($req_data);
$result = array();
foreach ($result_tmp as $key=>$val) {
$result[$key]['keyword'] = str_replace("'", "\\'", $val['keyword']);
}
if(count($result) > 0) {
$return_data['result'] = array('code' => '0000', 'data' => $result);
} else {
$return_data['result'] = array('code' => '9999');
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 검색어 찾기
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function fn_ajax_search_keyword_reg() {
# request
$keyword = trim($this->input->get_post('keyword', TRUE));
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
$this->load->library('comm');
$this->load->model('web/m_search_keyword');
$this->load->model('web/m_search_keyword_relation');
$arr_keyword = explode(" ", $keyword);
if(count($arr_keyword) > 0) {
array_unshift($arr_keyword, $keyword);
foreach ($arr_keyword as $key =>$val) {
# 금칙어
$forbidden_word_count = $this->comm->fn_forbidden_word($val);
if($forbidden_word_count > 0) {
throw new Cm_Exception('json', '9999', '검색할수 없는 단어가 있습니다.');
exit;
}
# 검색키워드 넣기
$req_data = array();
$req_data['keyword'] = $val;
$result = $this->m_search_keyword->search_keyword_where_keyword_select($req_data);
if($result > 0) {
$this->m_search_keyword->search_keyword_search_count_update($result['idx']);
} else {
$req_data = array();
$req_data['keyword'] = $val;
$this->m_search_keyword->search_keyword_insert($req_data);
}
# 연관검색어
if($key > 1) {
$req_data = array();
$req_data['keyword'] = $arr_keyword[1];
$req_data['relation_keyword'] = $val;
$result1 = $this->m_search_keyword_relation->search_keyword_relation_where_keyword_relation_keyword_select($req_data);
if($result1 > 0) {
$this->m_search_keyword_relation->search_keyword_relation_search_count_update($result1['idx']);
} else {
$req_data = array();
$req_data['keyword'] = $arr_keyword[1];
$req_data['relation_keyword'] = $val;
$this->m_search_keyword_relation->search_keyword_relation_keyword_insert($req_data);
}
}
}
}
# log insert
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['keyword'] = $keyword;
$this->load->model('web/m_search_keyword_log');
$this->m_search_keyword_log->search_keyword_log_insert($req_data);
$return_data['result'] = array('code' => '0000');
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 이미지
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_image() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = 0;
$req_data['limit'] = 100;
$this->load->model('web/m_vw_content');
$total_count = $this->m_vw_content->vw_content_list_total_count($req_data);
$return_data = array();
$return_data['search_keyword'] = $search_keyword;
$return_data['total_count'] = $total_count;
$return_data['limit'] = 100;
# view
return $this->load->view('/web/search/image', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 이미지 더가져오기
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_ajax_image_list_more() {
# request
$page = trim($this->input->get_post('page', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
# paging 설정
$limit = 100;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$this->load->model('web/m_vw_content');
$list = $this->m_vw_content->vw_content_list($req_data);
$total_count = $this->m_vw_content->vw_content_list_total_count($req_data);
$more_list = 'N';
if(($total_count-($page*$limit)) > 0){
$more_list = 'Y';
}
# view data
$return_data = array();
$return_data['result_code'] = '0000';
$return_data['total_count'] = $total_count;
$return_data['list'] = $list;
$return_data['more_list'] = $more_list;
$return_data['limit'] = $limit;
$return_data['page'] = $page;
$return_data['view_count'] = $offset;
$return_data['search_keyword_tmp'] = $search_keyword_tmp;
return $this->load->view('/web/search/image_list_more', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 이미지, 동영상 신고
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_ajax_spam_proc() {
$spam_type = trim($this->input->get_post('spam_type', TRUE));
$spam_list = $this->input->get_post('spam_list', TRUE);
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
if($spam_type=='') throw new Cm_Exception('json', '9999', '신고할 내용이 없습니다.');
if(count($spam_list)==0) throw new Cm_Exception('json', '9999', '신고할 내용이 없습니다.');
if($SES_MEMBER_ID == '') throw new Cm_Exception('json', '9999', '로그인을 하셔야 가능합니다.');
$this->load->model('web/m_spam_media_log');
foreach ($spam_list as $val) {
$arr_content = explode("_", $val);
$content_type = $arr_content[0];
$content_idx = $arr_content[1];
if($content_type=='') throw new Cm_Exception('json', '9999', '신고할 내용이 없습니다.');
if($content_idx=='') throw new Cm_Exception('json', '9999', '신고할 내용이 없습니다.');
# insert
$req_data = array();
$req_data['member_id'] = $SES_MEMBER_ID;
$req_data['spam_type'] = $spam_type;
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $content_idx;
$this->m_spam_media_log->spam_media_log_insert($req_data);
}
$return_data['result'] = array('code' => '0000');
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 라이프, 칼럼
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_list() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$content_type = trim($this->input->get_post('content_type', TRUE));
$page = trim($this->input->get_post('page', TRUE));
# default setting
if($page=='') $page = '1';
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
$search_keyword_txt = gf_search_keyword_fulltext_string($search_keyword_tmp);
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_txt;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['sort_column'] = 'display_date';
if($content_type == '3') {
# 라이프
$this->load->model('web/m_life');
$list = $this->m_life->life_list($req_data);
$total_count = $this->m_life->life_list_total_count($req_data);
$page_title = '라이프';
} else if($content_type == '2') {
# 칼럼
$this->load->model('web/m_column');
$list = $this->m_column->column_list($req_data);
$total_count = $this->m_column->column_list_total_count($req_data);
$page_title = '칼럼';
}
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/search/list?search_keyword='.urlencode($search_keyword).'&content_type='.$content_type.'&page=');
$start_row = $offset+1;
$end_row = $limit*$page;
if($end_row >= $total_count) $end_row = $total_count;
$return_data = array();
$return_data['search_keyword'] = $search_keyword;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
$return_data['page'] = $page;
$return_data['start_row'] = $start_row;
$return_data['end_row'] = $end_row;
$return_data['pagination'] = $pagination;
$return_data['page_title'] = $page_title;
$return_data['content_type'] = $content_type;
# view
return $this->load->view('/web/search/list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 영상
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_video() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$page = trim($this->input->get_post('page', TRUE));
# default setting
if($page=='') $page = '1';
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['search_type'] = 'main_search_and_video_url';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$this->load->model('web/m_vw_content');
$list = $this->m_vw_content->vw_content_list($req_data);
$total_count = $this->m_vw_content->vw_content_list_total_count($req_data);
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/search/video?search_keyword='.urlencode($search_keyword).'&page=');
$start_row = $offset+1;
$end_row = $limit*$page;
if($end_row >= $total_count) $end_row = $total_count;
$return_data = array();
$return_data['search_keyword'] = $search_keyword;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
$return_data['page'] = $page;
$return_data['start_row'] = $start_row;
$return_data['end_row'] = $end_row;
$return_data['pagination'] = $pagination;
# view
return $this->load->view('/web/search/video', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function fn_news() {
# Request
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$page = trim($this->input->get_post('page', TRUE));
$search_sort = trim($this->input->get_post('search_sort', TRUE));
$content_idx = trim($this->input->get_post('content_idx', TRUE));
# default setting
if($search_sort == '') $search_sort = '1';
if($page=='') $page = '1';
# sort
switch ($search_sort) {
case '1': $sort_column = 'display_date'; $sort_type = 'desc'; $sorting = SORT_DESC; break;
case '2': $sort_column = 'display_date'; $sort_type = 'asc'; $sorting = SORT_ASC; break;
default : $sort_column = 'display_date'; $sort_type = 'desc'; $sorting = SORT_DESC; break;
}
$search_keyword_tmp = urldecode($search_keyword);
$search_keyword_tmp = addslashes($search_keyword_tmp);
$search_keyword_txt = gf_search_keyword_fulltext_string($search_keyword_tmp);
# paging 설정
$limit = 20;
$offset = ($page-1) * $limit;
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_txt;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
$req_data['sort_column'] = $sort_column;
$req_data['sort_type'] = $sort_type;
$news_type = '';
$arr_news_relation_article = array();
if($content_idx == '') {
# 뉴스
$this->load->model('web/m_news');
$list = $this->m_news->news_list($req_data);
$total_count = $this->m_news->news_list_total_count($req_data);
} else {
# 뉴스
$this->load->model('web/m_news');
$list[] = $this->m_news->news_select($content_idx);
}
# 뉴스 - 관련 뉴스
$this->load->model('web/m_relation_article');
foreach($list as $val) {
$req_data = array();
$req_data['content_type'] = '1';
$req_data['content_idx'] = $val['idx'];
$arr_news_relation_article[$val['idx']] = $this->m_relation_article->relation_article_join_news_list($req_data);
}
if($content_idx != '') {
$list = array_merge($list, $arr_news_relation_article[$content_idx]);
$total_count = count($list);
$news_type='relation';
$arr_news_relation_article = array();
$arr_display_date = array();
foreach ($list as $key=>$val) {
$arr_display_date[$key] = $val['display_date'];
}
array_multisort($arr_display_date, $sorting, $list);
}
# page
$max_page = ceil($total_count / $limit);
$pagination = gf_paging($limit, $page, $max_page, '/web/search/news?search_keyword='.urlencode($search_keyword).'&content_idx='.$content_idx.'&search_sort='.$search_sort.'&page=');
$start_row = $offset+1;
$end_row = $limit*$page;
if($end_row >= $total_count) $end_row = $total_count;
$return_data = array();
$return_data['search_keyword'] = $search_keyword;
$return_data['list'] = $list;
$return_data['total_count'] = $total_count;
$return_data['page'] = $page;
$return_data['start_row'] = $start_row;
$return_data['end_row'] = $end_row;
$return_data['pagination'] = $pagination;
$return_data['search_sort'] = $search_sort;
$return_data['arr_news_relation_article'] = $arr_news_relation_article;
$return_data['news_type'] = $news_type;
$return_data['content_idx'] = $content_idx;
# view
return $this->load->view('/web/search/news', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 이미지 뷰
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function fn_ajax_image_view() {
# request
$content_type = trim($this->input->get_post('content_type', TRUE));
$content_idx = trim($this->input->get_post('content_idx', TRUE));
$row_num = trim($this->input->get_post('row_num', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_keyword_tmp = addslashes($search_keyword);
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['row_num'] = $row_num;
$this->load->model('web/m_vw_content');
$arr_next = $this->m_vw_content->vw_content_next_select($req_data);
$arr_prev = $this->m_vw_content->vw_content_prev_select($req_data);
if($content_type == '1') {
$this->load->model('web/m_news');
$result = $this->m_news->news_select($content_idx);
} else if($content_type == '2') {
$this->load->model('web/m_column');
$result = $this->m_column->column_select($content_idx);
} else if($content_type == '3') {
$this->load->model('web/m_life');
$result = $this->m_life->life_select($content_idx);
}
$req_data = array();
$req_data['search_type'] = 'main_search';
$req_data['search_keyword'] = $search_keyword_tmp;
$req_data['offset'] = 0;
$req_data['limit'] = 8;
$req_data['idx'] = $content_idx;
$this->load->model('web/m_vw_content');
$arr_relation_img = $this->m_vw_content->vw_content_where_not_idx_list($req_data);
# view data
$return_data = array();
$return_data['result_code'] = '0000';
$return_data['result'] = $result;
$return_data['arr_relation_img'] = $arr_relation_img;
$return_data['content_type'] = $content_type;
$return_data['arr_next'] = $arr_next;
$return_data['arr_prev'] = $arr_prev;
$return_data['search_keyword'] = $search_keyword;
# view
return $this->load->view('/web/search/image_view', $return_data);
}
}
?>

View File

@@ -0,0 +1,335 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/web/cm_controller.php');
class share extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 트위터 callback url
# CREATE : 2018-04-10
#---------------------------------------------------------------------------
function fn_twitter_callback_proc() {
# Request
$type = trim($this->input->get_post('type', TRUE));
$oauth_token = trim($this->input->get_post('oauth_token', TRUE));
$oauth_verifier = trim($this->input->get_post('oauth_verifier', TRUE));
$twitter_oauth_token = $this->session->userdata('Twitter_Oauth_Token');
$twitter_oauth_token_secret = $this->session->userdata('Twitter_Oauth_Token_Secret');
$this->session->unset_userdata('Twitter_Oauth_Token');
$this->session->unset_userdata('Twitter_Oauth_Token_Secret');
if ($oauth_token != $twitter_oauth_token) {
gf_alert('트위터 연동에 실패했습니다.', 'self_close');
exit;
}
if($oauth_verifier=='') {
gf_alert('트위터 연동에 실패했습니다.', 'self_close');
exit;
}
require_once (APPPATH."/inc/twitter_OAuth.php");
$tmhOAuth = new tmhOAuth();
// update with the temporary token and secret
$tmhOAuth->reconfigure(array_merge($tmhOAuth->config, array('token' => $twitter_oauth_token, 'secret' => $twitter_oauth_token_secret)));
$code = $tmhOAuth->user_request(array(
'method' => 'POST',
'url' => $tmhOAuth->url('oauth/access_token', ''),
'params' => array('oauth_verifier' => trim($oauth_verifier))
));
if ($code != 200) {
gf_alert('트위터 연동에 실패했습니다.', 'self_close');
exit;
}
$oauth_creds = $tmhOAuth->extract_params($tmhOAuth->response['response']);
$tmhOAuth->reconfigure(array_merge($tmhOAuth->config, array(
'token' => $oauth_creds['oauth_token'],
'secret' => $oauth_creds['oauth_token_secret'],
)));
$code = $tmhOAuth->user_request(array(
'url' => $tmhOAuth->url('1.1/account/verify_credentials')
));
$arr_member_data = json_decode($tmhOAuth->response['response'], true);
if($type=='comment') {
$social_id = (string)$arr_member_data['id'];
$social_name = $arr_member_data['name'];
# 로그
$req_data = array();
$req_data['social_id'] = $social_id;
$req_data['name'] = $social_name;
$req_data['social_type'] = '2';
$this->load->model('web/m_comment_social_member_log');
$this->m_comment_social_member_log->comment_social_member_log_insert($req_data);
$req_data = array();
$req_data['member_id'] = $social_id;
$req_data['member_name'] = $social_name;
$req_data['sns_type_name'] = 'twitter';
$this->load->library('comm');
$this->comm->fn_comment_login_proc($req_data);
# view
return $this->load->view('/web/comm/social_login', '', true);
}
}
#---------------------------------------------------------------------------
# PURPOSE : 카카오 callback url
# CREATE : 2018-04-10
#---------------------------------------------------------------------------
function fn_kakao_callback_proc() {
# Request
$code = trim($this->input->get_post('code', TRUE));
$state = trim($this->input->get_post('state', TRUE));
$SES_RANDOM_STATE = $this->session->userdata('RANDOM_STATE');
if($state!=$SES_RANDOM_STATE) {
gf_alert('카카오계정 연동에 실패했습니다.1', 'self_close');
exit;
}
$CLIENT_ID = "d9d530edc95295682137fdd37dddc55f";
$REDIRECT_URI = WWW_CROSSMAP."/web/share/kakao_callback_proc";
$TOKEN_API_URL = "https://kauth.kakao.com/oauth/token";
$params = sprintf( 'grant_type=authorization_code&client_id=%s&redirect_uri=%s&code=%s', $CLIENT_ID, $REDIRECT_URI, $code);
$opts = array(
CURLOPT_URL => $TOKEN_API_URL,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSLVERSION => 1, // TLS
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false
);
$curlSession = curl_init();
curl_setopt_array($curlSession, $opts);
$accessTokenJson = curl_exec($curlSession);
$status_code = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
curl_close($curlSession);
if($status_code != 200) {
gf_alert('카카오계정 연동에 실패했습니다.2', 'self_close');
exit;
}
$arr_data = json_decode($accessTokenJson, true);
$token_expires_date = date("Y-m-d H:i:s", time()+$arr_data['expires_in']);
$header = "Bearer ".$arr_data['access_token']; // Bearer 다음에 공백 추가
$url = "https://kapi.kakao.com/v1/user/me";
$is_post = false;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers[] = "Authorization: ".$header;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close ($ch);
if($status_code != 200) {
gf_alert('카카오계정 연동에 실패했습니다.3', 'self_close');
exit;
}
$arr_member_data = json_decode($response, true);
if(isset($arr_member_data['id'])==true){
$social_id = (string)$arr_member_data['id'];
$social_name = $arr_member_data['properties']['nickname'];
# 로그
$req_data = array();
$req_data['social_id'] = $social_id;
$req_data['name'] = $social_name;
$req_data['social_type'] = '3';
$this->load->model('web/m_comment_social_member_log');
$this->m_comment_social_member_log->comment_social_member_log_insert($req_data);
$req_data = array();
$req_data['member_id'] = $social_id;
$req_data['member_name'] = $social_name;
$req_data['sns_type_name'] = 'kakao';
$this->load->library('comm');
$this->comm->fn_comment_login_proc($req_data);
# view
return $this->load->view('/web/comm/social_login', '', true);
}
}
#---------------------------------------------------------------------------
# PURPOSE : 네이버 callback url
# CREATE : 2018-04-10
#---------------------------------------------------------------------------
function fn_naver_callback_proc() {
# Request
$code = trim($this->input->get_post('code', TRUE));
$state = trim($this->input->get_post('state', TRUE));
$error = trim($this->input->get_post('error', TRUE));
if($error!='') {
gf_alert('네이버계정 연동에 실패했습니다.1', 'self_close');
exit;
}
$SES_RANDOM_STATE = $this->session->userdata('RANDOM_STATE');
if($state!=$SES_RANDOM_STATE) {
gf_alert('네이버계정 연동에 실패했습니다.2', 'self_close');
exit;
}
$client_id = "cNiinVHYsygxVKF4FOtw";
$client_secret = "nrTOCTFNUq";
$redirectURI = urlencode(WWW_CROSSMAP."/web/share/naver_callback_proc");
$url = "https://nid.naver.com/oauth2.0/token?grant_type=authorization_code&client_id=".$client_id."&client_secret=".$client_secret."&redirect_uri=".$redirectURI."&code=".$code."&state=".$state;
$is_post = false;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close ($ch);
if($status_code != 200) {
gf_alert('네이버계정 연동에 실패했습니다.3', 'self_close');
exit;
}
$arr_data = json_decode($response, true);
$token_expires_date = date("Y-m-d H:i:s", time()+$arr_data['expires_in']);
$header = "Bearer ".$arr_data['access_token']; // Bearer 다음에 공백 추가
$url = "https://openapi.naver.com/v1/nid/me";
$is_post = false;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers[] = "Authorization: ".$header;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close ($ch);
if($status_code != 200) {
gf_alert('네이버계정 연동에 실패했습니다.', 'self_close');
exit;
}
$arr_member_data = json_decode($response, true);
if($arr_member_data['resultcode'] == '00'){
if(!$arr_member_data['response']['name']) {
gf_alert('네이버계정 연동에 실패했습니다.(필수항목 : 이름)', 'self_close');
exit;
}
$social_id = $arr_member_data['response']['id'];
$social_name = $arr_member_data['response']['name'];
# 로그
$req_data = array();
$req_data['social_id'] = $social_id;
$req_data['name'] = $social_name;
$req_data['social_type'] = '4';
$this->load->model('web/m_comment_social_member_log');
$this->m_comment_social_member_log->comment_social_member_log_insert($req_data);
$req_data = array();
$req_data['member_id'] = $social_id;
$req_data['member_name'] = $social_name;
$req_data['sns_type_name'] = 'naver';
$this->load->library('comm');
$this->comm->fn_comment_login_proc($req_data);
$this->session->unset_userdata('RANDOM_STATE');
# view
return $this->load->view('/web/comm/social_login', '', true);
}
}
#---------------------------------------------------------------------------
# PURPOSE : 페이스북 로그인 url
# CREATE : 2018-04-10
#---------------------------------------------------------------------------
function fn_ajax_facebook_login_proc() {
# Request
$id = trim($this->input->get_post('id', TRUE));
$name = trim($this->input->get_post('name', TRUE));
$return_data['result'] = array('code' => '9999');
if($id!='') {
$social_id = $id;
$social_name = $name;
# 로그
$req_data = array();
$req_data['social_id'] = $social_id;
$req_data['name'] = $social_name;
$req_data['social_type'] = '1';
$this->load->model('web/m_comment_social_member_log');
$this->m_comment_social_member_log->comment_social_member_log_insert($req_data);
$req_data = array();
$req_data['member_id'] = $social_id;
$req_data['member_name'] = $social_name;
$req_data['sns_type_name'] = 'facebook';
$this->load->library('comm');
$this->comm->fn_comment_login_proc($req_data);
$return_data['result'] = array('code' => '0000');
}
# view
return $this->load->view('/web/comm/result_json', $return_data);
}
}
?>

View File

@@ -0,0 +1,34 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
include_once(APPPATH.'core/web/cm_exceptions.php');
class user extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->library('user_agent');
$this->load->helper('crossmap/tool_helper');
$this->load->helper('crossmap/exception_helper');
$this->load->helper('url');
}
public function index() {
redirect($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].'/web/user/register');
}
public function register() {
$this->load->view('/web/member/register');
}
public function login() {
$this->load->view('/web/member/login');
}
public function find_id() {
$this->load->view('/web/member/find_id');
}
public function find_password() {
$this->load->view('/web/member/find_password');
}
}

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