Skip to content

Commit

Permalink
v 0.4.5
Browse files Browse the repository at this point in the history
SSO 멀티 도메인 개선
로그인 쿠키/세션 개선
파일 처리 개선
  • Loading branch information
Prev committed Sep 28, 2013
1 parent 37da936 commit c8b6c81
Show file tree
Hide file tree
Showing 25 changed files with 355 additions and 175 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ engine-pmc 설치 및 개발 방법은 **[이 문서](https://github.com/Prev/en

#Change Log

#### v 0.4.5
+ SSO 멀티 도메인 개선
+ 로그인 쿠키/세션 개선
+ 파일 처리 개선

#### v 0.4.4
+ 모듈 액션간 상속 지원
+ 모듈 프로세스 개선
Expand Down
35 changes: 25 additions & 10 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Define PMC version
*/
define('PMC_VERSION', '0.4.4');
define('PMC_VERSION', '0.4.5');


/**
Expand All @@ -34,7 +34,7 @@
* Define X_UA_Compatible (ie edge)
*/
define('X_UA_Compatible', 'IE=Edge,chrome=1');


/**
* Define default Layout name
Expand Down Expand Up @@ -113,18 +113,35 @@


/**
* Define realavite url (=root url)
* Define session domain
*/
define('SESSION_DOMAIN', getSessionDomain());





/**
* Define server uri
*/
define('SERVER_URI', getServerUri());


/**
* Define sso session name
*/
define('SSO_COOKIE_NAME', 'pmc_sess_key');

/**
* Define sso session name
*/
define('SSO_SESSION_NAME', 'pmc_sso_data_' . substr(md5(RELATIVE_URL), 0, 10));


/**
* Define real url
*/
define('REAL_URI', PROTOCOL . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
define('REAL_URL', REAL_URI);




/**
* login file url
Expand All @@ -150,10 +167,8 @@
ini_set('display_errors', (DEBUG_MODE ? 1 : 0));



// lib.rsa.php, lib.lessc.php is required when is needed

if (file_exists(ROOT_DIR . '/lib/functions/custom.function.php'))
require ROOT_DIR . '/lib/functions/custom.function.php';

require ROOT_DIR . '/config/database.php';
require ROOT_DIR . '/config/secure-keys.php';
Expand Down
48 changes: 24 additions & 24 deletions config/database.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

function getDBInfo() {
$dt = debug_backtrace();
$allow = (defined('ROOT_DIR') && ROOT_DIR . DIRECTORY_SEPARATOR . 'index.php' == $dt[0]['file']) ||
(defined('SSO_DIR') && SSO_DIR . DIRECTORY_SEPARATOR . 'conf.database.php' == $dt[0]['file']);
if (!$allow) {
if (class_exists(Context))
Context::printWarning('SandBox error : call getDBInfo in other file');
else
throw new Exception('SandBox error : call getDBInfo in other file');
return;
}

return (object) array(
'type' => 'mysql',
'host' => 'localhost',
'username' => 'pmc_test',
'password' => 'test123',
'database_name' => 'pmc_test',
'prefix' => 'pmc_'
);

}
<?php

function getDBInfo() {
$dt = debug_backtrace();
$allow = (defined('ROOT_DIR') && ROOT_DIR . DIRECTORY_SEPARATOR . 'index.php' == $dt[0]['file']) ||
(defined('SSO_DIR') && SSO_DIR . DIRECTORY_SEPARATOR . 'conf.database.php' == $dt[0]['file']);
if (!$allow) {
if (class_exists(Context))
Context::printWarning('SandBox error : call getDBInfo in other file');
else
throw new Exception('SandBox error : call getDBInfo in other file');
return;
}

return (object) array(
'type' => 'mysql',
'host' => 'localhost',
'username' => 'pmc_test',
'password' => 'test123',
'database_name' => 'engine_pmc',
'prefix' => 'pmc_'
);

}
73 changes: 50 additions & 23 deletions config/initialize.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net
--
-- 호스트: localhost
-- 처리한 시간: 13-09-06 20:35
-- 처리한 시간: 13-09-28 22:42
-- 서버 버전: 5.1.41-community
-- PHP 버전: 5.2.12

Expand All @@ -17,10 +17,10 @@ SET time_zone = "+00:00";
/*!40101 SET NAMES utf8 */;

--
-- 데이터베이스: `pmc_test`
-- 데이터베이스: `engine_pmc`
--
CREATE DATABASE IF NOT EXISTS `pmc_test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `pmc_test`;
CREATE DATABASE IF NOT EXISTS `engine_pmc` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `engine_pmc`;

-- --------------------------------------------------------

Expand All @@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `pmc_article` (
KEY `board_id` (`board_id`),
KEY `writer_id` (`writer_id`),
KEY `top_no` (`top_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

Expand All @@ -68,7 +68,7 @@ CREATE TABLE IF NOT EXISTS `pmc_article_comment` (
KEY `article_no` (`article_no`),
KEY `top_id` (`top_id`),
KEY `parent_id` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

-- --------------------------------------------------------

Expand All @@ -84,7 +84,7 @@ CREATE TABLE IF NOT EXISTS `pmc_article_files` (
PRIMARY KEY (`id`),
KEY `article_no` (`article_no`),
KEY `file_id` (`file_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

Expand All @@ -107,11 +107,14 @@ CREATE TABLE IF NOT EXISTS `pmc_board` (
UNIQUE KEY `name_en` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- 테이블의 덤프 데이터 `pmc_board`
--

INSERT INTO `pmc_board` (`id`, `name`, `name_locales`, `categorys`, `readable_group`, `commentable_group`, `writable_group`, `admin_group`, `hide_secret_article`, `extra_vars`) VALUES
(1, 'freeboard', '{"en":"Freeboard", "ko":"자유게시판"}', '["안내","뻘글"]', NULL, NULL, NULL, NULL, 1, NULL),
(1, 'freeboard', '{"en":"Freeboard", "ko":"자유게시판"}', '["안내","뻘글"]', NULL, NULL, NULL, NULL, 0, NULL),
(2, 'notice', '{"en":"Notice", "ko":"공지사항"}', NULL, NULL, NULL, '["admin"]', NULL, 0, NULL);


-- --------------------------------------------------------

--
Expand All @@ -120,11 +123,19 @@ INSERT INTO `pmc_board` (`id`, `name`, `name_locales`, `categorys`, `readable_gr

CREATE TABLE IF NOT EXISTS `pmc_files` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`is_binary` tinyint(1) NOT NULL,
`file_type` varchar(15) NOT NULL,
`file_hash` varchar(40) NOT NULL,
`file_size` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- 테이블의 덤프 데이터 `pmc_files`
--

INSERT INTO `pmc_files` (`id`, `file_type`, `file_hash`, `file_size`) VALUES
(1, 'binaries', 'b6f7a9a2bda9d15ea5adbbbe1a425fb1acce3f0f', 226473),
(2, 'binaries', '82dbf031f310cced943924b33a4e5a660260b59f', 3953);

-- --------------------------------------------------------

Expand All @@ -140,7 +151,7 @@ CREATE TABLE IF NOT EXISTS `pmc_login_log` (
`auto_login` tinyint(1) NOT NULL,
`login_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

Expand All @@ -155,6 +166,7 @@ CREATE TABLE IF NOT EXISTS `pmc_menu` (
`level` tinyint(1) unsigned NOT NULL,
`is_index` tinyint(1) unsigned NOT NULL DEFAULT '0',
`visible` tinyint(1) unsigned NOT NULL DEFAULT '1',
`visible_group` text,
`parent_id` int(10) unsigned DEFAULT NULL,
`module` tinytext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`action` tinytext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
Expand All @@ -164,13 +176,17 @@ CREATE TABLE IF NOT EXISTS `pmc_menu` (
KEY `parent_id` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

INSERT INTO `pmc_menu` (`id`, `title`, `title_locales`, `level`, `is_index`, `visible`, `parent_id`, `module`, `action`, `extra_vars`) VALUES
(1, 'home', '{"en":"Home", "ko":"홈"}', 1, 1, 1, NULL, 'index', NULL, NULL),
(2, 'notice', '{"en":"Notice", "ko":"공지사항"}', 1, 0, 1, NULL, 'board', NULL, NULL),
(3, 'freeboard', '{"en":"Free Board", "ko":"자유게시판"}', 1, 0, 1, NULL, 'board', NULL, NULL),
(4, 'others', '{"en":"Others", "ko":"기타"}', 1, 0, 1, NULL, 'page', NULL, NULL),
(5, 'about', '{"en":"About", "ko":"정보"}', 2, 0, 1, 4, 'page', NULL, NULL),
(6, 'libraries', '{"en":"Libraries", "ko":"라이브러리"}', 2, 0, 1, 4, 'page', NULL, NULL);
--
-- 테이블의 덤프 데이터 `pmc_menu`
--

INSERT INTO `pmc_menu` (`id`, `title`, `title_locales`, `level`, `is_index`, `visible`, `visible_group`, `parent_id`, `module`, `action`, `extra_vars`) VALUES
(1, 'home', '{"en":"Home", "ko":"홈"}', 1, 1, 1, NULL, NULL, 'index', NULL, NULL),
(2, 'notice', '{"en":"Notice", "ko":"공지사항"}', 1, 0, 1, NULL, NULL, 'board', NULL, NULL),
(3, 'freeboard', '{"en":"Free Board", "ko":"자유게시판"}', 1, 0, 1, NULL, NULL, 'board', NULL, NULL),
(4, 'others', '{"en":"Others", "ko":"기타"}', 1, 0, 1, NULL, NULL, 'page', NULL, NULL),
(5, 'about', '{"en":"About", "ko":"정보"}', 2, 0, 1, NULL, 4, 'page', NULL, NULL),
(6, 'libraries', '{"en":"Libraries", "ko":"라이브러리"}', 2, 0, 1, NULL, 4, 'page', NULL, NULL);

-- --------------------------------------------------------

Expand Down Expand Up @@ -210,11 +226,14 @@ CREATE TABLE IF NOT EXISTS `pmc_user` (
UNIQUE KEY `user_id` (`input_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- 테이블의 덤프 데이터 `pmc_user`
--

INSERT INTO `pmc_user` (`id`, `input_id`, `password`, `password_salt`, `nick_name`, `user_name`, `email_address`, `phone_number`, `last_logined_ip`, `extra_vars`) VALUES
(1, 'admin', '875bdbdd2cdb7326981de9c27bf9d76d52c75cd9bb1299417b1135b69a748b69', 'f98c94ebb87dc80be2a26991e3d5cc62', '어드민', '어드민', '[email protected]', '010-1234-5678', '127.0.0.1', NULL),
(2, 'tester', '2827e05770ec174da512daf5af4ce49f5e07209d82e2ed90b2ee565886e7b521', '8f4031bfc7640c5f267b11b6fe0c2507', '테스터', '테스터', '[email protected]', '010-1234-5678', '127.0.0.1', NULL);


-- --------------------------------------------------------

--
Expand All @@ -230,6 +249,10 @@ CREATE TABLE IF NOT EXISTS `pmc_user_group` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- 테이블의 덤프 데이터 `pmc_user_group`
--

INSERT INTO `pmc_user_group` (`id`, `name`, `name_locales`, `is_default`, `is_admin`) VALUES
(1, 'admin', '{"en":"Admin Group", "ko":"관리그룹"}', 0, 1),
(2, 'general', '{"en":"General","ko":"일반회원"}', 1, 0);
Expand All @@ -249,6 +272,10 @@ CREATE TABLE IF NOT EXISTS `pmc_user_group_user` (
KEY `group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- 테이블의 덤프 데이터 `pmc_user_group_user`
--

INSERT INTO `pmc_user_group_user` (`id`, `group_id`, `user_id`) VALUES
(1, 1, 1),
(2, 2, 2);
Expand All @@ -263,16 +290,16 @@ INSERT INTO `pmc_user_group_user` (`id`, `group_id`, `user_id`) VALUES
ALTER TABLE `pmc_article`
ADD CONSTRAINT `pmc_article_ibfk_1` FOREIGN KEY (`board_id`) REFERENCES `pmc_board` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `pmc_article_ibfk_2` FOREIGN KEY (`writer_id`) REFERENCES `pmc_user` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `pmc_article_ibfk_3` FOREIGN KEY (`top_no`) REFERENCES `pmc_article` (`no`);
ADD CONSTRAINT `pmc_article_ibfk_3` FOREIGN KEY (`top_no`) REFERENCES `pmc_article` (`no`) ON DELETE CASCADE;

--
-- Constraints for table `pmc_article_comment`
--
ALTER TABLE `pmc_article_comment`
ADD CONSTRAINT `pmc_article_comment_ibfk_1` FOREIGN KEY (`article_no`) REFERENCES `pmc_article` (`no`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `pmc_article_comment_ibfk_2` FOREIGN KEY (`writer_id`) REFERENCES `pmc_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `pmc_article_comment_ibfk_3` FOREIGN KEY (`top_id`) REFERENCES `pmc_article_comment` (`id`),
ADD CONSTRAINT `pmc_article_comment_ibfk_4` FOREIGN KEY (`parent_id`) REFERENCES `pmc_article_comment` (`id`);
ADD CONSTRAINT `pmc_article_comment_ibfk_3` FOREIGN KEY (`top_id`) REFERENCES `pmc_article_comment` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `pmc_article_comment_ibfk_4` FOREIGN KEY (`parent_id`) REFERENCES `pmc_article_comment` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `pmc_article_files`
Expand Down
Loading

0 comments on commit c8b6c81

Please sign in to comment.