set hypt framework

This commit is contained in:
sychoi 2024-08-05 09:38:31 +09:00
parent c8455a453d
commit 3e2e1a2f11
1727 changed files with 537807 additions and 0 deletions

13
config/db_config.php Normal file
View File

@ -0,0 +1,13 @@
<?php
/*
database_type = "mssql"
database_host = "host.docker.internal"
database_port = "18222"
database_name = "HYPT"
database_user = "kulsict"
database_pass = "ict@2339"
database_encode = "UTF-8"
database_charset = "Korean_Wansung_CI_AS"
database_old = 1
*/
?>

11
config/db_config_my.php Normal file
View File

@ -0,0 +1,11 @@
<?php
/*
database_type = "mysql"
database_host = "127.0.0.1"
database_port = "3306"
database_name = "test"
database_user = "kulsict"
database_pass = "ict@2339"
database_encode = "UTF-8"
*/
?>

107
config/html_config.php Normal file
View File

@ -0,0 +1,107 @@
<?php
//사이트 명칭 (DB 사용않음)
define('_APP_NAME_', '(주)한양공업');
//# 사이트 디렉토리 - 절대경로
define( '_ROOT_PATH_', dirname(__DIR__) );
define( '_CONF_PATH_', _ROOT_PATH_.'/config' );
define( '_LIB_PATH_', _ROOT_PATH_.'/lib' );
//# 업로드 관련 경로
define( '_UP_PATH_', _ROOT_PATH_."/upload_files" );
//# 홈페이지 Main URL
define( '_DOMAIN_', $_SERVER['HTTP_HOST']); //직접입력시 지정도메인
define( '_SITE_PATH_', _ROOT_PATH_.'/www' );
define( '_SITE_URL_', "//"._DOMAIN_ );
define( '_SITE_INC_PATH_', _SITE_PATH_."/include" );
define( '_SITE_INC_URL_', _SITE_URL_."/include" );
define( '_HOME_PATH_', _SITE_PATH_ );
define( '_HOME_URL_', _SITE_URL_ );
define( '_HOME_INC_PATH_', _SITE_INC_PATH_ );
define( '_HOME_INC_URL_', _SITE_INC_URL_ );
//# 관리자 경로
define( '_ADM_PATH_', _SITE_PATH_.'/kadm' );
define( '_ADM_URL_', _SITE_URL_.'/kadm' );
define( '_ADM_INC_PATH_', _ADM_PATH_.'/inc' );
define( '_ADM_INC_URL_', _ADM_URL_.'/inc' );
//# 서비스 경로
define( '_SVC_PATH_', _SITE_PATH_.'/ksvc' );
define( '_SVC_URL_', _SITE_URL_.'/ksvc' );
define( '_SVC_INC_PATH_', _SVC_PATH_.'/inc' );
define( '_SVC_INC_URL_', _SVC_URL_.'/inc' );
//싱글로그인만 허용할경우 true 처리. 인증토큰 방식으로 처리와 병용을 체크
define( '_SINGLE_LOGIN_', false );
//지정도메인으로만 접속
if( $_SERVER['HTTP_HOST'] && $_SERVER['HTTP_HOST'] != _DOMAIN_ ){
header("location:http://"._DOMAIN_.$_SERVER['REQUEST_URI']); exit;
}
//HTTPS로만 접속
if( $_SERVER['SERVER_PORT'] != '443' ){
//header("location:https://"._DOMAIN_.$_SERVER['REQUEST_URI']); exit;
}
//기본보안
ini_set( 'allow_url_fopen', false ); // 외부 파일 include 차단
ini_set( 'register_globals', false ); // GET/POST/SESSION 등 구분
//세션보안
register_shutdown_function( 'session_write_close' );
ini_set( 'session.auto_start', false );
//세션설정
session_name('kuls_session'); //사이트 개별적인 세션명
session_set_cookie_params(0, '/', _DOMAIN_);
ini_set('session.cache_expire', 3600); //세션 캐시 유효시간
ini_set('session.gc_maxlifetime', 3600 * 24); //세션 가비지 컬렉션 (세션지속 시간)
ini_set("session.gc_probability", 1); //세션 가비지 컬렉션 확률 분자
ini_set("session.gc_divisor", 100); //세설 가비지 컬렉션 확률 분모
session_cache_limiter('nocache'); //폼내용 유지설정 nocache(지워짐), private(보존함)
//세션파일 별도 관리
define( '_SESS_PATH_', _UP_PATH_.'/sess' );
if( !file_exists(_SESS_PATH_) ) mkdir(_SESS_PATH_);
session_save_path( _SESS_PATH_ );
//세션시작
session_start();
$_DBConfig = parse_ini_file ( "db_config.php" );
//테스트 모드 설정 - 테스트 및 작업시: 0, 사이트운영: 1;
define( '_USE_MODE_', 0 );
//오류메시지 출력설정 - 사이트운영시 1
ini_set("display_errors", _USE_MODE_?"0":"1");
if( !_USE_MODE_ ){
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED);
}
//쿠키 기본설정
define('_COOKIE_DOMAIN_', _DOMAIN_);
//쿠키 만료기간
define('_COOKIE_EXPIRE_', 0);
//쿠키 경로
define('_COOKIE_PATH_', '/');
//암호화/복호화 사용자 Key
define('_AUTH_KEY_', 'kulsauth_');
//
define('_SDATENULL_', '1970-01-01');
define('_FDATENULL_', '3000-12-31');
//Table 정의
include_once _CONF_PATH_."/table_config.php";
//관련 LIB 로딩 / DB접속
include_once _LIB_PATH_."/common_lib.php";
//회원 및 기본정보 로드
include_once _LIB_PATH_."/globals_inc.php";

660
config/info_table_data.php Normal file
View File

@ -0,0 +1,660 @@
<?php
$table_base_data = Array();
$table_base_data['basecode'] = Array(
Array(
'Bran_Uid' => 'auth_admin',
'Group_Uid' => 'auth_admin',
'Code_Uid' => 'A',
'Code_Val' => '관리자',
'Code_Exp' => '관리자',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'auth_admin',
'Group_Uid' => 'auth_admin',
'Code_Uid' => 'auth_admin',
'Code_Val' => 'auth_admin',
'Code_Exp' => '관리자권한',
'Code_Idx' => 8,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'auth_admin',
'Group_Uid' => 'auth_admin',
'Code_Uid' => 'SA',
'Code_Val' => '슈퍼관리자',
'Code_Exp' => '슈퍼관리자',
'Code_Idx' => 1,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'auth_area',
'Group_Uid' => 'auth_area',
'Code_Uid' => 'auth_area',
'Code_Val' => 'auth_area',
'Code_Exp' => '권한 그룹',
'Code_Idx' => 7,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'auth_area',
'Group_Uid' => 'auth_area',
'Code_Uid' => 'G',
'Code_Val' => '그룹권한',
'Code_Exp' => '그룹권한',
'Code_Idx' => 1,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'auth_area',
'Group_Uid' => 'auth_area',
'Code_Uid' => 'M',
'Code_Val' => '개별권한',
'Code_Exp' => '개별권한',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'auth_member',
'Group_Uid' => 'auth_member',
'Code_Uid' => 'auth_member',
'Code_Val' => 'auth_member',
'Code_Exp' => '회원권한',
'Code_Idx' => 9,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'auth_member',
'Group_Uid' => 'auth_member',
'Code_Uid' => 'M',
'Code_Val' => '회원',
'Code_Exp' => '회원',
'Code_Idx' => 1,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'auth_member',
'Group_Uid' => 'auth_member',
'Code_Uid' => 'Y',
'Code_Val' => '비회원',
'Code_Exp' => '비회원',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'board_editor',
'Group_Uid' => 'board_editor',
'Code_Uid' => 'board_editor',
'Code_Val' => 'board_editor',
'Code_Exp' => '작성에디터',
'Code_Idx' => 11,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'board_editor',
'Group_Uid' => 'board_editor',
'Code_Uid' => 'text',
'Code_Val' => '텍스트',
'Code_Exp' => '텍스트',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'board_editor',
'Group_Uid' => 'board_editor',
'Code_Uid' => 'tinymce',
'Code_Val' => '웹에디터',
'Code_Exp' => '웹에디터',
'Code_Idx' => 1,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'cm_var',
'Group_Uid' => 'cm_var',
'Code_Uid' => 'cate_depth',
'Code_Val' => '4',
'Code_Exp' => '분류최대자리수',
'Code_Idx' => 5,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'cm_var',
'Group_Uid' => 'cm_var',
'Code_Uid' => 'cm_var',
'Code_Val' => 'cm_var',
'Code_Exp' => '공통변수',
'Code_Idx' => 3,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'cm_var',
'Group_Uid' => 'cm_var',
'Code_Uid' => 'cust_id_len',
'Code_Val' => '3',
'Code_Exp' => '소속 코드 최소글자수',
'Code_Idx' => 6,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'cm_var',
'Group_Uid' => 'cm_var',
'Code_Uid' => 'id_len',
'Code_Val' => '6',
'Code_Exp' => '아이디 최소글자수',
'Code_Idx' => 3,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'cm_var',
'Group_Uid' => 'cm_var',
'Code_Uid' => 'line_num',
'Code_Val' => '20',
'Code_Exp' => '기본라인수',
'Code_Idx' => 1,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'cm_var',
'Group_Uid' => 'cm_var',
'Code_Uid' => 'page_num',
'Code_Val' => '5',
'Code_Exp' => '페이지 출력수',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'cm_var',
'Group_Uid' => 'cm_var',
'Code_Uid' => 'pw_len',
'Code_Val' => '6',
'Code_Exp' => '비밀번호 최소글자수',
'Code_Idx' => 4,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'common_status',
'Group_Uid' => 'common_status',
'Code_Uid' => '0',
'Code_Val' => '정지',
'Code_Exp' => '정지',
'Code_Idx' => 1,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'common_status',
'Group_Uid' => 'common_status',
'Code_Uid' => '1',
'Code_Val' => '사용',
'Code_Exp' => '사용',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'common_status',
'Group_Uid' => 'common_status',
'Code_Uid' => 'common_status',
'Code_Val' => 'common_status',
'Code_Exp' => '공통 허용상태',
'Code_Idx' => 10,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'login_result',
'Group_Uid' => 'login_result',
'Code_Uid' => '0',
'Code_Val' => '실패',
'Code_Exp' => '실패',
'Code_Idx' => 1,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'login_result',
'Group_Uid' => 'login_result',
'Code_Uid' => '1',
'Code_Val' => '성공',
'Code_Exp' => '성공',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'login_result',
'Group_Uid' => 'login_result',
'Code_Uid' => 'login_result',
'Code_Val' => 'login_result',
'Code_Exp' => '로그인결과코드',
'Code_Idx' => 5,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'mem_status',
'Group_Uid' => 'mem_status',
'Code_Uid' => '1',
'Code_Val' => '활동중',
'Code_Exp' => '활동중',
'Code_Idx' => 1,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'mem_status',
'Group_Uid' => 'mem_status',
'Code_Uid' => '2',
'Code_Val' => '승인대기',
'Code_Exp' => '승인대기',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'mem_status',
'Group_Uid' => 'mem_status',
'Code_Uid' => '3',
'Code_Val' => '정지',
'Code_Exp' => '정지',
'Code_Idx' => 3,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'mem_status',
'Group_Uid' => 'mem_status',
'Code_Uid' => 'mem_status',
'Code_Val' => 'mem_status',
'Code_Exp' => '회원승인단계',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'menu_area',
'Group_Uid' => 'menu_area',
'Code_Uid' => 'admin',
'Code_Val' => '관리자',
'Code_Exp' => '관리자',
'Code_Idx' => 4,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'menu_area',
'Group_Uid' => 'menu_area',
'Code_Uid' => 'menu_area',
'Code_Val' => 'menu_area',
'Code_Exp' => '메뉴구분',
'Code_Idx' => 6,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'menu_area',
'Group_Uid' => 'menu_area',
'Code_Uid' => 'partner',
'Code_Val' => '파트너',
'Code_Exp' => '파트너',
'Code_Idx' => 3,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'menu_area',
'Group_Uid' => 'menu_area',
'Code_Uid' => 'service',
'Code_Val' => '서비스',
'Code_Exp' => '서비스',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1000',
'Code_Val' => '회장',
'Code_Exp' => '회장',
'Code_Idx' => 1,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1010',
'Code_Val' => '사장',
'Code_Exp' => '사장',
'Code_Idx' => 2,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1020',
'Code_Val' => '부사장',
'Code_Exp' => '부사장',
'Code_Idx' => 3,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1030',
'Code_Val' => '전무이사',
'Code_Exp' => '전무이사',
'Code_Idx' => 4,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1040',
'Code_Val' => '상무이사',
'Code_Exp' => '상무이사',
'Code_Idx' => 5,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1050',
'Code_Val' => '이사',
'Code_Exp' => '이사',
'Code_Idx' => 6,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1060',
'Code_Val' => '수석',
'Code_Exp' => '수석',
'Code_Idx' => 7,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1100',
'Code_Val' => '실장',
'Code_Exp' => '실장',
'Code_Idx' => 8,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1110',
'Code_Val' => '부장',
'Code_Exp' => '부장',
'Code_Idx' => 9,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1120',
'Code_Val' => '차장',
'Code_Exp' => '차장',
'Code_Idx' => 10,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1130',
'Code_Val' => '과장',
'Code_Exp' => '과장',
'Code_Idx' => 11,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1140',
'Code_Val' => '대리',
'Code_Exp' => '대리',
'Code_Idx' => 12,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1150',
'Code_Val' => '주임',
'Code_Exp' => '주임',
'Code_Idx' => 13,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => '1160',
'Code_Val' => '사원',
'Code_Exp' => '사원',
'Code_Idx' => 14,
'Active' => 'Y'
),
Array(
'Bran_Uid' => 'position',
'Group_Uid' => 'position',
'Code_Uid' => 'position',
'Code_Val' => 'position',
'Code_Exp' => '직위',
'Code_Idx' => 4,
'Active' => 'Y'
),
);
$table_base_data['menu_list'] = Array(
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_dashboard',
'cate_code' => '0001',
'cate_name' => 'Dash Board',
'cate_data' => '/kadm/',
'cate_exp' => '서비스의 전반적인 상황을 확인 합니다.',
'cate_class' => 'bi bi-patch-plus-fill',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_mem',
'cate_code' => '0002',
'cate_name' => '회원관리',
'cate_data' => '/kadm/member/',
'cate_exp' => '',
'cate_class' => 'bi bi-people-fill',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_mem_list',
'cate_code' => '00020001',
'cate_name' => '회원리스트',
'cate_data' => '/kadm/member/member_list.php',
'cate_exp' => '',
'cate_class' => 'bi bi-person-plus-fill',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_mem_log',
'cate_code' => '00020002',
'cate_name' => '서비스페이지 로그기록',
'cate_data' => '/kadm/member/member_log_list.php',
'cate_exp' => '',
'cate_class' => 'bi bi-person-lines-fill',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_board',
'cate_code' => '0003',
'cate_name' => '게시물관리',
'cate_data' => '/kadm/board',
'cate_exp' => '',
'cate_class' => 'bi bi-list-columns-reverse',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_board_list',
'cate_code' => '00030001',
'cate_name' => '게시판관리',
'cate_data' => '/kadm/board/',
'cate_exp' => '',
'cate_class' => 'bi bi-list-task',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_board_contents',
'cate_code' => '00030002',
'cate_name' => '게시물리스트',
'cate_data' => '/kadm/board/contents_list.php',
'cate_exp' => '',
'cate_class' => 'bi bi-list-stars',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_cust',
'cate_code' => '0004',
'cate_name' => '소속관리',
'cate_data' => '/kadm/cust/',
'cate_exp' => '',
'cate_class' => 'bi bi-building',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_config',
'cate_code' => '0005',
'cate_name' => '환경설정',
'cate_data' => '/kadm/basecode',
'cate_exp' => '',
'cate_class' => 'bi bi-gear-fill',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_basecode',
'cate_code' => '00050001',
'cate_name' => '기준정보관리',
'cate_data' => '/kadm/basecode',
'cate_exp' => '',
'cate_class' => 'bi bi-tablet-landscape',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_menu',
'cate_code' => '00050002',
'cate_name' => '메뉴관리',
'cate_data' => '/kadm/menu/menu_service.php',
'cate_exp' => '',
'cate_class' => 'bi bi-diagram-3-fill',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_menu_service',
'cate_code' => '000500020001',
'cate_name' => '서비스화면',
'cate_data' => '/kadm/menu/menu_service.php',
'cate_exp' => '',
'cate_class' => 'bi bi-diagram-2-fill',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_menu_admin',
'cate_code' => '000500020002',
'cate_name' => '관리자화면',
'cate_data' => '/kadm/menu/menu_admin.php',
'cate_exp' => '',
'cate_class' => 'bi bi-diagram-2',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_auth',
'cate_code' => '00050003',
'cate_name' => '권한관리',
'cate_data' => '/kadm/auth',
'cate_exp' => '',
'cate_class' => 'bi bi-grid-3x3-gap-fill',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_auth_service',
'cate_code' => '000500030001',
'cate_name' => '서비스권한관리',
'cate_data' => '/kadm/auth/auth_service.php',
'cate_exp' => '',
'cate_class' => 'bi bi-grid',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_auth_admin',
'cate_code' => '000500030002',
'cate_name' => '관리자화면 권한관리',
'cate_data' => '/kadm/auth/auth_admin.php',
'cate_exp' => '',
'cate_class' => 'bi bi-grid-fill',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_adm',
'cate_code' => '00050004',
'cate_name' => '관리자',
'cate_data' => '/kadm/admin',
'cate_exp' => '',
'cate_class' => 'bi bi-person-video',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_adm_list',
'cate_code' => '000500040001',
'cate_name' => '관리자 리스트',
'cate_data' => '/kadm/admin/',
'cate_exp' => '',
'cate_class' => 'bi bi-person-video3',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'admin',
'cate_id' => 'mnu_adm_log',
'cate_code' => '000500040002',
'cate_name' => '관리페이지 로그기록',
'cate_data' => '/kadm/admin/member_log_list.php',
'cate_exp' => '',
'cate_class' => 'bi bi-person-video2',
'cate_auth' => '',
'cate_use' => 'Y'
),
Array(
'cate_area' => 'service',
'cate_id' => 'main',
'cate_code' => '0001',
'cate_name' => '메인화면',
'cate_data' => '/',
'cate_exp' => '',
'cate_class' => '',
'cate_auth' => '',
'cate_use' => 'Y'
),
);

View File

@ -0,0 +1,643 @@
<?php
exit;
/**
* Comment 무시됨. 컬럼 설명용.
* 하나의 DB에 여러 사이트에서 같이 사용할때 primary key는 항상 CONSTRAINT pk_... 형식으로 지정해야 .
*/
/*
[basecode]
(
Bran_Uid varchar(20) DEFAULT '' NOT NULL COMMENT '기본정보 대분류코드',
Group_Uid varchar(20) DEFAULT '' NOT NULL COMMENT '기본정보 중분류코드',
Code_Uid varchar(20) DEFAULT '' NOT NULL COMMENT '기본정보 소분류코드',
Code_Val varchar(30) DEFAULT '' NOT NULL COMMENT '기본정보 코드값',
Code_Exp varchar(50) DEFAULT '' NOT NULL COMMENT '기본정보 설명',
Code_Idx int DEFAULT 0 NOT NULL COMMENT '정렬순서',
Active varchar(1) DEFAULT 'Y' NOT NULL COMMENT '사용여부',
CONSTRAINT pk_basecode PRIMARY KEY (Bran_Uid,Group_Uid,Code_Uid)
) COMMENT='기본정보 테이블'
-end-
[member]
(
member_id varchar(20) NOT NULL DEFAULT '' COMMENT '회원ID',
member_pw varchar(150) NOT NULL DEFAULT '' COMMENT '회원비밀번호(암호화)',
member_name varchar(20) DEFAULT '' COMMENT '회원명',
member_mobile varchar(100) DEFAULT '' COMMENT '휴대폰번호(암호화)',
member_mail varchar(100) DEFAULT '' COMMENT '메일주소(암호화)',
member_certi_key varchar(100) DEFAULT '' COMMENT '본인인증키',
member_status varchar(3) NOT NULL DEFAULT '' COMMENT '회원상태',
member_auth varchar(30) NOT NULL DEFAULT '' COMMENT '회원권한',
login_count int NOT NULL DEFAULT 0 COMMENT '방문횟수',
login_ip varchar(60) DEFAULT '' COMMENT '방문아이피',
login_date datetime NOT NULL DEFAULT '' COMMENT '방문날짜',
reg_date datetime NOT NULL DEFAULT '' COMMENT '등록일',
mod_date datetime NOT NULL DEFAULT '' COMMENT '수정일',
CONSTRAINT pk_member PRIMARY KEY (member_id)
) COMMENT='회원정보'
-end-
[member_union]
(
member_id varchar(20) NOT NULL DEFAULT '' COMMENT '회원ID',
member_name varchar(20) DEFAULT '' COMMENT '회원명',
cust_id varchar(20) NOT NULL DEFAULT '' COMMENT '소속코드',
cust_name varchar(20) DEFAULT '' COMMENT '소속명',
CONSTRAINT pk_member_parts PRIMARY KEY (member_id, cust_id)
) COMMENT='회원연결테이블'
-end-
[member_log]
(
nid int IDENTITY(1,1) NOT NULL,
member_id varchar(20) NOT NULL DEFAULT '' COMMENT '회원ID',
ip_addr varchar(20) NOT NULL DEFAULT '' COMMENT 'IP어드레스',
login_page varchar(20) NOT NULL DEFAULT '' COMMENT '로그인 대상',
login_success int NOT NULL DEFAULT 0 COMMENT '성공 : 1 / 실패 : 0',
login_date datetime NOT NULL DEFAULT '' COMMENT '로그인 timestamp',
login_micro_time int NOT NULL DEFAULT 0 COMMENT '로그인 microtime',
login_security_key varchar(40) NOT NULL DEFAULT '' COMMENT '중복로그인방지릉 위한 보안키(microtime값)',
sess_file_name varchar(50) NOT NULL DEFAULT '' COMMENT '세션파일',
browser varchar(40) NOT NULL DEFAULT '' COMMENT '접속브라우저(Mo:모바일,그외 브라우저)',
con_domain varchar(40) NOT NULL DEFAULT '' COMMENT '로그인시 접속도메인',
os varchar(10) NOT NULL DEFAULT '' COMMENT '사용자OS',
os_bit varchar(10) NOT NULL DEFAULT '' COMMENT 'OS bit 32,64',
CONSTRAINT pk_mem_log PRIMARY KEY (nid)
) COMMENT='회원 로그인 로그정보'
-end-
[token_log]
(
token_nid int IDENTITY(1,1) NOT NULL,
member_id varchar(20) COMMENT '회원ID',
auth varchar(40) COMMENT '인증키',
token varchar(200) COMMENT '토큰',
valid_time int COMMENT '토큰 유효시간',
expire_time int COMMENT 'refresh 토큰 유효시간',
active char(1) COMMENT '유효토큰여부',
ip varchar(40) COMMENT '생성IP',
reg_date datetime NULL,
CONSTRAINT pk_token_log PRIMARY KEY (token_nid)
) COMMENT='토큰 로그 정보'
-end-
[visit_sess]
(
visit_sess varchar(60) NOT NULL DEFAULT '' COMMENT '방문세션',
member_id varchar(20) NOT NULL DEFAULT '' COMMENT '회원ID',
visit_sdate datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '첫조회날짜',
visit_fdate datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '마지막조회날짜',
visit_ip varchar(60) DEFAULT '' COMMENT '방문IP',
visit_total int NOT NULL DEFAULT 0 COMMENT '세션페이지 숫자',
CONSTRAINT pk_visit_sess PRIMARY KEY (visit_sess)
) COMMENT='사이트 접근 세션 기록'
-end-
[visit_log]
(
nid int IDENTITY(1,1) NOT NULL COMMENT 'nid',
visit_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '방문날짜',
visit_sess varchar(60) NOT NULL DEFAULT '' COMMENT '방문세션',
visit_type varchar(10) NOT NULL DEFAULT '' COMMENT '방문형태(사용자페이지/관리자페이지)',
cate_id varchar(40) NOT NULL DEFAULT '' COMMENT '메뉴ID',
visit_url varchar(255) NOT NULL DEFAULT '' COMMENT '방문페이지',
visit_ref varchar(255) NOT NULL DEFAULT '' COMMENT '방문REFERER',
visit_browser varchar(50) DEFAULT '' COMMENT '브라우저',
visit_os varchar(20) DEFAULT '' COMMENT '운영체제',
visit_ip varchar(60) DEFAULT '' COMMENT '방문IP',
CONSTRAINT pk_visit_log PRIMARY KEY (nid)
) COMMENT='전체 페이지 조회기록'
-end-
[visit_sess_count]
(
visit_date date NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '방문날짜',
visit_week int NOT NULL DEFAULT 0 COMMENT '요일',
visit_type varchar(10) NOT NULL DEFAULT '' COMMENT '방문형태(사용자페이지/관리자페이지)',
visit_total int NOT NULL DEFAULT 0 COMMENT '일별방문자합계',
h00 int NOT NULL DEFAULT 0 COMMENT '0~1시 방문자',
h01 int NOT NULL DEFAULT 0 COMMENT '1~2시 방문자',
h02 int NOT NULL DEFAULT 0 COMMENT '2~3시 방문자',
h03 int NOT NULL DEFAULT 0 COMMENT '3~4시 방문자',
h04 int NOT NULL DEFAULT 0 COMMENT '4~5시 방문자',
h05 int NOT NULL DEFAULT 0 COMMENT '5~6시 방문자',
h06 int NOT NULL DEFAULT 0 COMMENT '6~7시 방문자',
h07 int NOT NULL DEFAULT 0 COMMENT '7~8시 방문자',
h08 int NOT NULL DEFAULT 0 COMMENT '8~9시 방문자',
h09 int NOT NULL DEFAULT 0 COMMENT '9~10시 방문자',
h10 int NOT NULL DEFAULT 0 COMMENT '10~11시 방문자',
h11 int NOT NULL DEFAULT 0 COMMENT '11~12시 방문자',
h12 int NOT NULL DEFAULT 0 COMMENT '12~13시 방문자',
h13 int NOT NULL DEFAULT 0 COMMENT '13~14시 방문자',
h14 int NOT NULL DEFAULT 0 COMMENT '14~15시 방문자',
h15 int NOT NULL DEFAULT 0 COMMENT '15~16시 방문자',
h16 int NOT NULL DEFAULT 0 COMMENT '16~17시 방문자',
h17 int NOT NULL DEFAULT 0 COMMENT '17~18시 방문자',
h18 int NOT NULL DEFAULT 0 COMMENT '18~19시 방문자',
h19 int NOT NULL DEFAULT 0 COMMENT '19~20시 방문자',
h20 int NOT NULL DEFAULT 0 COMMENT '20~21시 방문자',
h21 int NOT NULL DEFAULT 0 COMMENT '21~22시 방문자',
h22 int NOT NULL DEFAULT 0 COMMENT '22~23시 방문자',
h23 int NOT NULL DEFAULT 0 COMMENT '23~24시 방문자',
CONSTRAINT pk_visit_sess_count PRIMARY KEY (visit_date, visit_type)
) COMMENT='사이트 접근 세션 카운트'
-end-
[visit_log_count]
(
visit_date date NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '방문날짜',
visit_week int NOT NULL DEFAULT 0 COMMENT '요일',
visit_type varchar(10) NOT NULL DEFAULT '' COMMENT '방문형태(사용자페이지/관리자페이지)',
visit_total int NOT NULL DEFAULT 0 COMMENT '일별페이지뷰합계',
h00 int NOT NULL DEFAULT 0 COMMENT '0~1시 페이지뷰',
h01 int NOT NULL DEFAULT 0 COMMENT '1~2시 페이지뷰',
h02 int NOT NULL DEFAULT 0 COMMENT '2~3시 페이지뷰',
h03 int NOT NULL DEFAULT 0 COMMENT '3~4시 페이지뷰',
h04 int NOT NULL DEFAULT 0 COMMENT '4~5시 페이지뷰',
h05 int NOT NULL DEFAULT 0 COMMENT '5~6시 페이지뷰',
h06 int NOT NULL DEFAULT 0 COMMENT '6~7시 페이지뷰',
h07 int NOT NULL DEFAULT 0 COMMENT '7~8시 페이지뷰',
h08 int NOT NULL DEFAULT 0 COMMENT '8~9시 페이지뷰',
h09 int NOT NULL DEFAULT 0 COMMENT '9~10시 페이지뷰',
h10 int NOT NULL DEFAULT 0 COMMENT '10~11시 페이지뷰',
h11 int NOT NULL DEFAULT 0 COMMENT '11~12시 페이지뷰',
h12 int NOT NULL DEFAULT 0 COMMENT '12~13시 페이지뷰',
h13 int NOT NULL DEFAULT 0 COMMENT '13~14시 페이지뷰',
h14 int NOT NULL DEFAULT 0 COMMENT '14~15시 페이지뷰',
h15 int NOT NULL DEFAULT 0 COMMENT '15~16시 페이지뷰',
h16 int NOT NULL DEFAULT 0 COMMENT '16~17시 페이지뷰',
h17 int NOT NULL DEFAULT 0 COMMENT '17~18시 페이지뷰',
h18 int NOT NULL DEFAULT 0 COMMENT '18~19시 페이지뷰',
h19 int NOT NULL DEFAULT 0 COMMENT '19~20시 페이지뷰',
h20 int NOT NULL DEFAULT 0 COMMENT '20~21시 페이지뷰',
h21 int NOT NULL DEFAULT 0 COMMENT '21~22시 페이지뷰',
h22 int NOT NULL DEFAULT 0 COMMENT '22~23시 페이지뷰',
h23 int NOT NULL DEFAULT 0 COMMENT '23~24시 페이지뷰',
CONSTRAINT pk_visit_log_count PRIMARY KEY (visit_date, visit_type)
) COMMENT='전체 페이지 조회카운트'
-end-
[query_log]
(
query_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '실행일자',
query_result varchar(1000) DEFAULT '' COMMENT '실행결과(성공여부)',
host_name varchar(30) DEFAULT '' COMMENT '대상HOST',
db_name varchar(50) DEFAULT '' COMMENT '대상DB',
query_string varchar(max) DEFAULT '' COMMENT '쿼리내용',
query_params varchar(max) DEFAULT '' COMMENT 'Params',
visit_sess varchar(60) DEFAULT '' COMMENT '방문세션',
member_id varchar(20) DEFAULT '' COMMENT '회원ID',
CONSTRAINT pk_query_log PRIMARY KEY (query_date)
) COMMENT='쿼리 로그'
-end-
[category]
(
cate_area varchar(20) NOT NULL DEFAULT '' COMMENT '카테고리 구분',
cate_id varchar(40) NOT NULL COMMENT '카테고리 ID',
cate_code varchar(20) NOT NULL DEFAULT '' COMMENT '카테고리 정렬코드',
cate_name varchar(60) NOT NULL DEFAULT '' COMMENT '카테고리명',
cate_data varchar(200) COMMENT '카테고리 데이터',
cate_exp text COMMENT '카테고리 설명',
cate_class varchar(40) NOT NULL DEFAULT '' COMMENT 'style용 css',
cate_auth varchar(40) COMMENT '조회권한',
cate_use varchar(2) COMMENT '조회',
CONSTRAINT pk_category PRIMARY KEY (cate_area, cate_id)
) COMMENT='각종 분류 테이블'
-end-
[menu_list]
(
cate_area varchar(20) NOT NULL DEFAULT '' COMMENT '카테고리 구분',
cate_id varchar(40) NOT NULL COMMENT '카테고리 ID',
cate_code varchar(20) NOT NULL DEFAULT '' COMMENT '카테고리 정렬코드',
cate_name varchar(60) NOT NULL DEFAULT '' COMMENT '카테고리명',
cate_data varchar(200) COMMENT '카테고리 데이터. 현재는 filepath 로 cate_id로 제어하지 않을경우 해당path 에 권한 적용을 위해 사용',
cate_exp text COMMENT '카테고리 설명',
cate_class varchar(40) NOT NULL DEFAULT '' COMMENT 'style용 css',
cate_auth varchar(40) COMMENT '조회권한',
cate_use varchar(2) COMMENT '조회',
CONSTRAINT pk_menu_list PRIMARY KEY (cate_area, cate_id)
) COMMENT='메뉴 테이블'
-end-
[menu_auth_page]
(
cate_area varchar(20) NOT NULL DEFAULT '' COMMENT '카테고리 구분',
cate_id varchar(40) NOT NULL COMMENT '카테고리 ID',
filepath varchar(200) COMMENT '권한이 적용될 파일경로',
CONSTRAINT pk_menu_auth_page PRIMARY KEY (cate_area, cate_id)
) COMMENT='메뉴 테이블의 cate_data 의 확장. 여러 파일을 path에 권한을 적용 할경우 사용'
-end-
[auth_manage]
(
cate_area varchar(20) NOT NULL DEFAULT '' COMMENT '기능(메뉴) 분류',
cate_id varchar(40) NOT NULL DEFAULT '' COMMENT '기능(메뉴) 코드 또는 ID',
auth_area varchar(20) COMMENT '대상 분류 그룹(그룹코드) 개인(NULL)',
auth_target varchar(20) NOT NULL DEFAULT '' COMMENT '대상 코드 또는 ID',
auth int NOT NULL DEFAULT 0 COMMENT '권한 2진 111 총 8권한조합 1(수정/삭제)1(쓰기)1(읽기)',
reg_date datetime NOT NULL DEFAULT '' COMMENT '등록일',
mod_date datetime NOT NULL DEFAULT '' COMMENT '수정일',
mod_id varchar(20) DEFAULT '' COMMENT '수정ID',
CONSTRAINT pk_auth_manage PRIMARY KEY (cate_area, cate_id, auth_area, auth_target)
) COMMENT='권한 관리 테이블'
-end-
[cust_list]
(
cust_id varchar(20) NOT NULL COMMENT '소속코드',
cust_name varchar(20) NOT NULL COMMENT '소속명',
cust_fullname varchar(100) DEFAULT '' COMMENT '소속명2',
cust_charger varchar(20) DEFAULT '' COMMENT '담당자',
cust_phone varchar(100) DEFAULT '' COMMENT '대표연락처',
cust_mail varchar(100) DEFAULT '' COMMENT '대표메일주소',
cust_token varchar(100) DEFAULT '' COMMENT '소속관련API용토큰',
cust_db_host varchar(40) DEFAULT '' COMMENT '필요시 DB정보(주소)',
cust_db_port varchar(10) DEFAULT '' COMMENT '필요시 DB정보(포트)',
cust_db_name varchar(20) DEFAULT '' COMMENT '필요시 DB정보(DB명)',
cust_db_user varchar(20) DEFAULT '' COMMENT '필요시 DB정보(DB유저)',
cust_db_pass varchar(100) DEFAULT '' COMMENT '필요시 DB정보(DB비번-암호화)',
cust_status varchar(3) DEFAULT '' COMMENT '허용여부-로그인에 적용',
cust_active varchar(3) DEFAULT '' COMMENT '사용여부(삭제)',
reg_date datetime NOT NULL DEFAULT '' COMMENT '등록일',
mod_date datetime NOT NULL DEFAULT '' COMMENT '수정일',
mod_id varchar(20) DEFAULT '' COMMENT '수정ID',
CONSTRAINT pk_cust_list PRIMARY KEY (cust_id)
) COMMENT='소속 관리 테이블'
-end-
[board_list]
(
board_id varchar(20) DEFAULT '' COMMENT '게시판코드',
board_name varchar(40) DEFAULT '' COMMENT '게시판명',
board_admin varchar(100) DEFAULT '' COMMENT '게시판 관리자 id',
board_cate varchar(20) DEFAULT '' COMMENT '카테고리',
mem_type varchar(20) NOT NULL DEFAULT '' COMMENT '사용권한',
read_level varchar(20) NOT NULL DEFAULT '' COMMENT '읽기권한',
write_level varchar(20) NOT NULL DEFAULT '' COMMENT '쓰기권한',
ness_name varchar(2) COMMENT '필수항목(이름)',
ness_passwd varchar(2) COMMENT '필수항목(비밀번호)',
ness_title varchar(2) COMMENT '필수항목(제목)',
ness_homepage varchar(2) COMMENT '필수항목(홈페이지)',
ness_mail varchar(2) COMMENT '필수항목(메일)',
ness_contents varchar(2) COMMENT '필수항목(내용)',
ness_image varchar(2) COMMENT '필수항목(이미지)',
ness_file varchar(2) COMMENT '필수항목(파일)',
use_opinion varchar(2) DEFAULT '' COMMENT '의견글사용',
use_spamproof varchar(2) DEFAULT '' COMMENT '스팸방지 사용',
use_webeditor varchar(20) DEFAULT '' COMMENT '웹에디터사용/종류',
line_num varchar(2) DEFAULT '' COMMENT '페이지당 라인수',
page_num varchar(2) DEFAULT '' COMMENT '하단 페이지수',
new_num int NOT NULL DEFAULT 0 COMMENT '최신글 날짜',
hot_num int NOT NULL DEFAULT 0 COMMENT '인기글 횟수',
skin_name varchar(20) DEFAULT '' COMMENT '스킨',
CONSTRAINT pk_board_list PRIMARY KEY (board_id)
) COMMENT='게시판리스트'
-end-
[board_contents]
(
board_id varchar(20) NOT NULL COMMENT '게시판코드',
cid int IDENTITY (1, 1) NOT NULL COMMENT '게시물코드',
gubun text COMMENT '분류',
title varchar(200) DEFAULT '' COMMENT '제목',
contents text DEFAULT '' COMMENT '내용',
notice varchar(2) DEFAULT '' COMMENT '1:공지로 게시',
views int NOT NULL DEFAULT 0 COMMENT '조회수',
good int NOT NULL DEFAULT 0 COMMENT '추천',
nogood int NOT NULL DEFAULT 0 COMMENT '비추천',
onum int NOT NULL DEFAULT 0 COMMENT '의견글 숫자',
secret varchar(2) DEFAULT 0 COMMENT '비밀글',
markup varchar(2) DEFAULT 0 COMMENT '마크업언어종류',
state varchar(2) DEFAULT '1' COMMENT '상태/출력여부',
member_id varchar(20) DEFAULT '' COMMENT '아이디',
uname varchar(20) DEFAULT '' COMMENT '작성자',
passwd varchar(100) DEFAULT '' COMMENT '비밀번호',
homepage varchar(100) DEFAULT '' COMMENT '홈페이지',
mail varchar(100) DEFAULT '' COMMENT '이메일',
mobile varchar(100) DEFAULT '' COMMENT '모바일',
ip_addr varchar(40) NOT NULL DEFAULT '' COMMENT 'IP주소',
reg_date datetime NOT NULL DEFAULT '' COMMENT '등록일시',
mod_date datetime NOT NULL DEFAULT '' COMMENT '수정일시',
CONSTRAINT pk_board_contents PRIMARY KEY (board_id, cid)
) COMMENT='게시물 내용'
-end-
[board_opinion]
(
board_id varchar(20) NOT NULL COMMENT '게시판코드',
cid int NOT NULL DEFAULT 0 COMMENT '게시물 코드',
oid int IDENTITY (1, 1) NOT NULL COMMENT '의견글 코드',
uid int NOT NULL DEFAULT 0 COMMENT '상위 nid',
idx text NOT NULL COMMENT '게시물 정렬',
opinion text NOT NULL COMMENT '내용',
good int NOT NULL DEFAULT 0 COMMENT '추천',
nogood int NOT NULL DEFAULT 0 COMMENT '비추천',
state varchar(2) DEFAULT '' COMMENT '상태/출력여부',
member_id varchar(20) DEFAULT '' COMMENT '관리자아이디',
uname varchar(20) DEFAULT '' COMMENT '작성자',
passwd varchar(100) DEFAULT '' COMMENT '비밀번호',
ip_addr varchar(40) NOT NULL DEFAULT '' COMMENT 'IP주소',
reg_date datetime NOT NULL DEFAULT '' COMMENT '등록일시',
mod_date datetime NOT NULL DEFAULT '' COMMENT '수정일시',
CONSTRAINT pk_board_opinion PRIMARY KEY (board_id, cid, oid)
) COMMENT='게시물 의견글'
-end-
[board_attach]
(
board_id varchar(20) NOT NULL COMMENT '게시판코드',
cid int NOT NULL DEFAULT 0 COMMENT '게시물 코드',
aid int IDENTITY (1, 1) NOT NULL COMMENT '첨부파일 코드',
gubun varchar(20) NOT NULL DEFAULT '' COMMENT '분류',
file_name varchar(255) NOT NULL DEFAULT '' COMMENT '파일명',
file_size int NOT NULL DEFAULT 0 COMMENT '파일사이즈',
file_type varchar(30) NOT NULL DEFAULT '' COMMENT '파일형식',
file_width int NOT NULL DEFAULT 0 COMMENT '넓이',
file_height int NOT NULL DEFAULT 0 COMMENT '높이',
reg_date datetime NOT NULL DEFAULT '' COMMENT '등록일',
CONSTRAINT pk_board_attach PRIMARY KEY (board_id, cid, aid)
) COMMENT='게시물 첨부파일'
-end-
[attach_list]
(
file_id int IDENTITY (1, 1) NOT NULL COMMENT '파일 id 무작',
gubun varchar(20) NOT NULL DEFAULT '' COMMENT '소속분류',
nid varchar(20) NOT NULL DEFAULT '' COMMENT '소속 메인코드',
sid varchar(30) NOT NULL DEFAULT '' COMMENT '소속 서브코드',
file_name varchar(255) NOT NULL DEFAULT '' COMMENT '파일명',
file_size int NOT NULL DEFAULT '0' COMMENT '파일사이즈',
file_type varchar(30) NOT NULL DEFAULT '' COMMENT '파일형식',
file_width int NOT NULL DEFAULT '0' COMMENT '넓이',
file_height int NOT NULL DEFAULT '0' COMMENT '높이',
file_exp varchar(100) NOT NULL DEFAULT '0' COMMENT '추가텍스트',
reg_date datetime NOT NULL DEFAULT '' COMMENT '등록일',
CONSTRAINT pk_attach_filelist PRIMARY KEY (file_id),
CONSTRAINT ik_attach_filelist UNIQUE (gubun, nid, sid)
) COMMENT='웹에디터용 이외의 첨부 파일 관리'
-end-
[recv_list]
(
recv_id int IDENTITY (1, 1) NOT NULL COMMENT 'nid',
send_ip varchar(40) DEFAULT '' COMMENT '발신IP',
recv_method varchar(20) DEFAULT '' COMMENT '수신Method',
recv_url varchar(500) DEFAULT '' COMMENT '수신URL',
recv_data varchar(5000) DEFAULT '' COMMENT '수신데이터',
recv_raw varchar(5000) DEFAULT '' COMMENT '수신데이터raw',
recv_post varchar(5000) DEFAULT '' COMMENT '수신데이터post',
recv_get varchar(5000) DEFAULT '' COMMENT '수신데이터get',
recv_all varchar(5000) DEFAULT '' COMMENT '수신전문',
reg_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '등록일'
CONSTRAINT pk_recv_list PRIMARY KEY (recv_id)
) COMMENT='API 수신정보 테이블'
-end-
//------------Steel Korea--------------
[B_BIZ_PARTNER]
(
BP_CD varchar(20) NOT NULL COMMENT '거래처코드',
BP_NM nvarchar(50) NOT NULL COMMENT '거래처명',
BP_FULL_NM nvarchar(50) NULL COMMENT '거래처전체명',
BIZ_TYPE nvarchar(50) NULL COMMENT '업종',
BIZ_ITEM nvarchar(50) NULL COMMENT '업태',
BIZ_REG_NO varchar(10) NULL COMMENT '사업자등록번호',
REPRESN_NM nvarchar(50) NULL COMMENT '대표자명',
RES_REG_NO varchar(50) NULL COMMENT '주민번호',
ZIP_CD varchar(20) NULL COMMENT '우편번호',
ADDR1 nvarchar(100) NULL COMMENT '주소1',
ADDR2 nvarchar(100) NULL COMMENT '주소2',
NAT_CD varchar(3) NULL COMMENT '국가',
CURRENCY_CD varchar(3) NULL COMMENT '거래화폐',
TEL_NO varchar(20) NULL COMMENT '전화번호',
FAX_NO varchar(20) NULLV COMMENT '팩스번호',
PUR_FLG varchar(1) DEFAULT 'Y' NOT NULL COMMENT '매입처구분',
SAL_FLG varchar(1) DEFAULT 'Y' NOT NULL COMMENT '매출처구분',
BP_TYPE varchar(1) DEFAULT 'N' NOT NULL COMMENT '자사구분',
USE_FLG varchar(1) DEFAULT 'Y' NOT NULL COMMENT '사용여부',
REMK nvarchar(100) NULL COMMENT '비고',
MAKE_USER_ID varchar(50) NULL COMMENT '등록자',
MAKE_TM datetime NULL COMMENT '등록시간',
EDIT_USER_ID varchar(50) NULL COMMENT '수정자',
EDIT_TM datetime NULL COMMENT '수정시간',
CONSTRAINT PK_B_BIZ_PARTNER PRIMARY KEY (BP_CD)
)
-end-
[B_BIZ_PARTNER_PRSN]
(
BP_PRSN_ID varchar(20) NOT NULL COMMENT '담당자아이디',
BP_CD varchar(20) NOT NULL COMMENT '거래처코드',
BP_PRSN_NM nvarchar(50) NOT NULL COMMENT '담당자명',
BP_PRSN_EMAIL varchar(50) NULL COMMENT '담당자이메일',
BP_PRSN_TEL_NO varchar(20) NULL COMMENT '담당자전화번호',
BP_PRSN_CELL_NO varchar(20) NULL COMMENT '담당자휴대폰번호',
BP_PRSN_FAX_NO varchar(20) NULL COMMENT '담당자팩스번호',
REMK nvarchar(100) NULL COMMENT '비고',
USE_FLG varchar(1) NOT NULL COMMENT '사용여부',
MAKE_USER_ID varchar(50) NULL COMMENT '등록자',
MAKE_TM datetime NULL COMMENT '등록시간',
EDIT_USER_ID varchar(50) NULL COMMENT '수정자',
EDIT_TM datetime NULL COMMENT '수정시간',
CONSTRAINT PK_B_BIZ_PARTNER_PRSN PRIMARY KEY (BP_PRSN_ID),
CONSTRAINT FK_B_BIZ_PARTNER_PRSN_B_BIZ_PARTNER FOREIGN KEY (BP_CD) REFERENCES SKMESDB.dbo.B_BIZ_PARTNER(BP_CD)
)
-end-
[B_MOBILE_FACT]
(
MOF_CD varchar(20) NOT NULL COMMENT '단말기코드',
MOF_NM varchar(50) NOT NULL COMMENT '단말기명',
MOF_MF varchar(50) NULL COMMENT '제조사',
PUR_NM varchar(20) NULL COMMENT '반입처',
PUR_DATE date NULL COMMENT '등록일',
MAJR_EMP_NO varchar(20) NULL COMMENT '담당자(정)',
MINR_EMP_NO varchar(20) NULL COMMENT '담당자(부)',
USE_FLG varchar(1) NULL COMMENT '사용여부',
MAKE_USER_ID varchar(50) NULL COMMENT '등록자',
MAKE_TM datetime NULL COMMENT '등록시간',
EDIT_USER_ID varchar(50) NULL COMMENT '수정자',
EDIT_TM datetime NULL COMMENT '수정시간',
CONSTRAINT PK_B_MOBILE_FACT PRIMARY KEY (MOF_CD)
)
-end-
[B_JIG]
(
JIG_CD varchar(20) NOT NULL COMMENT '치공구코드',
JIG_NM varchar(50) NOT NULL COMMENT '치공구명',
JIG_MODEL varchar(50) NOT NULL COMMENT '치공구규격/모델',
JIG_NUM varchar(50) NULL COMMENT '수량',
JIG_MF varchar(50) NULL COMMENT '제조사',
PUR_NM varchar(20) NULL COMMENT '구입처',
PUR_PRICE varchar(20) NULL COMMENT '구입가격',
PUR_DATE date NULL COMMENT '구입일',
USE_FLG varchar(1) NULL COMMENT '사용여부',
MAKE_USER_ID varchar(50) NULL COMMENT '등록자',
MAKE_TM datetime NULL COMMENT '등록시간',
EDIT_USER_ID varchar(50) NULL COMMENT '수정자',
EDIT_TM datetime NULL COMMENT '수정시간',
CONSTRAINT PK_B_JIG PRIMARY KEY (JIG_CD)
)
-end-
[B_JIG_HST]
(
JIG_REF_CD varchar(20) NOT NULL COMMENT '수리코드',
JIG_CD varchar(20) NOT NULL COMMENT '치공구코드',
JIG_REASON varchar(50) NULL COMMENT '이상내용',
JIG_REPAIR varchar(50) NULL COMMENT '수리내용',
JIG_ADATE date NULL COMMENT '조치일',
JIG_A_EMP_NO varchar(50) NULL COMMENT '조치자',
JIG_ODATE date NULL COMMENT '반출일',
JIG_IDATE date NULL COMMENT '반입일',
REMK varchar(MAX) NULL COMMENT '비고',
USE_FLG varchar(1) NULL COMMENT '사용여부',
MAKE_USER_ID varchar(50) NULL COMMENT '등록자',
MAKE_TM datetime NULL COMMENT '등록시간',
EDIT_USER_ID varchar(50) NULL COMMENT '수정자',
EDIT_TM datetime NULL COMMENT '수정시간',
CONSTRAINT PK_B_JIG_HST PRIMARY KEY (JIG_REF_CD)
)
-end-
[B_COMMENT]
(
TRAN_ID int IDENTITY (1, 1) NOT NULL COMMENT '코멘트코드',
TRAN_TEXT varchar(200) NOT NULL COMMENT '한글',
TRAN_DATA text NULL COMMENT '번역문',
MAKE_TM datetime null,
EDIT_TM datetime null,
CONSTRAINT PK_B_COMMENT PRIMARY KEY (TRAN_ID),
)
-end-
[B_COMMENT_LANG]
(
LANG_ID varchar(3) NOT NULL COMMENT '언어코드',
LANG_NM varchar(20) NOT NULL COMMENT '언어명',
USE_FLG varchar(1) NULL COMMENT '사용여부',
MAKE_TM datetime null,
EDIT_TM datetime null,
CONSTRAINT PK_B_COMMENT_LANG PRIMARY KEY (LANG_ID),
)
-end-
[S_EST_HDR]
(
EST_ID varchar(20) NOT NULL COMMENT '견적코드',
EST_UID varchar(50) NULL COMMENT '사용자견적번호',
EST_TITLE nvarchar(100) NOT NULL DEFAULT '' COMMENT '견적타이틀',
BP_CD varchar(20) NULL COMMENT '거래처코드',
BP_NM nvarchar(50) NULL COMMENT '거래처명',
BP_PRSN_ID varchar(100) NULL COMMENT '거래처담당자',
BP_PRSN_NM nvarchar(100) NULL COMMENT '거래처담당자명',
BP_PRSN_TEL varchar(100) NULL COMMENT '거래처담당자연락처',
EST_DATE date NULL COMMENT '견적일자',
EMP_NO varchar(20) NULL COMMENT '담당자코드',
EMP_NM nvarchar(50) NULL COMMENT '담당자명',
EMP_TEL nvarchar(50) NULL COMMENT '담당자연락처',
EST_AMT numeric NULL COMMENT '견적금액',
EST_TAX varchar(30) NULL COMMENT '부가세',
EST_TEXT varchar(max) NULL COMMENT '견적내용',
EST_TEST_EXP varchar(100) NULL COMMENT '검사비',
EST_PACK_EXP varchar(100) NULL COMMENT '포장비',
EST_EXP_DAYS varchar(20) NULL COMMENT '견적유효기간',
EST_DEL_LIMT varchar(20) NULL COMMENT '납기',
EST_TRAN_COND varchar(20) NULL COMMENT '운송조건',
EST_PAY_COND varchar(20) NULL COMMENT '지불조건',
EST_SUP_COND varchar(20) NULL COMMENT '공급조건',
EST_ETC varchar(max) NULL COMMENT '특기사항',
SCS_FLG varchar(1) NULL COMMENT '체결여부',
USE_FLG varchar(1) NULL COMMENT '사용여부',
MAKE_USER_ID varchar(50) NULL COMMENT '등록자',
MAKE_TM datetime NULL COMMENT '등록시간',
EDIT_USER_ID varchar(50) NULL COMMENT '수정자',
EDIT_TM datetime NULL COMMENT '수정시간',
CONSTRAINT PK_S_EST_HDR PRIMARY KEY (EST_ID),
)
-end-
[S_EST_DETAIL]
(
EST_ID varchar(20) NOT NULL COMMENT '견적코드',
EST_DTL_ID int IDENTITY (1, 1) NOT NULL COMMENT '견적상세코드',
EST_DTL_SEQ varchar(3) NULL COMMENT '순번',
EST_DTL_ITEM varchar(100) NULL COMMENT '품명',
EST_DTL_SPEC varchar(100) NULL COMMENT '규격',
EST_DTL_MATR varchar(20) NULL COMMENT '재질',
EST_DTL_EA int NULL COMMENT '수량',
EST_DTL_WGT numeric NULL COMMENT '중량',
EST_DTL_PRC numeric NULL COMMENT '단가',
EST_DTL_AMT numeric NULL COMMENT '금액',
USE_FLG varchar(1) NULL COMMENT '사용여부',
MAKE_USER_ID varchar(50) NULL COMMENT '등록자',
MAKE_TM datetime NULL COMMENT '등록시간',
EDIT_USER_ID varchar(50) NULL COMMENT '수정자',
EDIT_TM datetime NULL COMMENT '수정시간',
CONSTRAINT PK_S_EST_DETAIL PRIMARY KEY (EST_ID, EST_DTL_ID),
)
-end-
[Z_API_REC]
(
api_id int IDENTITY (1, 1) NOT NULL COMMENT 'API등록코드',
logDt datetime NULL COMMENT '등록시간',
useSe varchar(20) NULL COMMENT '사용구분',
sysUser varchar(20) NULL COMMENT '사용자',
conectIp varchar(40) NULL COMMENT '요청IP',
dataUsgqty int NULL COMMENT '데이터크기',
recptnDt datetime NULL COMMENT '수신시간',
recptnRsltCd varchar(20) NULL COMMENT '결과코드',
recptnRslt varchar(30) NULL COMMENT '결과내용',
recptnRsltDtl varchar(255) NULL COMMENT '결과상세',
CONSTRAINT pk_Z_API_REC PRIMARY KEY (API_ID),
)
-end-
[Z_NUMBERING_RULE]
(
NUM_ID varchar(20) not null,
NUM_SEQNO int not null,
DISP_SEQ int not null,
COLUMN_ID varchar(50) null,
FORMAT_STR varchar(255) null,
DISP_TYPE varchar(1) null,
START_POS int null,
SEL_LEN int null,
INCRE_STEP int null,
INCRE_SEED int null,
CONV_FUNC varchar(1) null,
REMK nvarchar(500) null,
MAKE_TM datetime null,
MAKE_USER_ID varchar(50) null,
EDIT_TM datetime null,
EDIT_USER_ID varchar(50) null,
CONSTRAINT PK_Z_NUMBERING_RULE PRIMARY KEY (NUM_ID, NUM_SEQNO)
)
-end-
[Z_NUMBERING_HST]
(
NUM_ID varchar(20) not null,
PREFIX_DATA varchar(255) not null,
LAST_AUTOSEQ numeric null,
MAKE_TM datetime null,
MAKE_USER_ID varchar(50) null,
EDIT_TM datetime null,
EDIT_USER_ID varchar(50) null,
CONSTRAINT PK_Z_NUMBERING_HST PRIMARY KEY (NUM_ID, PREFIX_DATA)
)
-end-
*/

41
config/table_config.php Normal file
View File

@ -0,0 +1,41 @@
<?php
define("TB_HEAD", "ZB_");
define("TB_basecode", TB_HEAD."basecode");
define("TB_member", TB_HEAD."member");
define("TB_member_union", TB_HEAD."member_union");
define("TB_member_log", TB_HEAD."member_log");
define("TB_cate", TB_HEAD."category");
define("TB_menu_list", TB_HEAD."menu_list");
define("TB_menu_auth_page", TB_HEAD."menu_auth_page");
define("TB_auth_manage", TB_HEAD."auth_manage");
define("TB_cust_list", TB_HEAD."cust_list");
define("TB_board_list", TB_HEAD."board_list");
define("TB_board_contents", TB_HEAD."board_contents");
define("TB_board_attach", TB_HEAD."board_attach");
define("TB_board_opinion", TB_HEAD."board_opinion");
define("TB_attach_list", TB_HEAD."attach_list");
define("TB_recv_list", TB_HEAD."recv_list");
define("TB_token_log", TB_HEAD."token_log");
define("TB_visit_sess", TB_HEAD."visit_sess");
define("TB_visit_log", TB_HEAD."visit_log");
define("TB_query_log", TB_HEAD."query_log");
define("TB_visit_sess_count", TB_HEAD."visit_sess_count");
define("TB_visit_log_count", TB_HEAD."visit_log_count");
define("TB_biz_partner", "B_BIZ_PARTNER");
define("TB_biz_partner_prsn", "B_BIZ_PARTNER_PRSN");
define("TB_MOBILE_FACT", "B_MOBILE_FACT");
define("TB_JIG", "B_JIG");
define("TB_JIG_HST", "B_JIG_HST");
define("TB_COMMENT", "B_COMMENT");
define("TB_COMMENT_LANG", "B_COMMENT_LANG");
define("TB_numbering_rule", "Z_NUMBERING_RULE");
define("TB_numbering_hist", "Z_NUMBERING_HST");
define("TB_API_REC", "Z_API_REC");
define("TB_estimate", "S_EST_HDR");
define("TB_estimate_detail", "S_EST_DETAIL");
define("TB_schema_file", _CONF_PATH_ ."/info_table_schema.php"); //정의된 테이블 스키마 파일
define("TB_data_file", _CONF_PATH_ ."/info_table_data.php"); //기본 데이터 파일

153
lib/app/attach.class.php Normal file
View File

@ -0,0 +1,153 @@
<?php
class Attach extends Cmanage {
function __construct( $table ){
parent::__construct($table);
$this->DB->query_record = false; //query log 기록 금지
$this->DB->tableExists($this->TB);
}
public function getAttachList($fields, $gubun, $nid="", $orderby=""){
$where = new DB_where("and");
if( $gubun ){
$where->add("gubun = ?", $gubun);
}
if( $nid ){
$where->add("nid = ?", $nid);
}
$orderby=$orderby?:"file_id desc";
$limit=array();
$rows = $this->getDataList($fields, $where, $orderby, $limit);
for( $a=0 ; $a<count($rows) ; $a++ ){
$rows[$a]['file_url'] = _SITE_INC_URL_."/getFile.php?gubun={$rows[$a]['gubun']}&nid={$rows[$a]['nid']}&sid={$rows[$a]['sid']}";
}
return $rows;
}
public function getAttach( $gubun, $nid, $sid ){
$whererow = Array(
"gubun" => $gubun,
"nid" => $nid,
"sid" => $sid,
);
$row = $this->getData("*", $whererow);
$row['file_url'] = _SITE_INC_URL_."/getFile.php?gubun={$row['gubun']}&nid={$row['nid']}&sid={$row['sid']}";
return $row;
}
public function getAttachId( $file_id ) {
$whererow = Array(
"file_id" => $file_id,
);
$row = $this->getData("*", $whererow);
$row['file_url'] = _SITE_INC_URL_."/getFile.php?gubun={$row['gubun']}&nid={$row['nid']}&sid={$row['sid']}";
return $row;
}
public function putAttach( $upfile, $gubun, $nid, $sid ) {
$target_dir = _UP_PATH_."/{$gubun}";
if( !file_exists($target_dir) ){
mkdir($target_dir);
}
$rst = move_uploaded_file($upfile['tmp_name'], "{$target_dir}/{$nid}_{$sid}.dat");
if( !$rst ) return false;
if( strpos($upfile['type'], "image") !== false ){
$iinfo = getimagesize("{$target_dir}/{$nid}_{$sid}.dat");
$upfile['width'] = $iinfo[0];
$upfile['height'] = $iinfo[1];
}
$sqldata = Array(
"gubun" => $gubun?:"",
"nid" => $nid?:"",
"sid" => $sid?:"",
"file_name" => $upfile['name']?:"",
"file_size" => $upfile['size']?:0,
"file_type" => $upfile['type']?:"",
"file_width" => $upfile['width']?:"",
"file_height" => $upfile['height']?:"",
"reg_date" => $this->DB->sqleval("getdate()"),
);
return $this->putData( $sqldata );
}
public function setAttach( $upfile, $gubun, $nid, $sid ) {
$target_dir = _UP_PATH_."/{$gubun}";
if( !file_exists($target_dir) ){
mkdir($target_dir);
}
$rst = move_uploaded_file($upfile['tmp_name'], "{$target_dir}/{$nid}_{$sid}.dat");
if( !$rst ) return false;
if( strpos($upfile['type'], "image") !== false ){
$iinfo = getimagesize("{$target_dir}/{$nid}_{$sid}.dat");
$upfile['width'] = $iinfo[0];
$upfile['height'] = $iinfo[1];
}
$sqldata = Array(
"gubun" => $gubun?:"",
"nid" => $nid?:"",
"sid" => $sid?:"",
"file_name" => $upfile['name']?:"",
"file_size" => $upfile['size']?:0,
"file_type" => $upfile['type']?:"",
"file_width" => $upfile['width']?:"",
"file_height" => $upfile['height']?:"",
"reg_date" => $this->DB->sqleval("getdate()"),
);
$whererow = Array(
"gubun" => $gubun?:"",
"nid" => $nid?:"",
"sid" => $sid?:"",
);
return $this->setData( $sqldata, $whererow );
}
public function setAttachId( $upfile, $file_id ) {
$ainfo = $this->getAttachId( $file_id );
if( !$ainfo['file_id'] ) return false;
return $this->setAttach( $upfile, $ainfo['gubun'], $ainfo['nid'], $ainfo['sid'] );
}
public function delAttach( $gubun, $nid, $sid ){
$urow = Array();
$urow['gubun'] = $gubun;
$urow['nid'] = $nid;
$urow['sid'] = $sid;
$where = "";
$target_dir = _UP_PATH_."/{$gubun}";
//$rst = @unlink("{$target_dir}/{$nid}_{$sid}.dat");
$rst = $this->fileRemove("{$target_dir}/{$nid}_{$sid}.dat*");
if( !$rst ) return false;
return $this->delData($urow, $where);
}
public function delAttachId( $file_id ){
$ainfo = $this->getAttachId( $file_id );
return $this->delAttach( $ainfo['gubun'], $ainfo['nid'], $ainfo['sid'] );
}
static function fByte($bytes, $precision=2) {
$unit = ["B", "KB", "MB", "GB"];
$exp = floor(log($bytes, 1024)) ?: 0;
return round($bytes / (pow(1024, $exp)), $precision).$unit[$exp];
}
static function fileRemove($filepath, $unremove=""){
$glob = glob($filepath);
foreach( $glob as $filename ) {
if( !$unremove || $filename != $unremove ){
@unlink($filename);
}
}
return true;
}
}

281
lib/app/auth.class.php Normal file
View File

@ -0,0 +1,281 @@
<?php
class Auth extends BaseCode {
function __construct(){
parent::__construct();
$this->DB->query_record = false; //query log 기록 금지
$this->DB->tableExists(TB_auth_manage);
}
/** 권한저장
* @param $cate_area : 권한범위
* @param $cate_id : 권한 기능(메뉴)
* @param $auth_area : 권한 그룹
* @param $auth_target : 권한 대상
* @param $auth : 권한
* @return bool
*/
public function putAuth( $cate_area, $cate_id, $auth_area, $auth_target, $auth ){
$sql_row = Array(
"cate_area" => $cate_area?:"",
"cate_id" => $cate_id?:"",
"auth_area" => $auth_area?:"",
"auth_target"=> $auth_target?:"",
"auth" => $auth?:"",
"reg_date" => $this->DB->sqleval("getdate()"),
"mod_date" => $this->DB->sqleval("getdate()"),
"mod_id" => $GLOBALS['_Umem']['member_id']?:"",
);
return $this->DB->insert(TB_auth_manage, $sql_row);
}
/** 권한수정
* @param $cate_area : 권한범위
* @param $cate_id : 권한 기능(메뉴)
* @param $auth_area : 권한 그룹
* @param $auth_target : 권한 대상
* @param $auth : 권한
* @param string $old_cate_id : 수정할 id
* @return bool
*/
public function setAuth( $cate_area, $cate_id, $auth_area, $auth_target, $auth, $old_cate_id="" ){
$sql_row = Array(
"auth" => $auth?:"",
"mod_date" => $this->DB->sqleval("getdate()"),
"mod_id" => $GLOBALS['_Umem']['member_id']?:"",
);
if( $old_cate_id && $cate_id != $old_cate_id ){
$sql_row['cate_id'] = $cate_id;
}
$where = new DB_where("and");
$where->add("cate_area = ?", $cate_area);
$where->add("cate_id = ?", $old_cate_id?:$cate_id);
$where->add("auth_area = ?", $auth_area);
$where->add("auth_target = ?", $auth_target);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$ins_sql_row = Array(
"cate_area" => $cate_area?:"",
"cate_id" => $cate_id?:"",
"auth_area" => $auth_area?:"",
"auth_target"=> $auth_target?:"",
"auth" => $auth?:"",
"reg_date" => $this->DB->sqleval("getdate()"),
"mod_date" => $this->DB->sqleval("getdate()"),
"mod_id" => $GLOBALS['_Umem']['member_id']?:"",
);
return $this->DB->insertupdate(TB_auth_manage, $ins_sql_row, $sql_row, $whereqry, $whererow);
// $sql = "select count(*) from ".TB_auth_manage." where {$whereqry}";
// $cnt = $this->DB->queryFirstField($sql, $whererow);
//
// if( $cnt ){
// return $this->DB->update(TB_auth_manage, $sql_row, $whereqry, $whererow);
// }else{
// return $this->putAuth($cate_area, $cate_id, $auth_area, $auth_target, $auth);
// }
}
/* 주석은 시간날때.. 하지만 언제나 시간은 없지
* 권한추가
* */
public function addAuth( $cate_area, $cate_id, $auth_area, $auth_target, $auth ){
$auth = (int)$auth;
if( $auth > 7 || $auth < 0 ) return false;
return $this->setAuth( $cate_area, $cate_id, $auth_area, $auth_target, $this->DB->sqleval("auth | {$auth}") );
}
/*
* 권한제거
* */
public function remAuth( $cate_area, $cate_id, $auth_area, $auth_target, $auth ){
$auth = (int)$auth;
if( $auth > 7 || $auth < 0 ) return false;
return $this->setAuth( $cate_area, $cate_id, $auth_area, $auth_target, $this->DB->sqleval("auth & ".(7 ^ $auth)) );
}
/*
* 권한삭제
* */
public function delAuth( $cate_area, $cate_id, $auth_area="", $auth_target="" ){
$where = new DB_where("and");
$where->add("cate_area = ?", $cate_area);
$where->add("cate_id = ?", $cate_id);
if( $auth_area ){
$where->add("auth_area = ?", $auth_area);
}
if( $auth_target ){
$where->add("auth_target = ?", $auth_target);
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->delete(TB_auth_manage, $whereqry, $whererow);
}
/**
* @param $cate_area
* @param $cate_id
* @param string $auth_target
* @return int
*/
public function getAuthList( $cate_area="" ){
$where = new DB_where("and");
if( $cate_area ){
$where->add("cate_area = ?", $cate_area);
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select cate_id, auth_area, auth_target, auth from ".TB_auth_manage." where {$whereqry}";
$rst = $this->DB->qry($sql, $whererow);
if( $rst ) {
$rows = array();
while ($row = $this->DB->fetch_array($rst)) {
$rows[$row['cate_id']][$row['auth_area']][$row['auth_target']] = $this->getAuthToRow($row['auth']);
}
return $rows;
}
return $rst;
}
/** 회원권한조회 - 회원이 가진 (현메뉴)에서 가진 권한값 리턴
* @param $cate_area : 권한범위
* @param $cate_id : 권한 기능(메뉴)
* @param string $auth_target : member_id, //Todo: 그룹권한만 확인하는 내용은 존재하지 않음
* @return int
*/
public function getAuth( $cate_area, $cate_id, $auth_target="" ){
if( !$auth_target ){
$mem = $GLOBALS['_Umem'];
$auth_target = isset($mem['member_id'])?$mem['member_id']:"";
}else{
$mobj = new Member();
$mem = $mobj->getMember($auth_target);
}
if( !isset($mem) || !$mem || !isset($mem['member_id']) || !$mem['member_id'] ){
if( !is_array($mem) ){
$mem = array();
}
$mem['member_auth'] = "Y"; //비회원
}
if( $mem['member_auth'] == 'SA' ) return 7; //슈퍼관리자는 무조건 Ok
$where = new DB_where("and");
$where->add("cate_area = ?", $cate_area);
$where->add("cate_id = ?", $cate_id);
$subwhere = $where->sub_where("or");
$subwhere2 = $subwhere->sub_where("and");
$subwhere2->add("auth_area = ?","G");
$subwhere2->add("auth_target = ?",$mem['member_auth']);
$subwhere3 = $subwhere->sub_where("and");
$subwhere3->add("auth_area = ?","M");
$subwhere3->add("auth_target = ?",$mem['member_id']);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select auth from ".TB_auth_manage." where {$whereqry}";
$rows = $this->DB->query($sql, $whererow);
$auth = 0;
foreach( (array)$rows as $row ){
$auth = $auth | $row['auth'];
}
//권한 제거 가 존재한다면(예: 레벨권한, 그룹권한으로 권한을 획득했지만 해당 인원만 쓰기 금지.)... 아래 로직을 적절하게 적용한다.
// $dauth <-- 제거할 권한(예: 7->모든 권한 제거, 4->수정삭제권한 제거, 2->쓰기권한제거, 1->읽기권한 제거)
// $auth = $auth & ~$dauth;
return $auth;
}
/** 권한 Normalize
* @param $auth
* @return int
*/
public function normalAuth($auth){
$auth = strtolower($auth);
switch( true ){
case in_array( $auth, Array("r", "read", "1", 1) ) :
$auth = 1; break;
case in_array( $auth, Array("w", "write", "put", "2", 2) ) :
$auth = 2; break;
case in_array( $auth, Array("u", "up", "update", "m", "mod", "modify", "set", "d", "del", "delete", "4", 4) ) :
$auth = 4; break;
default :
$auth = 0;
}
return $auth;
}
/** 권한확인
* @param $auth : 권한
* @param $cate_area : 권한범위
* @param $cate_id : 권한 기능(메뉴)
* @param string $auth_target : member_id, //Todo: 그룹권한만 확인하는 내용은 존재하지 않음
* @return int
*/
public function hasAuth( $auth, $cate_area, $cate_id, $auth_target="" ){
$allow = $this->getAuth($cate_area, $cate_id, $auth_target);
$auth = $this->normalAuth($auth);
return $auth & $allow;
}
/** 권한 get num -> row
* @param $auth : 권한
* @return array
*/
public function getAuthToRow($auth){
$arow = Array();
$arow["R"] = (bool)($auth & 1);
$arow["W"] = (bool)($auth & 2);
$arow["D"] = (bool)($auth & 4);
return $arow;
}
/*
* 권한 get row(string) -> num
* */
public function getAuthToNum($read, $write, $delete){
return ($read?1:0)+($write?2:0)+($delete?4:0);
}
/** 해당 권한을 가진 id get
* @param $row : 권한 배열
* @param $auth : 찾아낼 권한
* @return array
*/
public function getHasAuthRow( $row, $auth ){
$auth = $this->normalAuth($auth);
$rerow = array();
foreach( (array)$row as $k => $v ){
if( $v & $auth ){
$rerow[] = $k;
}
}
return $rerow;
}
}

1101
lib/app/board.class.php Normal file

File diff suppressed because it is too large Load Diff

127
lib/app/cust.class.php Normal file
View File

@ -0,0 +1,127 @@
<?php
class Cust extends Cmanage {
function __construct(){
parent::__construct(TB_cust_list);
$this->DB->tableExists(TB_cust_list);
}
public function getCustList($fields, $where=""){
if( !$where ){
$where = new DB_where("and");
}
$where->add("cust_active = ?", 1);
$orderby="cust_name";
$limit=array();
$rows = $this->getDataList($fields, $where, $orderby, $limit);
for( $a=0 ; $a<@count($rows) ; $a++ ){
if( $rows[$a]['cust_phone'] ) $rows[$a]['cust_phone'] = $this->lcrypt->dec_secure($rows[$a]['cust_phone']);
if( $rows[$a]['cust_mail'] ) $rows[$a]['cust_mail'] = $this->lcrypt->dec_secure($rows[$a]['cust_mail']);
}
return $rows;
}
public function getCustSelect($key, $val, $where=""){
$rows = $this->getDataList("{$key}, {$val}", $where, "{$val} asc");
$selrows = array();
foreach( (array)$rows as $row ){
$selrows[$row[$key]] = $row[$val];
}
return $selrows;
}
public function getCustPage($sqldata, $where=""){
if( !$where ){
$where = new DB_where("and");
}
$where->add("cust_active = ?", 1);
if( $sqldata['stxt'] ){
$subwhere = $where->sub_where("or");
if( $sqldata['sfld'] ){
$subwhere->add("{$sqldata['sfld']} like ?", "%{$sqldata['stxt']}%");
}else{
$subwhere->add("cust_id like ?", "%{$sqldata['stxt']}%");
$subwhere->add("cust_name like ?", "%{$sqldata['stxt']}%");
$subwhere->add("cust_fullname like ?", "%{$sqldata['stxt']}%");
$subwhere->add("cust_charger like ?", "%{$sqldata['stxt']}%");
}
}
if( hasval($sqldata['cust_status']) ){
$where->add("cust_status = ?", $sqldata['cust_status']);
}
$orderby = "reg_date desc";
if( $sqldata['ofld'] && $sqldata['oasc'] ){
$orderby = "{$sqldata['ofld']} {$sqldata['oasc']}";
}
$query = array(
"mode" => $sqldata['mode'],
"viewnum" => $sqldata['viewnum'],
"page" => $sqldata['page'],
"sfld" => $sqldata['sfld'],
"stxt" => $sqldata['stxt'],
"ofld" => $sqldata['ofld'],
"oasc" => $sqldata['oasc'],
"cust_status" => $sqldata['cust_status'],
);
$lists = $this->getDataPage("*", $query, $where ,$orderby);
for( $a=0 ; $a<@count($lists->rows) ; $a++ ){
if( $lists->rows[$a]['cust_phone'] ) $lists->rows[$a]['cust_phone'] = $this->lcrypt->dec_secure($lists->rows[$a]['cust_phone']);
if( $lists->rows[$a]['cust_mail'] ) $lists->rows[$a]['cust_mail'] = $this->lcrypt->dec_secure($lists->rows[$a]['cust_mail']);
}
return $lists;
}
public function getCust( $cust_id ){
$urow = Array("cust_id" => $cust_id);
$where = "";
$row = $this->getData("*", $urow, $where);
$row['cust_phone'] = $this->lcrypt->dec_secure($row['cust_phone']);
$row['cust_mail'] = $this->lcrypt->dec_secure($row['cust_mail']);
return $row;
}
public function putCust( $sqldata ) {
if( $sqldata['cust_phone'] ){
$sqldata['cust_phone'] = $this->lcrypt->enc_secure($sqldata['cust_phone']);
}
if( $sqldata['cust_mail'] ){
$sqldata['cust_mail'] = $this->lcrypt->enc_secure($sqldata['cust_mail']);
}
return $this->putData($sqldata);
}
public function setCust( $sqldata ) {
$cinfo = $this->getCust($sqldata['cust_id']);
if( $sqldata['cust_id'] && $cinfo['cust_id'] == $sqldata['cust_id'] ){
if( $sqldata['cust_phone'] ){
$sqldata['cust_phone'] = $this->lcrypt->enc_secure($sqldata['cust_phone']);
}
if( $sqldata['cust_mail'] ){
$sqldata['cust_mail'] = $this->lcrypt->enc_secure($sqldata['cust_mail']);
}
$urow = Array("cust_id" => $sqldata['cust_id']);
$where = "";
unset($sqldata['cust_id']);
return $this->setData($sqldata, $urow, $where);
}else{
return $this->putCust( $sqldata );
}
}
public function setCustParts( $sqldata, $field="", $row="", $where="" ){
return $this->setDataParts($sqldata, $field, $row, $where);
}
public function delCust( $cust_id, $where ){
$urow = Array("cust_id" => $cust_id);
$where = "";
return $this->delData($urow, $where);
}
}

612
lib/app/member.class.php Normal file
View File

@ -0,0 +1,612 @@
<?php
class Member extends BaseCode {
var $member_id;
var $TB;
function __construct( $member_id="" ){
parent::__construct();
$this->DB->tableExists(TB_member);
$this->DB->tableExists(TB_member_log);
$this->DB->tableExists(TB_member_union);
$this->member_id = $member_id?:(isset($GLOBALS['_Umem']['member_id'])?$GLOBALS['_Umem']['member_id']:"");
$this->TB = " (select mem.*, meu.cust_id, meu.cust_name from ". TB_member ." as mem left join ". TB_member_union . " as meu on mem.member_id = meu.member_id) as m ";
}
public function getMemberList( $field="*", $where="", $orderby="", $limit=array() ){
if( !$where ){
$where = new DB_where("and");
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//$sql = "select {$field} from ".$this->TB." where {$whereqry} ".(($orderby)?"order by {$orderby}":""). $this->DB->_limit($limit[0],$limit[1]);
$sql = $this->DB->addLimit("select {$field} from ".$this->TB." where {$whereqry}", $orderby, $limit[0],$limit[1]);
$rst = $this->DB->qry($sql, $whererow);
$row = array();
while( $tmp = $this->DB->fetch_array($rst) ){
$row[] = $this->getMemberInfo($tmp);
}
return $row;
}
public function getMemberSel( $field="*", $where="", $orderby="", $limit=array() ){
if( !$where ){
$where = new DB_where("and");
}
$where->add("member_status = ?",1);
$mlist = $this->getMemberList("member_id, part_name",$where,"part_name, member_name asc", $limit);
$mem_list = array();
for( $a=0 ; $a<@count($mlist) ; $a++ ){
$mem_list[] = array(
"id" => $mlist[$a]['member_id'],
"text" => $mlist[$a]['part_name'],
);
}
return $mem_list;
}
public function getMemberSelect($key, $val, $where=""){
$rows = $this->getMemberList("{$key}, {$val}", $where, "member_name asc");
$selrows = array();
foreach( (array)$rows as $row ){
$selrows[$row[$key]] = $row[$val];
}
return $selrows;
}
public function getMemberPage($sqldata=array(), $query=array(), $where=""){ //관리자 리스트 (페이징)
if( !$where ){
$where = new DB_where("and");
}
$where->add("reg_date >= ?", ($sqldata['sdate']?$sqldata['sdate']:_SDATENULL_)." 00:00:00.000");
$where->add("reg_date <= ?", ($sqldata['fdate']?$sqldata['fdate']:_FDATENULL_)." 23:59:59.999");
if( $sqldata['stxt'] ){
$subwhere = $where->sub_where("or");
if( $sqldata['sfld'] ){
$subwhere->add("{$sqldata['sfld']} like ?", "%{$sqldata['stxt']}%");
}else{
$subwhere->add("member_id like ?", "%{$sqldata['stxt']}%");
$subwhere->add("member_name like ?", "%{$sqldata['stxt']}%");
}
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$orderby = "reg_date desc";
if( $sqldata['ofld'] && $sqldata['oasc'] ){
$orderby = "{$sqldata['ofld']} {$sqldata['oasc']}";
}
$query = array_merge(array(
"mode" => $sqldata['mode'],
"viewnum" => $sqldata['viewnum'],
"sdate" => $sqldata['sdate']?:"",
"fdate" => $sqldata['fdate']?:"",
"sfld" => $sqldata['sfld'],
"stxt" => $sqldata['stxt'],
"ofld" => $sqldata['ofld'],
"oasc" => $sqldata['oasc'],
), $query);
$lists = new clist();
$lists->fld = "*";
$lists->where = $whereqry;
$lists->whererow = $whererow;
$lists->orderby = $orderby;
$lists->url = $_SERVER['PHP_SELF'];
$lists->query = $query;
$lists->page = $sqldata['page']?:1;
$lists->linktype = "";
$lists->viewnum = $query['viewnum']?:$GLOBALS['_varsBaseCode']['line_num'];
$lists->rownum = $query['rownum']?:$GLOBALS['_varsBaseCode']['page_num'];
$lists->getCommonList($this->TB);
for( $a=0 ; $a<@count($lists->rows) ; $a++ ){
$lists->rows[$a] = $this->getMemberInfo($lists->rows[$a]);
}
return $lists;
}
public function getMemberLogList($field="*",$where="", $orderby="",$limit=array()){ //관리자 리스트
$tbl = "(select L.*, M.member_name, M.company_name from ".TB_member_log." as L left join ".TB_member." as M on L.member_id = M.member_id) as L";
if( !$where ){
$where = new DB_where("and");
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//$sql = "select {$field} from {$tbl} where {$whereqry} ".(($orderby)?"order by {$orderby}":""). $this->DB->_limit($limit[0],$limit[1]);
$sql = $this->DB->addLimit("select {$field} from {$tbl} where {$whereqry}", $orderby, $limit[0],$limit[1]);
$rst = $this->DB->qry($sql, $whererow);
$row = array();
while( $tmp = $this->DB->fetch_array($rst) ){
$tmp['login_date'] = getDT_datetime($tmp['login_date']);
$row[] = $tmp;
}
return $row;
}
public function getMemberLogPage($sqldata=array(), $query=array(), $where=""){ //관리자 리스트 (페이징)
$tbl = "(select L.*, M.member_name from ".TB_member_log." as L left join ".TB_member." as M on L.member_id = M.member_id) as L";
if( !$where ){
$where = new DB_where("and");
}
$where->add("login_date >= ?", ($sqldata['sdate']?$sqldata['sdate']:_SDATENULL_)." 00:00:00.000");
$where->add("login_date <= ?", ($sqldata['fdate']?$sqldata['fdate']:_FDATENULL_)." 23:59:59.999");
if( $sqldata['stxt'] ){
$subwhere = $where->sub_where("or");
if( $sqldata['sfld'] ){
$subwhere->add("{$sqldata['sfld']} like ?", "%{$sqldata['stxt']}%");
}else{
$subwhere->add("member_id like ?", "%{$sqldata['stxt']}%");
$subwhere->add("member_name like ?", "%{$sqldata['stxt']}%");
$subwhere->add("ip_addr like ?", "%{$sqldata['stxt']}%");
$subwhere->add("browser like ?", "%{$sqldata['stxt']}%");
$subwhere->add("con_domain like ?", "%{$sqldata['stxt']}%");
$subwhere->add("OS like ?", "%{$sqldata['stxt']}%");
}
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$orderby = "login_date desc";
if( $sqldata['ofld'] && $sqldata['oasc'] ){
$orderby = "{$sqldata['ofld']} {$sqldata['oasc']}";
}
$query = array_merge(array(
"mode" => $sqldata['mode'],
"viewnum" => $sqldata['viewnum'],
"sdate" => $sqldata['sdate']?:"",
"fdate" => $sqldata['fdate']?:"",
"sfld" => $sqldata['sfld'],
"stxt" => $sqldata['stxt'],
"ofld" => $sqldata['ofld'],
"oasc" => $sqldata['oasc'],
), $query);
$lists = new clist();
$lists->fld = "*";
$lists->where = $whereqry;
$lists->whererow = $whererow;
$lists->orderby = $orderby;
$lists->url = $_SERVER['PHP_SELF'];
$lists->query = $query;
$lists->page = $sqldata['page']?:1;
$lists->linktype = "";
$lists->viewnum = $query['viewnum']?:$GLOBALS['_varsBaseCode']['line_num'];
$lists->rownum = $query['rownum']?:$GLOBALS['_varsBaseCode']['page_num'];
$lists->getCommonList($tbl);
for( $a=0 ; $a<@count($lists->rows) ; $a++ ){
$lists->rows[$a]['login_date'] = getDT_datetime($lists->rows[$a]['login_date']);
}
return $lists;
}
public function getMember( $member_id="", $where="" ) {
$member_id = $member_id?:$this->member_id;
if( !$member_id ) return 0;
if( !$where ){
$where = new DB_where("and");
}
$where->add("member_id = ?",$member_id);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$this->DB->query_record = false; //query log 기록 금지
$sql = "select * from ".$this->TB." where {$whereqry}";
$rst = $this->DB->qry($sql, $whererow);
$row = $this->DB->fetch_array($rst);
$row = $this->getMemberInfo($row);
$where = new DB_where("and");
$where->add("member_id = ?",$member_id);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
if( $this->isAdmin() ){ //관리자의 경우 회원의 마지막 로그인 정보를 주고, 일반회원은 자신의 현재 로그인 이전의 로그인 정보를 준다.
$sql = "select login_date as last_login, ip_addr as last_ip from ".TB_member_log." where {$whereqry} order by login_date desc";
$rst = $this->DB->qry($sql, $whererow);
$lrow = $this->DB->fetch_array($rst);
$row['login_ip'] = $lrow['last_ip']?:"";
$row['login_date'] = $lrow['last_login'];
}
$this->DB->query_record = true; //query log 기록 재개
return $row;
}
public function getMemberWhere( $wrow ) {
$where = new DB_where("and");
foreach( $wrow as $key => $val ){
$where->add("{$key} = ?",$val);
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from ".$this->TB." where {$whereqry}";
$rst = $this->DB->qry($sql, $whererow);
$row = $this->getMemberInfo($this->DB->fetch_array($rst));
return $row;
}
public function getMemberInfo( $row ){
if( isset($row['member_mobile']) && $row['member_mobile'] ) $row['member_mobile'] = $this->lcrypt->dec_secure($row['member_mobile']);
if( isset($row['member_mail']) && $row['member_mail'] ) $row['member_mail'] = $this->lcrypt->dec_secure($row['member_mail']);
if( isset($row['member_phone']) && $row['member_phone'] ) $row['member_phone'] = $this->lcrypt->dec_secure($row['member_phone']);
return $row;
}
public function putMember( $sqldata=array() ) { //가입
if( $this->DB->tableExists( TB_member ) ){
$sql_row = array(
"member_id" => $sqldata['member_id']?:"",
"member_pw" => $sqldata['member_pw']?$this->lcrypt->pw_make($sqldata['member_pw']):"",
"member_name" => $sqldata['member_name']?:"",
"member_mobile" => $sqldata['member_mobile']?$this->lcrypt->enc_secure($sqldata['member_mobile']):"",
"member_mail" => $sqldata['member_mail']?$this->lcrypt->enc_secure($sqldata['member_mail']):"",
"member_certi_key" => $sqldata['member_certi_key']?:"",
"member_status" => $sqldata['member_status']?:1,
"member_auth" => $sqldata['member_auth']?:"",
"reg_date" => $this->DB->sqleval("getdate()"),
"mod_date" => $this->DB->sqleval("getdate()"),
);
return $this->DB->insert( TB_member, $sql_row);
}
return 0;
}
public function setMember( $sqldata ) { //정보 수정
if( !$this->isAdmin() ){
$sqldata['member_id'] = $GLOBALS['_Umem']['member_id'];
}
$sql_row = array(
"member_name" => $sqldata['member_name'],
"member_mobile" => $sqldata['member_mobile']?$this->lcrypt->enc_secure($sqldata['member_mobile']):"",
"member_mail" => $sqldata['member_mail']?$this->lcrypt->enc_secure($sqldata['member_mail']):"",
"mod_date" => $this->DB->sqleval("getdate()"),
);
if( $this->isAdmin() ){
if( $sqldata['member_certi_key'] ){
$sql_row['member_certi_key'] = $sqldata['member_certi_key'];
}
}
if( $sqldata['member_status'] ){
$sql_row['member_status'] = $sqldata['member_status'];
}
if( $sqldata['member_auth'] ){
$sql_row['member_auth'] = $sqldata['member_auth'];
}
if( $sqldata['member_pw'] ){
$sql_row["member_pw"] = $this->lcrypt->pw_make($sqldata['member_pw']);
}
return $this->DB->update( TB_member, $sql_row, "member_id = ?", array($sqldata['member_id']));
}
public function setMemberParts( $sqldata ){
if( !$sqldata['member_id'] || $GLOBALS['_Umem']['member_id'] && !$this->isAdmin() ){
$sqldata['member_id'] = $GLOBALS['_Umem']['member_id'];
}
$where = new DB_where("and");
if( is_array($sqldata['member_id']) ){
//$where->add("member_id in ?",$sqldata['member_id']);
$subwhere = $where->sub_where("or");
foreach( $sqldata['member_id'] as $val ){
$subwhere->add("member_id = ?",$val);
}
}else{
$where->add("member_id = ?",$sqldata['member_id']);
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
unset($sqldata['member_id']);
return $this->DB->update( TB_member, $sqldata, $whereqry, $whererow );
}
public function delMember( $member_id ) { //회원 삭제
if( $this->isAdmin() ){
$where = new DB_where("and");
$where->add("member_id = ?",$member_id);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->delete( TB_member, $whereqry, $whererow );
}
return 0;
}
public function getMemberUnion($member_id, $where=""){
if( !$where ){
$where = new DB_where("and");
}
$where->add("member_id = ?", $member_id);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from ".TB_member_union." where {$whereqry}";
return $this->DB->queryFirstRow($sql, $whererow);
}
public function putMemberUnion($sqldata){
$sql_row = Array(
"member_id" => $sqldata['member_id'],
"cust_id" => $sqldata['cust_id']?:"",
"cust_name" => $sqldata['cust_name']?:"",
);
return $this->DB->insert(TB_member_union, $sql_row);
}
public function setMemberUnion($sqldata){
$sql_row = Array(
"member_id" => $sqldata['member_id'],
"cust_id" => $sqldata['cust_id']?:"",
"cust_name" => $sqldata['cust_name']?:"",
);
$uinfo = $this->getMemberUnion($sql_row['member_id']);
if( $uinfo['member_id'] && $uinfo['member_id'] == $sql_row['member_id'] ){
$where = new DB_where("and");
$where->add("member_id = ?", $sql_row['member_id']);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->update(TB_member_union, $sql_row, $whereqry, $whererow);
}else{
return $this->putMemberUnion($sql_row);
}
}
public function delMemberUnion($member_id){
$where = new DB_where("and");
$where->add("member_id = ?", $member_id);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->delete(TB_member_union, $whereqry, $whererow);
}
public function active( $member_id ) { //활동
return $this->setMemberParts( array(
"member_id" => $member_id,
"member_status" => 1
));
}
public function pause( $member_id ) { //임시정지
return $this->setMemberParts( array(
"member_id" => $member_id,
"member_status" => 2
));
}
public function withdraw( $member_id ) { //탈퇴 / 퇴사처리
return $this->setMemberParts( array(
"member_id" => $member_id,
"member_status" => 3
));
}
public function join( $sqldata ) { //가입
return $this->putMember( $sqldata );
}
public function login($member_id, $member_pw) { // 로그인
$result = 0;
if( !$member_id || !$member_pw ){
return $result;
}
$row = $this->pwCheck($member_id, $member_pw);
if( $row ){
if( $row['member_status'] == 1 && $row['member_auth'] ){
$_SESSION['auth_mem_id'] = $member_id;
// 로그인 시점의 microtime
list ( $usec, $sec ) = explode ( " ", microtime () );
$rand_no = rand ( 100000, 999999 );
$login_security_key = str_replace ( '.', '', get_ip() ) . $sec . str_replace ( '.', '', $usec ) . $rand_no;
$_SESSION['auth_login_security_key'] = $login_security_key;
//$result = $row; //가입요청 및 임시중지등 등록된 회원 상태를 알리기 위해 if 밖으로 조정
if( class_exists("Visit") && $_SESSION['visit_sess'] ){ //방문세션이 존재하면 방문세션 테이블에 ID를 기록한다.
$vsobj = new Visit();
$vsobj->setLoginRec();
}
}
$result = $row;
}
return $result;
}
public function loginAforce($member_id) { // 관리자용 회원 강제 로그인
$result = 0;
if( !$member_id || !$this->isAdmin() ){
return $result;
}
$row = $this->getMember($member_id);
if( $row['member_id'] ){
$where = new DB_where("and");
$where->add("member_id = ?",$member_id);
$where->add("login_success = ?",1);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//$sql = "select login_security_key from ".TB_member_log." where {$whereqry} order by login_date desc ".$this->DB->_limit(0,1);
$sql = $this->DB->addLimit("select login_security_key from ".TB_member_log." where {$whereqry}","login_date desc",0,1);
$login_security_key = $this->DB->queryFirstField($sql,$whererow);
$_SESSION['auth_mem_id'] = $member_id;
$_SESSION['auth_login_security_key'] = $login_security_key;
$result = 1;
}else{
$result = 0;
}
return $result;
}
public function pwCheck( $member_id, $member_pw ){ //비밀번호 체크
$row = $this->getMember($member_id);
if( $row['member_pw'] ){
if( $this->lcrypt->pw_match($member_pw, $row['member_pw']) ){
return $row;
}
}
return 0;
}
public function logout(){ //로그아웃
//session_destroy();
$_SESSION['auth_mem_id'] = "";
$_SESSION['auth_login_security_key'] = "";
return 1;
}
public function logRec( $member_id, $login_page, $log_rst ){ //로그인 기록
$result = 0;
if( $this->DB->tableExists( TB_member_log ) ){
$where = new DB_where("and");
$where->add("member_id = ?",$member_id);
$where->add("login_success = ?",1);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//자신의 현재 로그인 이전의 로그인 정보를 기록한다.
$crow = $this->DB->queryFirstRow( "select count(*)+1 as login_count from ".TB_member_log." where {$whereqry}", $whererow );
$lrow = $this->DB->queryFirstRow( "select top 1 login_date, ip_addr as last_ip from ".TB_member_log." where {$whereqry} order by login_date desc", $whererow );
$sql_row = array(
"member_id" => $member_id,
"login_count" => $crow['login_count']?:0,
"login_ip" => $lrow['last_ip']?:"",
"login_date" => getDT_datetime($lrow['login_date']),
);
$this->setMemberParts($sql_row);
$connect_info = parse_user_agent();
if( is_array($connect_info['browser']) ){
$connect_info['browser'] = substr(json_encode($connect_info['browser']),0,40);
}
$sql_row = array(
"member_id" => $member_id,
"ip_addr" => get_ip(),
"login_page" => $login_page,
"login_success" => $log_rst?1:0,
"login_date" => $this->DB->sqleval("getdate()"),
"login_security_key" => $_SESSION['auth_login_security_key']?:"",
"sess_file_name" => session_id(),
"browser" => "{$connect_info['browser']} | {$connect_info['version']}",
"con_domain" => $_SERVER['HTTP_HOST']?:"",
"os" => $connect_info['platform']?:"",
"os_bit" => ""
);
$result = $this->DB->insert( TB_member_log, $sql_row);
}
return $result;
}
public function loginCheck( $member_id="" ){ //로그인 체크
$member_id = $member_id?:$_SESSION['auth_mem_id'];
if( $member_id ){
if( !defined('_SINGLE_LOGIN_') || !_SINGLE_LOGIN_ || _SINGLE_LOGIN_ && $this->multiLoginBlock() ){
$row = $this->getMember( $member_id );
unset($row['member_pw']);
return $row;
}else{
return $this->logout();
}
}
return 0;
}
public function multiLoginBlock(){ //멀티 로그인 차단
$where = new DB_where("and");
$where->add("member_id = ?",$GLOBALS['_Umem']['member_id']);
$where->add("login_success = ?",1);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//$sql = "select login_security_key from ".TB_member_log." where {$whereqry} order by login_date desc ".$this->DB->_limit(0,1);
$sql = $this->DB->addLimit("select login_security_key from ".TB_member_log." where {$whereqry}","login_date desc",0,1);
$match_login_security_key = $this->DB->queryFirstField($sql,$whererow);
if( $match_login_security_key == $_SESSION['auth_login_security_key'] ){
return 1;
}
return 0;
}
public function temp_pw_gen( $len=0 ){ //임시비밀번호 생성
if( $len < 1 ) $len = 8;
$str = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%&*ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$temp_pw = "";
for($i=0; $i<$len; $i++) {
$temp_pw .= $str[random_int(0, strlen($str)-1)];
}
return $temp_pw;
}
public function isAdmin($admin_id="", $suonly=""){ //관리 권한 있는지 확인
if( !$admin_id || $admin_id && $admin_id == $GLOBALS['_Umem']['member_id'] ){
$arow = $GLOBALS['_Umem'];
}else{
$arow = $this->getMember($admin_id);
}
if( $suonly ){//기준정보에서 SA 코드자체를 변경할수 있으므로 suonly 는 사용에 주의
$adminrow = array("SA");
}else{
if( is_array($GLOBALS['_varsAuthAdmin']) ){
$adminrow = array_keys($GLOBALS['_varsAuthAdmin']);
}else{
$adminrow = array("SA","A");
}
}
if( in_array($arow['member_auth'], $adminrow) ){
return true;
}else{
return false;
}
}
}

453
lib/app/menu.class.php Normal file
View File

@ -0,0 +1,453 @@
<?php
class Menu extends kcate {
public $AUTH;
public $authDest = array();
function __construct( $cate_table="" ){
parent::__construct($cate_table);
$this->DB->tableExists(TB_menu_auth_page);
$this->set_cate_area();
$this->AUTH = new Auth();
}
public function getMenuList($usage="Y"){
$where = new DB_where("and");
$where->add("cate.cate_area = ?", $this->cate_area);
if( $usage ){
$where->add("cate_use = ?", "Y");
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from {$this->cate_table} where cate_area = '{$this->cate_area}' and cate_use != 'Y'";
$notuse_row = $this->DB->query($sql);
$use_fld = array();
foreach( (array)$notuse_row as $nrow ){
$use_fld[] = " cate.cate_code like '{$nrow['cate_code']}%' ";
}
if( count($use_fld) ){
$add_fld = implode(" or ", $use_fld);
}else{
$add_fld = " 1!=1 ";
}
$sql = "select
cate.cate_area,
cate.cate_id,
cate.cate_code,
cate.cate_name,
case when ({$add_fld}) then 'N' else 'Y' end as cate_use
from {$this->cate_table} as cate
left join (select * from {$this->cate_table} where cate_area = '{$this->cate_area}') pa_cate
on substring(cate.cate_code, 1, len(cate.cate_code)-{$this->dmax}) = pa_cate.cate_code
where {$whereqry} order by cate.cate_code asc";
$rst = $this->DB->qry($sql, $whererow);
if( $rst ){
$rows = array();
while( $row = $this->DB->fetch_array($rst) ){
$row['level'] = $this->level_cate($row['cate_code']);
$rows[] = Array(
"id" => $row['cate_id'],
"text" => $row['cate_name'],
"parent" => $row['parent'],
"icon" => "",
"data" => $row,
);
}
return $rows;
}else{
return 0;
}
}
public function getMenuAuthList($usage="Y"){
$where = new DB_where("and");
$where->add("cate.cate_area = ?", $this->cate_area);
if( $usage ){
$where->add("cate_use = ?", "Y");
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
/*
$sql = "select
cate.cate_id as id,
cate.cate_code as data,
ifnull(pa_cate.cate_id, '#') as parent,
cate.cate_name as text,
case cate.cate_auth when 'Y' then '' else '' end as icon
from {$this->cate_table} as cate
left join pa_cate
on substring(cate.cate_code, 1, LENGTH(cate_code)-{$this->dmax}) = pa_cate.cate_code where {$whereqry} order by cate.cate_code asc";*/
/* 쿼리 2번 실행 */
$sql = "select cate_area, cate_id, auth_area, auth_target, auth from ".TB_auth_manage." where cate_area = '{$this->cate_area}'";
$rows = $this->DB->query($sql);
$auths = array();
foreach( (array)$rows as $auth ){
if( !isset($auths[$auth['cate_id']]) ) $auths[$auth['cate_id']] = array();
if( !isset($auths[$auth['cate_id']][$auth['auth_area']]) ) $auths[$auth['cate_id']][$auth['auth_area']] = array();
$auths[$auth['cate_id']][$auth['auth_area']][$auth['auth_target']] = $auth['auth'];
}
$sql = "select
cate.cate_area,
cate.cate_id,
cate.cate_code,
cate.cate_name,
cate.cate_data,
cate.cate_exp,
cate.cate_class,
cate.cate_auth,
cate.cate_use,
isnull(pa_cate.cate_id, '#') as parent,
pages.cate_filepath
from {$this->cate_table} as cate
left join (select cate_area, cate_id, stuff(( select char(13)+ tagg.filepath from ".TB_menu_auth_page." as tagg where tagg.cate_area = tmap.cate_area for xml path(''), type).value('.','varchar(max)'),1,1,'') as cate_filepath from ".TB_menu_auth_page." as tmap group by cate_area, cate_id) as pages
on cate.cate_area = pages.cate_area and cate.cate_id = pages.cate_id
left join (select cate_id, cate_code from {$this->cate_table} where cate_area = '{$this->cate_area}') pa_cate
on substring(cate.cate_code, 1, len(cate.cate_code)-{$this->dmax}) = pa_cate.cate_code
where {$whereqry} order by cate.cate_code asc";
//string_agg 대체
//stuff(( select char(13)+ tagg.filepath from ".TB_menu_auth_page." as tagg where tagg.cate_area = tmap.cate_area for xml path(''), type).value('.','varchar(max)'),1,1,'') as cate_filepath
//cate_filepath=stuff(( select char(13)+ tagg.filepath from ".TB_menu_auth_page." as tagg where tagg.cate_area = tmap.cate_area for xml path(''), type).value('.','varchar(max)'),1,1,'')
//
//string_agg(filepath,CHAR(13)) as cate_filepath
/* 서브쿼리 이용
$sql = "select
cate.cate_area,
cate.cate_id,
cate.cate_code,
cate.cate_name,
cate.cate_data,
cate.cate_exp,
cate.cate_class,
cate.cate_auth,
isnull(pa_cate.cate_id, '#') as parent
from {$this->cate_table} as cate
left join (select * from {$this->cate_table} where cate_area = '{$this->cate_area}') as pa_cate
on substring(cate.cate_code, 1, len(cate.cate_code)-{$this->dmax}) = pa_cate.cate_code
left join (select cate_area, cate_id, auth_area, string_agg(concat(auth_target,':',auth),',') as auths from ".TB_auth_manage." group by cate_area, cate_id, auth_area ) as auth
on cate.cate_area = auth.cate_area and cate.cate_id = auth.cate_id
where cate.cate_area = '{$this->cate_area}' group by cate.cate_area, cate.cate_id, auth_area order by cate.cate_code asc";*/
$rst = $this->DB->qry($sql, $whererow);
if( $rst ){
$rows = array();
while( $row = $this->DB->fetch_array($rst) ){
// foreach( $GLOBALS['_varsAuthArea'] as $auth_area => $name ){
// $row['cate_auth_read'][$auth_area] = $authObj->getHasAuthRow($auths[$row['cate_id']][$auth_area], "READ");
// $row['cate_auth_write'][$auth_area] = $authObj->getHasAuthRow($auths[$row['cate_id']][$auth_area], "WRITE");
// $row['cate_auth_delete'][$auth_area] = $authObj->getHasAuthRow($auths[$row['cate_id']][$auth_area], "DELETE");
// }
$row['auth'] = $auths[$row['cate_id']];
$rows[] = Array(
"id" => $row['cate_id'],
"text" => $row['cate_name'],
"parent" => $row['parent'],
"icon" => "",
"data" => $row,
);
}
return $rows;
}else{
return 0;
}
}
public function getTreeList($cate_code="", $direct=false){
$temp_ren = strlen($cate_code) + $this->dmax;
$where = $this->getAreaQry();
$where = $this->getShowQry($where);
$where->add("cate_code like ?", "{$cate_code}%");
$where->add("cate_code != ?", $cate_code);
$where->add("len(cate_code) = ?", $temp_ren);
$where->add("cate.cate_use = ?", "Y");
$subwhere = $where->sub_where("or");
$subwhere->add("auth.auth_read = ?", 1);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$tb_auth = "select
cate_id,
cast(sum(auth & 4) as bit) as auth_delete,
cast(sum(auth & 2) as bit) as auth_write,
cast(sum(auth & 1) as bit) as auth_read
from ".TB_auth_manage."
where (auth_area = 'G' and auth_target = '".$GLOBALS['_Umem']['member_auth']."') or (auth_area = 'M' and auth_target = '".$GLOBALS['_Umem']['member_id']."')
group by cate_id";
$sql = "select cate.cate_id, cate_code, cate_name, cate_data, cate_exp, cate_class from {$this->cate_table} as cate
left join ({$tb_auth}) as auth on cate.cate_id = auth.cate_id
where {$whereqry} order by cate_code";
$rst = $this->DB->qry($sql, $whererow);
$i = 0;
$rows = Array();
while( $row = $this->DB->fetch_array($rst) ){
if( !$direct ){
$row['child'] = $this->getTreeList($row['cate_code']);
}
$rows[] = $row;
}
return $rows;
}
public function getTreeListForTreeView($cate_code="", $now_code=""){
$temp_ren = strlen($cate_code) + $this->dmax;
$where = $this->getAreaQry();
$where = $this->getShowQry($where);
$where->add("cate.cate_code like ?", "{$cate_code}%");
$where->add("cate.cate_code != ?", $cate_code);
$where->add("len(cate.cate_code) = ?", $temp_ren);
$where->add("cate.cate_use = ?", "Y");
$subwhere = $where->sub_where("or");
$subwhere->add("auth.auth_read = ?", 1);
$subwhere->add("'SA' = ?", $GLOBALS['_Umem']['member_auth']);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$tb_auth = "select
cate_id,
cast(sum(auth & 4) as bit) as auth_delete,
cast(sum(auth & 2) as bit) as auth_write,
cast(sum(auth & 1) as bit) as auth_read
from ".TB_auth_manage."
where (auth_area = 'G' and auth_target = '".$GLOBALS['_Umem']['member_auth']."') or (auth_area = 'M' and auth_target = '".$GLOBALS['_Umem']['member_id']."')
group by cate_id";
$sql = "select
cate.cate_id,
cate.cate_code,
cate.cate_name,
cate.cate_data,
cate.cate_exp,
cate.cate_class
from {$this->cate_table} as cate
left join ({$tb_auth}) as auth
on cate.cate_id = auth.cate_id
where {$whereqry} order by cate.cate_code";
$rst = $this->DB->qry($sql, $whererow);
$i = 0;
$rows = Array();
while( $row = $this->DB->fetch_array($rst) ){
$children = $this->getTreeListForTreeView($row['cate_code'], $now_code);
$temp = array(
"id" => $row['cate_id'],
"key" => $row['cate_id'],//
"text" => $row['cate_name'],
"title" => $row['cate_name'],//
"href" => $row['cate_data'],
"icon" => $row['cate_class'],
"selectable" => 0,
"state" => array("expanded"=>false),
"tags" => [''],
"nodes" => $children?:"",
"children" => $children?:"",//
"folder" => $children?true:false,//
);
if( preg_match( "/^{$row['cate_code']}/", $now_code ) ){
$temp['state']['expanded'] = true;
$temp['expanded'] = true;//
}
if( $row['cate_code'] == $now_code ){
$temp['state']['selected'] = true;
$temp['active'] = true;//
}
$rows[] = $temp;
}
return $rows;
}
public function putMenu($sqldata, $auth_area){
/* 권한 추가 */
foreach( (array)$this->authDest as $grpcode => $grpname ){
$readAuth = in_array($grpcode, (array)$sqldata['cate_auth_read']);
$writeAuth = in_array($grpcode, (array)$sqldata['cate_auth_write']);
$deleteAuth = in_array($grpcode, (array)$sqldata['cate_auth_delete']);
$this->AUTH->putAuth(
$this->cate_area,
$sqldata['cate_id'],
$auth_area,
$grpcode,
$this->AUTH->getAuthToNum($readAuth, $writeAuth, $deleteAuth)
);
}
/* 메뉴 등록 */
$sql_row = Array(
"cate_area" => $this->cate_area,
"cate_id" => $sqldata['cate_id']?:"",
"cate_name" => $sqldata['cate_name']?:"",
"cate_data" => $sqldata['cate_data']?:"",
"cate_exp" => $sqldata['cate_exp']?:"",
"cate_class" => $sqldata['cate_class']?:"",
"cate_auth" => $sqldata['cate_auth']?:"",
"cate_use" => $sqldata['cate_use']?:"",
);
$pa_row = $this->cate_info_id($sqldata['parent_id']);
$cate_code = $this->new_cate($pa_row['cate_code']);
$sql_row['cate_code'] = $cate_code;
$rst = $this->DB->insert($this->cate_table, $sql_row);
if( $rst ){
$auth_filepath = explode("\n",preg_replace("\r\n","\n",$sqldata['cate_filepath']));
foreach( (array)$auth_filepath as $path ){
if( trim($path) ){
$sql_row = Array(
"cate_area" => $this->cate_area,
"cate_id" => $sqldata['cate_id']?:"",
"filepath" => $path,
);
$this->DB->insert(TB_menu_auth_page, $sql_row);
}
}
}
return $rst;
}
public function setMenu($sqldata, $auth_area){
/* 권한 수정 */
foreach( (array)$this->authDest as $grpcode => $grpname ){
$readAuth = in_array($grpcode, (array)$sqldata['cate_auth_read']);
$writeAuth = in_array($grpcode, (array)$sqldata['cate_auth_write']);
$deleteAuth = in_array($grpcode, (array)$sqldata['cate_auth_delete']);
$this->AUTH->setAuth(
$this->cate_area,
$sqldata['cate_id'],
$auth_area,
$grpcode,
$this->AUTH->getAuthToNum($readAuth, $writeAuth, $deleteAuth),
$sqldata['parent_id']
);
}
/* 메뉴 수정 */
$sql_row = Array(
"cate_area" => $this->cate_area,
"cate_id" => $sqldata['cate_id']?:"",
"cate_name" => $sqldata['cate_name']?:"",
"cate_data" => $sqldata['cate_data']?:"",
"cate_exp" => $sqldata['cate_exp']?:"",
"cate_class" => $sqldata['cate_class']?:"",
"cate_auth" => $sqldata['cate_auth']?:"",
"cate_use" => $sqldata['cate_use']?:"",
);
$where = $this->getAreaQry();
$where->add("cate_id = ?",$sqldata['parent_id']);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$rst = $this->DB->update($this->cate_table, $sql_row, $whereqry, $whererow);
if( $rst ){
$where = new DB_where("and");
$where->add("cate_area = ?", $this->cate_area);
$where->add("cate_id = ?", $sqldata['cate_id']?:"");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$this->DB->delete(TB_menu_auth_page, $whereqry, $whererow);
$auth_filepath = explode("\n",preg_replace("/\r\n/ims","\n",$sqldata['cate_filepath']));
foreach( (array)$auth_filepath as $path ){
if( trim($path) ){
$sql_row = Array(
"cate_area" => $this->cate_area,
"cate_id" => $sqldata['cate_id']?:"",
"filepath" => $path,
);
$this->DB->insert(TB_menu_auth_page, $sql_row);
}
}
}
return $rst;
}
public function delMenu($cate_id, $auth_area="", $auth_target=""){
$caterow = $this->cate_info_id($cate_id);
$rst = $this->drop_cate($caterow['cate_code']);
if( $rst ){
$rst = $rst && $this->AUTH->delAuth($this->cate_area, $cate_id, $auth_area, $auth_target);
}
return $rst;
}
public function getMenuIdFromUrl($url){
$where = new DB_where("and");
$where->add("cate_area = ?", $this->cate_area);
//$where->add("filepath like ?", "%{$url}%");
$where->add("CHARINDEX(filepath, ?) <> 0", $url);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select cate_id from ".TB_menu_auth_page." where {$whereqry}";
return $this->DB->queryFirstField($sql,$whererow);
}
public function hasMenuAuth($auth, $cate_id=""){
if( !$cate_id ){
if( $GLOBALS['_Auth_']['cate_id'] ){
$cate_id = $GLOBALS['_Auth_']['cate_id'];
}else{
$cate_id = $this->getMenuIdFromUrl($_SERVER['SCRIPT_URI']);
}
}
return $this->AUTH->hasAuth($auth, $this->cate_area, $cate_id);
}
public function getMenuBrdcom($cate_id){
$menu_info = $this->cate_info_id($cate_id);
return $this->history_cate($menu_info['cate_code']);
}
public function set_cate_area($cate_area=""){
$this->cate_area = $cate_area?:"service";
$this->authDest = $this->gsetAuthTarget("all");
}
public function gsetAuthTarget( $type="", $include_sa="" ){
switch( $this->cate_area ){
case "admin":
$authTarget = $GLOBALS['_varsAuthAdmin'];
break;
case "service":
if( $type == "all" ){
$authTarget = array_merge($GLOBALS['_varsAuthAdmin'], $GLOBALS['_varsAuthMember']);
}else{
$authTarget = $GLOBALS['_varsAuthMember'];
}
break;
}
if( !$include_sa ){
unset($authTarget['SA']); //슈퍼관리자 제외
}
return $authTarget;
}
}

200
lib/app/mlang.class.php Normal file
View File

@ -0,0 +1,200 @@
<?php
namespace cUtil;
use Cmanage;
use DB_where;
if( !defined("TB_comment") ){
define("TB_comment","");
}
if( !defined("TB_comment_lang") ){
define("TB_comment_lang","");
}
Class Mlang extends Cmanage {
public $LANG;
public $TB;
function __construct(){
parent::__construct(TB_comment);
$this->TB = TB_comment;
$this->DB->tableExists($this->TB);
$this->DB->tableExists(TB_comment_lang);
$this->LANG = "KR";
}
function loadWord( $str, $lang="" ){
$tran = $this->getWord( $str, $lang );
if( !$tran ){
$this->putWord( $str );
}else{
return $tran;
}
return $str;
}
function getTran( $str, $isId="" ){
$where = new DB_where("and");
if( $isId ){
$where->add("TRAN_ID = ?", $str);
}else{
$where->add("TRAN_TEXT = ?", $str);
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from {$this->TB} where {$whereqry}";
$this->DB->query_record = false; //query log 기록 금지
$txt = $this->DB->queryFirstRow($sql, $whererow);
$this->DB->query_record = true; //query log 기록 재개
if( $txt ){
$tran = (Array)json_decode($txt['TRAN_DATA']);
return $tran;
}
return false;
}
function getWordList($fields, $where=""){
if( !$where ){
$where = new DB_where("and");
}
$orderby="TRAN_TEXT asc";
$limit=array();
$rows = $this->getDataList($fields, $where, $orderby, $limit);
return $rows;
}
public function getWordPage($sqldata, $where=""){
if( !$where ){
$where = new DB_where("and");
}
if( $sqldata['stxt'] ){
$subwhere = $where->sub_where("or");
if( $sqldata['sfld'] ){
$subwhere->add("{$sqldata['sfld']} like ?", "%{$sqldata['stxt']}%");
}else{
$subwhere->add("TRAN_TEXT like ?", "%{$sqldata['stxt']}%");
}
}
$orderby = "TRAN_TEXT desc";
if( $sqldata['ofld'] && $sqldata['oasc'] ){
$orderby = "{$sqldata['ofld']} {$sqldata['oasc']}";
}
$query = array(
"mode" => $sqldata['mode'],
"viewnum" => $sqldata['viewnum'],
"sdate" => $sqldata['sdate']?:"",
"fdate" => $sqldata['fdate']?:"",
"page" => $sqldata['page'],
"sfld" => $sqldata['sfld'],
"stxt" => $sqldata['stxt'],
"ofld" => $sqldata['ofld'],
"oasc" => $sqldata['oasc'],
);
$lists = $this->getDataPage("*", $query, $where ,$orderby);
return $lists;
}
function getWord( $str, $lang ){
$str = $this->getTran($str);
$lang = $lang ?: $this->LANG;
if( $str ){
return $str[$lang];
}
return false;
}
function getWordId( $id, $lang="" ){
$str = $this->getTran($id, 1);
$lang = $lang ?: $this->LANG;
if( $str ){
return $str[$lang];
}
return false;
}
function putWord( $str ){
$sqldata = Array(
"TRAN_TEXT" => $str?:"",
"TRAN_DATA" => json_encode(Array("KR"=>$str)),
);
$this->DB->insert($this->TB, $sqldata);
}
function setWord( $str, $stran, $isId="" ){
$tran = $this->getTran( $str, $isId );
$tran = array_filter(array_merge($tran, $stran));
$where = new DB_where("and");
if( $isId ){
$where->add("TRAN_ID = ?", $str);
}else{
$where->add("TRAN_TEXT = ?", $str);
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sqldata = Array(
"TRAN_DATA" => json_encode($tran),
);
return $this->DB->update($this->TB, $sqldata, $whereqry, $whererow);
}
public static function getText( $str, $var=array() ){
$langObj = new Mlang();
if( $langObj->TB ){
$str = $langObj->loadWord( $str );
}
for( $a=0 ; $a<@count($var) ; $a++ ){
$str = str_replace("{@".($a+1)."}", $var[$a], $str);
}
return $str;
}
function getLang ( $slang="" ){
$where = new DB_where("and");
$where->add("bc.Bran_Uid = ?", "nation_code");
$where->add("bc.Code_Uid != ?", "nation_code");
$where->add("bc.Code_Uid != ?", "KR");
$where->add("bc.Active = ?", "Y");
if( $slang ){
$swhere = $where->sub_where("or");
foreach( (array)$slang as $lang ){
$swhere->add("bc.Code_Uid = ?", $lang);
}
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select bc.Code_Uid, bc.Code_Val from ".TB_basecode." as bc left join ".TB_comment_lang." as cl on bc.Code_Uid = cl.LANG_ID where {$whereqry} order by bc.Code_Val";
$row = $this->DB->query($sql, $whererow);
return $row;
}
function setLang($params){
$sql = "delete from ".TB_comment_lang;
$this->DB->qry($sql);
$rows = $this->getLang($params);
foreach( $rows as $lang ){
$qryrow = Array(
"LANG_ID" => $lang['Code_Uid'],
"LANG_NM" => $lang['Code_Val'],
);
$this->DB->insert(TB_comment_lang, $qryrow);
}
}
}

71
lib/app/qrylog.class.php Normal file
View File

@ -0,0 +1,71 @@
<?php
class Qrylog extends Cmanage {
function __construct(){
parent::__construct(TB_query_log);
$this->DB->query_record = false; //query log 기록 금지
$this->DB->tableExists(TB_query_log);
}
public function getQueryList($fields, $where=""){
if( !$where ){
$where = new DB_where("and");
}
$orderby="query_date desc";
$limit=array();
$rows = $this->getDataList($fields, $where, $orderby, $limit);
return $rows;
}
public function getQueryPage($sqldata, $where=""){
if( !$where ){
$where = new DB_where("and");
}
$where->add("query_date >= ?", ($sqldata['sdate']?$sqldata['sdate']:_SDATENULL_)." 00:00:00.000");
$where->add("query_date <= ?", ($sqldata['fdate']?$sqldata['fdate']:_FDATENULL_)." 23:59:59.999");
if( $sqldata['stxt'] ){
$subwhere = $where->sub_where("or");
if( $sqldata['sfld'] ){
$subwhere->add("{$sqldata['sfld']} like ?", "%{$sqldata['stxt']}%");
}else{
$subwhere->add("host_name like ?", "%{$sqldata['stxt']}%");
$subwhere->add("db_name like ?", "%{$sqldata['stxt']}%");
$subwhere->add("query_string like ?", "%{$sqldata['stxt']}%");
$subwhere->add("member_id like ?", "%{$sqldata['stxt']}%");
}
}
$orderby = "query_date desc";
if( $sqldata['ofld'] && $sqldata['oasc'] ){
$orderby = "{$sqldata['ofld']} {$sqldata['oasc']}";
}
$query = array(
"mode" => $sqldata['mode'],
"viewnum" => $sqldata['viewnum'],
"sdate" => $sqldata['sdate']?:"",
"fdate" => $sqldata['fdate']?:"",
"page" => $sqldata['page'],
"sfld" => $sqldata['sfld'],
"stxt" => $sqldata['stxt'],
"ofld" => $sqldata['ofld'],
"oasc" => $sqldata['oasc'],
);
$lists = $this->getDataPage("*", $query, $where ,$orderby);
return $lists;
}
public function getQuery( $cust_id ){
$urow = Array("cust_id" => $cust_id);
$where = "";
$row = $this->getData("*", $urow, $where);
return $row;
}
}

View File

@ -0,0 +1,327 @@
<?php
class RealnameAttach extends Cmanage {
function __construct( $table ){
parent::__construct($table);
$this->DB->query_record = false; //query log 기록 금지
$this->DB->tableExists($this->TB);
}
// public function getFilePath( $gubun, $nid, $sid ){
// $target_dir = _UP_PATH_."/{$gubun}";
// if( !file_exists($target_dir) ){ mkdir($target_dir); }
//
// return $target_dir;
// }
//
// public function getLoadFileinfo( $gubun, $nid, $sid ){
// $target_dir = $this->getFilePath($gubun, $nid, $sid);
//
// $frow = Array(
// "target_dir" => $target_dir,
// "file_name" => "{$nid}_{$sid}.dat",
// "file_path" => "{$target_dir}/{$nid}_{$sid}.dat",
// );
// return $frow;
// }
//
// public function getSaveFileinfo( $gubun, $nid, $sid, $filename="" ){
// $target_dir = $this->getFilePath($gubun, $nid, $sid);
//
// $new_filename = "{$nid}_{$sid}.dat";
// $frow = Array(
// "target_dir" => $target_dir,
// "file_name" => $filename,
// "file_path" => $target_dir."/".$new_filename,
// );
// return $frow;
// }
//
// public function getConvFileinfo( $gubun, $nid, $sid, $filename="" ){
// $target_dir = $this->getFilePath($gubun, $nid, $sid);
//
// $frow = Array(
// "target_dir" => $target_dir,
// "file_name" => "{$nid}_{$sid}.dat",
// "file_path" => "{$target_dir}/{$nid}_{$sid}.dat?*",
// );
// return $frow;
// }
public function getFilePath( $gubun, $nid, $sid="" ){
$target_dir = _UP_PATH_."/{$gubun}";
if( !file_exists($target_dir) ){ mkdir($target_dir); }
if( !is_array($nid) ){
$nid = explode("/",$nid);
}
foreach( $nid as $new_dir ){
$target_dir .= "/{$new_dir}";
if( !file_exists($target_dir) ){ mkdir($target_dir); }
}
// $target_dir .= "/{$sid}";
// if( !file_exists($target_dir) ){ mkdir($target_dir); }
return $target_dir;
}
public function getLoadFileinfo( $gubun, $nid, $sid ){
//$target_dir = $this->getFilePath( $gubun, $nid, $sid );
$target_dir = _UP_PATH_."/{$gubun}/";
$frow = $this->getAttach( $gubun, $nid, $sid );
$target_dir .= $frow['nid'];
$frow['target_dir'] = $target_dir;
$frow['file_path'] = "{$target_dir}/{$frow['file_name']}";
return $frow;
}
public function getSaveFileinfo( $gubun, $nid, $sid, $filename="" ){
$target_dir = $this->getFilePath( $gubun, $nid, $sid );
$new_filename = $this->getDupFilename($target_dir, $filename);
$frow = Array(
"target_dir" => $target_dir,
"file_name" => $new_filename,
"file_path" => $target_dir."/".$new_filename,
);
return $frow;
}
public function getConvFileinfo( $gubun, $nid, $sid, $filename="" ){
//$target_dir = $this->getFilePath( $gubun, $nid, $sid );
$target_dir = _UP_PATH_."/{$gubun}/";
$frow = $this->getAttach( $gubun, $nid, $sid );
$target_dir .= $frow['nid'];
$frow['target_dir'] = $target_dir;
$frow['file_path'] = "{$target_dir}/{$frow['file_name']}?*";
return $frow;
}
public function getAttachList($fields, $gubun, $nid="", $adfleld=array(), $orderby=""){
$where = new DB_where("and");
if( $gubun ){
$where->add("gubun = ?", $gubun);
}
if( $nid ){
$where->add("nid = ?", $this->getNidPath($nid));
}
if( $adfleld ){
if( is_array($adfleld) ){
foreach( $adfleld as $key => $val ){
$where->add("{$key} = ?", $val);
}
}else{
$orderby = $orderby ?: $adfleld;
}
}
$orderby=$orderby?:"file_id desc";
$limit=array();
$rows = $this->getDataList($fields, $where, $orderby, $limit);
for( $a=0 ; $a<count($rows) ; $a++ ){
$rows[$a]['file_url'] = _SITE_INC_URL_."/getFile.php?gubun={$rows[$a]['gubun']}&sid={$rows[$a]['sid']}";
}
return $rows;
}
public function getAttach( $gubun, $nid, $sid ){
$whererow = Array(
"gubun" => $gubun,
//"nid" => $this->getNidPath($nid),
"sid" => $sid,
);
if( $nid ){
$whererow["nid"] = $this->getNidPath($nid);
}
$row = $this->getData("*", $whererow);
$row['file_url'] = _SITE_INC_URL_."/getFile.php?gubun={$row['gubun']}&sid={$row['sid']}";
return $row;
}
public function getAttachId( $file_id ) {
$whererow = Array(
"file_id" => $file_id,
);
$row = $this->getData("*", $whererow);
$row['file_url'] = _SITE_INC_URL_."/getFile.php?gubun={$row['gubun']}&sid={$row['sid']}";
return $row;
}
public function getNidPath( $nid ){
if( !is_array($nid) ){
$nid = explode("/",$nid);
}
return implode("/",$nid);
}
public function putAttach( $upfile, $gubun, $nid, $sid="", $adfield=array(), $upload_user_name="", $code_id="") {
$sfile = $this->getSaveFileinfo($gubun, $nid, $sid, $upfile['name']);
$save_file = $sfile['file_path'];
$rst = move_uploaded_file($upfile['tmp_name'], $save_file);
if( !$rst ) return false;
if( strpos($upfile['type'], "image") !== false ){
$iinfo = getimagesize($save_file);
$upfile['width'] = $iinfo[0];
$upfile['height'] = $iinfo[1];
}
$sid = $sid ?: uniqid();
$sqldata = Array(
"gubun" => $gubun?:"",
"nid" => $this->getNidPath($nid)?:"",
"sid" => $sid?:"",
"file_name" => $sfile['file_name']?:$upfile['name'],
"file_size" => $upfile['size']?:0,
"file_type" => $upfile['type']?:"",
"file_width" => $upfile['width']?:"",
"file_height" => $upfile['height']?:"",
"file_remk" => $upfile['file_remk']?:"",
"file_sig_flg" => $upfile['file_sig_flg']?:"",
"upload_user_name"=> $upload_user_name?:"",
"code_id" => $code_id?:"",
"reg_date" => $this->DB->sqleval("getdate()"),
);
if( $adfield ) {
$sqldata = array_merge($sqldata, $adfield);
}
return $this->putData( $sqldata );
}
public function putAppAttach($upfile, $sid="", $adfield=array(), $upload_user_name=""){ //앱용 업로드
$nid = $upfile['nid'];
$gubun = $upfile['gubun'];
$code_id = $upfile['code_id'];
$this->putAttach( $upfile, $gubun, $nid, $sid, $adfield, $upload_user_name, $code_id );
}
public function setAttach( $upfile, $gubun, $nid, $sid, $adfield=array(), $upload_user_name="", $code_id="" ) {
$sfile = $this->getSaveFileinfo($gubun, $nid, $sid, $upfile['name']);
$save_file = $sfile['file_path'];
$rst = move_uploaded_file($upfile['tmp_name'], $save_file);
if( !$rst ) return false;
if( strpos($upfile['type'], "image") !== false ){
$iinfo = getimagesize($save_file);
$upfile['width'] = $iinfo[0];
$upfile['height'] = $iinfo[1];
}
$sqldata = Array(
"gubun" => $gubun?:"",
"nid" => $this->getNidPath($nid)?:"",
"sid" => $sid?:"",
"file_name" => $sfile['file_name']?:$upfile['name'],
"file_size" => $upfile['size']?:0,
"file_type" => $upfile['type']?:"",
"file_width" => $upfile['width']?:"",
"file_height" => $upfile['height']?:"",
"file_remk" => $upfile['file_remk']?:"",
"file_sig_flg" => $upfile['file_sig_flg']?:"",
"upload_user_name"=> $upload_user_name?:"",
"code_id" => $code_id?:"",
"reg_date" => $this->DB->sqleval("getdate()"),
);
if( $adfield ) {
$sqldata = array_merge($sqldata, $adfield);
}
$whererow = Array(
"gubun" => $gubun?:"",
"nid" => $this->getNidPath($nid)?:"",
"sid" => $sid?:"",
);
return $this->setData( $sqldata, $whererow );
}
public function setAttachId( $upfile, $file_id, $upload_user_name="" ) {
$ainfo = $this->getAttachId( $file_id );
if( !$ainfo['file_id'] ) return false;
return $this->setAttach( $upfile, $ainfo['gubun'], $ainfo['nid'], $ainfo['sid'], $upload_user_name );
}
public function delAttach( $gubun, $nid, $sid ){
$urow = Array();
$urow['gubun'] = $gubun;
$urow['nid'] = $this->getNidPath($nid);
$urow['sid'] = $sid;
$where = "";
$load_finfo = $this->getLoadFileinfo($gubun, $this->getNidPath($nid), $sid);
$conv_finfo = $this->getConvFileinfo($gubun, $this->getNidPath($nid), $sid);
$load_file = $load_finfo['file_path'];
$conv_file = $conv_finfo['file_path'];
$rst = $this->fileRemove("{$load_file}");
$rst = $rst && $this->fileRemove("{$conv_file}");
p($remake);
if( !$rst ) return false;
return $this->delData($urow, $where);
}
public function delAttachId( $file_id ){
$ainfo = $this->getAttachId( $file_id );
return $this->delAttach( $ainfo['gubun'], $ainfo['nid'], $ainfo['sid'] );
}
static function fByte($bytes, $precision=2) {
$unit = ["B", "KB", "MB", "GB"];
$exp = floor(log($bytes, 1024)) ?: 0;
return round($bytes / (pow(1024, $exp)), $precision).$unit[$exp];
}
static function fileRemove($filepath, $unremove=""){
$glob = glob($filepath);
foreach( $glob as $filename ) {
if( !$unremove || $filename != $unremove ){
@unlink($filename);
}
}
return true;
}
public function getDupFilename( $target_dir, $oriFilename, $cnt=0 ){
if( !$oriFilename ) return "";
if( $cnt === 0 ){
$chkFilename = $oriFilename;
}else{
$orin = explode(".",$oriFilename);
if( count($orin) > 1 ){
$orin[count($orin)-2] .= "({$cnt})";
}else{
$orin[count($orin)-1] .= "({$cnt})";
}
$chkFilename = implode(".", $orin);
}
if( file_exists("{$target_dir}/{$chkFilename}") ){
$chkFilename = $this->getDupFilename( $target_dir, $oriFilename, ++$cnt );
}
return $chkFilename;
}
public function file_reverse( $upfile ){
$files = Array();
if( is_array($upfile['name']) ){
foreach( $upfile as $key => $val ){
foreach( $val as $k => $v ){
$files[$k][$key] = $v;
}
}
}else{
$files[] = $upfile;
}
return $files;
}
}

325
lib/app/visit.class.php Normal file
View File

@ -0,0 +1,325 @@
<?php
class Visit extends BaseCode {
function __construct(){
parent::__construct();
$this->DB->query_record = false; //query log 기록 금지
$this->DB->tableExists( TB_visit_sess );
$this->DB->tableExists( TB_visit_sess_count );
$this->DB->tableExists( TB_visit_log );
$this->DB->tableExists( TB_visit_log_count );
}
function getVisitList( $tb, $field="*", $where="", $orderby="", $limit=array() ){ //방문 리스트 (공통)
if( !$where ){
$where = new DB_where("and");
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//$sql = "select {$field} from {$tb} where {$whereqry} ".(($orderby)?"order by {$orderby}":""). $this->DB->_limit($limit[0],$limit[1]);
$sql = $this->DB->addLimit("select {$field} from {$tb} where {$whereqry}",$orderby,$limit[0],$limit[1]);
$rst = $this->DB->qry($sql, $whererow);
$row = array();
while( $tmp = $this->DB->fetch_array($rst) ){
$tmp['visit_date'] = getDT_datetime($tmp['visit_date']);
$row[] = $tmp;
}
return $row;
}
function getVisitPage($tb, $sqldata=array(), $query=array(), $where=""){ //방문 리스트 (공통-페이징)
if( !$where ){
$where = new DB_where("and");
}
$where->add("visit_date >= ?", ($sqldata['sdate']?$sqldata['sdate']:_SDATENULL_)." 00:00:00.000");
$where->add("visit_date <= ?", ($sqldata['fdate']?$sqldata['fdate']:_FDATENULL_)." 23:59:59.999");
if( $sqldata['stxt'] ){
$subwhere = $where->sub_where("or");
if( $sqldata['sfld'] ){
$subwhere->add("{$sqldata['sfld']} like ?", "%{$sqldata['stxt']}%");
}else{
$subwhere->add("visit_url like ?", "%{$sqldata['stxt']}%");
$subwhere->add("visit_ref like ?", "%{$sqldata['stxt']}%");
$subwhere->add("visit_ip like ?", "%{$sqldata['stxt']}%");
$subwhere->add("visit_sess like ?", "%{$sqldata['stxt']}%");
}
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$orderby = "nid desc";
if( $sqldata['ofld'] && $sqldata['oasc'] ) $orderby = "{$sqldata['ofld']} {$sqldata['oasc']}";
$query = array_merge(array(
"mode" => $sqldata['mode'],
"viewnum" => $sqldata['viewnum'],
"sdate" => $sqldata['sdate']?:"",
"fdate" => $sqldata['fdate']?:"",
"sfld" => $sqldata['sfld'],
"stxt" => $sqldata['stxt'],
"ofld" => $sqldata['ofld'],
"oasc" => $sqldata['oasc'],
), $query);
$lists = new clist();
$lists->fld = "*";
$lists->where = $whereqry;
$lists->whererow = $whererow;
$lists->orderby = $orderby;
$lists->url = $_SERVER['PHP_SELF'];
$lists->query = $query;
$lists->page = $sqldata['page']?:1;
$lists->linktype = "";
$lists->viewnum = $query['viewnum']?:20;
$lists->rownum = $query['rownum']?:5;
$lists->getCommonList($tb);
for( $a=0 ; $a<@count($lists->rows) ; $a++ ){;
$lists->rows[$a]['visit_date'] = getDT_datetime($lists->rows[$a]['visit_date']);
}
return $lists;
}
function getVisitSessList( $field="*", $where="", $orderby="", $limit=array() ){ //사이트 접근 리스트
return $this->getVisitList(TB_visit_sess, $field, $where, $orderby, $limit);
}
function getVisitSessPage( $sqldata=array(), $query=array(), $where="" ){ //사이트 접근 리스트 페이지
return $this->getVisitPage(TB_visit_sess, $sqldata, $query, $where);
}
function getVisitLogList( $field="*", $where="", $orderby="", $limit=array() ){ //사이트 조회 리스트
return $this->getVisitList(TB_visit_log, $field, $where, $orderby, $limit);
}
function getVisitLogPage( $sqldata=array(), $query=array(), $where="" ){ //사이트 조회 리스트 페이지
return $this->getVisitPage(TB_visit_log, $sqldata, $query, $where);
}
function putVisitRec($vtype="",$cate_id=""){ //방문자 로그 기록
$ip = get_ip();
$time = time();
//세션생성
if( !$_SESSION['visit_sess'] ){
$_SESSION['visit_sess'] = md5($time.$ip);
}
if(
$_SESSION['visit_last_urls'] != $_SERVER['REQUEST_URI'] && $_SESSION['visit_last_ajax'] != $_SERVER['REQUEST_URI'] || //새로고침은 기록 안함
($_SESSION['visit_last_time'] + ($GLOBALS['_varsBaseCode']['refresh_time']?:3600)) < time() //새로고침이라 할지라도 일정시간 이내의 새로고침은 기록
){
//로그기록 등록
$this->putVisitDetailRec($vtype,$cate_id);
}
//마지막 페이지 접근내역
if( preg_match("/\.ajax\./i", $_SERVER['REQUEST_URI']) ){
$_SESSION['visit_last_ajax'] = $_SERVER['REQUEST_URI'];
}else{
$_SESSION['visit_last_urls'] = $_SERVER['REQUEST_URI'];
}
$_SESSION['visit_last_time'] = $time;
}
function putVisitDetailRec($vtype="",$cate_id=""){ //로그기록 등록
if( !$_SESSION['visit_sess'] ) return false;
//세션 로그기록 등록
$this->putVisitSessRec($vtype);
//방문 로그 등록 (페이지뷰)
$this->putVisitLogRec($vtype,$cate_id);
}
function putVisitSessRec($vtype=""){ //방문 세션 기록
if( !$_SESSION['visit_sess'] ) return false;
$where = new DB_where("and");
$where->add("visit_sess = ?", $_SESSION['visit_sess']);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select count(*) from ".TB_visit_sess." where {$whereqry}";
$cnt = $this->DB->queryFirstField($sql,$whererow);
if( !$cnt ){ //최초 세션 등록
$this->DB->insert( TB_visit_sess, array("visit_sess"=>$_SESSION['visit_sess'], "member_id"=>($GLOBALS['_Umem']['member_id']?:""), "visit_ip"=>get_ip(), "visit_total"=>1) ); //세션 추가
$where = new DB_where("and");
$where->add("visit_date = ?", date("Y-m-d"));
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select count(*) from ".TB_visit_sess_count." where {$whereqry}";
$cnt = $this->DB->queryFirstField($sql, $whererow);
if( !$cnt ){ //시간별 세션등록통계가 없으면 insert
$this->DB->insert( TB_visit_sess_count, array("visit_week"=>date("w")) );
}
$sql = "update ".TB_visit_sess_count." set visit_total = visit_total + 1, h".date("H")." = h".date("H")." + 1 where {$whereqry}";
$this->DB->qry( $sql, $whererow );
}else{ //세션이 방문한 페이지수 증가
$sqladd = "";
if( $GLOBALS['_Umem']['member_id'] ){
$sqladd = "member_id = '{$GLOBALS['_Umem']['member_id']}',";
}
$sql = "update ".TB_visit_sess." set {$sqladd} visit_total = visit_total + 1, visit_fdate = CURRENT_TIMESTAMP where {$whereqry}";
$this->DB->qry( $sql, $whererow );
}
}
function putVisitLogRec($vtype="",$cate_id=""){ //방문페이지(페이지뷰) 기록
if( !$_SESSION['visit_sess'] ) return false;
$where = new DB_where("and");
$where->add("visit_date = ?", date("Y-m-d"));
$where->add("visit_type = ?", $vtype);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select count(*) from ".TB_visit_log_count." where {$whereqry}";
$cnt = $this->DB->queryFirstField($sql, $whererow);
if( !$cnt ){ //시간별 페이지뷰통계가 없으면 insert
$this->DB->insert( TB_visit_log_count, array("visit_type"=>$vtype,"visit_week"=>date("w")) );
}
//시간별 페이지뷰통계 증가
$sql = "update ".TB_visit_log_count." set visit_total = visit_total + 1, h".date("H")." = h".date("H")." + 1 where {$whereqry}";
$this->DB->qry( $sql, $whererow );
$connect_info = parse_user_agent();
$sql_row = array(
"visit_type" => $vtype,
"cate_id" => $cate_id?:"",
"visit_sess" => $_SESSION['visit_sess']?:"",
"visit_url" => $_SERVER['REQUEST_URI']?:"",
"visit_ref" => $_SERVER['HTTP_REFERER']?:"",
"visit_browser" => "{$connect_info['browser']} | {$connect_info['version']}",
"visit_os" => $connect_info['platform']?:"",
"visit_ip" => get_ip(),
);
//개별 페이지 방문 기록
return $this->DB->insert( TB_visit_log, $sql_row );
}
function setLoginRec(){ //로그인시 ID 기록
$where = new DB_where("and");
$where->add("visit_sess = ?", $_SESSION['visit_sess']);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "update ".TB_visit_sess." set member_id = ? where {$whereqry}";
return $this->DB->qry($sql, array_merge(array($_SESSION['auth_mem_id']?:""),$whererow));
}
function getVisitData($mode, $type="LOG", $vtype="", $start_day="", $end_day="", $where=""){
if( !$end_day ) $end_day = date("Y-m-d");
if( !$start_day ) $start_day = date("Y-m-d",strtotime($end_day." -1 Month +1 day"));
if( !$where ){
$where = new DB_where("and");
}
$where->add("visit_date >= ?", $start_day);
$where->add("visit_date <= ?", $end_day);
if( $type == "LOG" ){
$where->add("visit_type = ?", $vtype);
$tbl = TB_visit_log_count;
}else{
$tbl = TB_visit_sess_count;
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$row = array();
switch( $mode ){
case "hour":
$h_row = array();
for( $a=0 ; $a<24 ; $a++ ){
$h_str = "h".str_pad($a, 2, "0", STR_PAD_LEFT);
$h_row[] = "sum({$h_str}) as {$h_str}";
}
$sql = "select ".implode(",",$h_row)." from {$tbl} where {$whereqry} ";
$row = $this->DB->queryFirstRow($sql, $whererow);
break;
case "day":
if( (strtotime($end_day) - strtotime($start_day)) > 31*86400 ) $end_day = date("Y-m-d",strtotime($start_day." +1 Month -1 day")); //1개월이내로 제한
$days = floor((strtotime($end_day) - strtotime($start_day)) / 86400);
for( $a=0 ; $a<=$days ; $a++ ){
$nday = date("Y-m-d", strtotime("{$start_day} +{$a} day"));
$row[$nday] = 0;
}
$sql = "select visit_date as date, visit_total as visit from {$tbl} where {$whereqry} ";
$rst = $this->DB->qry($sql, $whererow);
while( $tmp = $this->DB->fetch_array($rst) ){
$row[getDT_date($tmp['date'])] = $tmp['visit'];
}
break;
case "dayw":
$days = floor((strtotime($end_day) - strtotime($start_day)) / 86400);
$sql = "select visit_date as date, visit_total as visit from {$tbl} where {$whereqry} order by visit_date asc";
$rst = $this->DB->qry($sql, $whererow);
$trow = array();
while( $tmp = $this->DB->fetch_array($rst) ){
$trow[getDT_date($tmp['date'])] = $tmp['visit'];
}
$row = array();
for( $a=0 ; $a<7 ; $a++ ){
$dword = date("Y-m-d", strtotime($start_day." +{$a} days"));
$row[] = $trow[$dword] ?: 0;
}
break;
case "week":
$h_row = array();
for( $a=0 ; $a<7 ; $a++ ){
$h_row[] = "sum(iif(visit_week = {$a}, visit_total, 0)) as w{$a}";
}
$sql = "select ".implode(",",$h_row)." from {$tbl} where {$whereqry} ";
$row = $this->DB->queryFirstRow($sql, $whererow);
break;
case "mon":
$sday = explode("-",$start_day);
$eday = explode("-",$end_day);
if( (($eday[0]*12+intval($eday[1])) - ($eday[0]*12+intval($eday[1]))) != 12 ) $start_day = date("Y-m-d",strtotime($end_day." -11 Month")); //12개월이내로 제한
$sday = explode("-",$start_day);
$mons = ($eday[0]*12+intval($eday[1])) - ($sday[0]*12+intval($sday[1]));
$m_row = array();
for( $a=0 ; $a<=$mons ; $a++ ){
$m_str = date("Y-m",strtotime("{$sday[0]}-{$sday[1]}-01 +{$a} month"));
$m_row[] = "sum(iif(visit_date like '{$m_str}%', visit_total, 0)) as '{$m_str}'";
}
$sql = "select ".implode(",",$m_row)." from {$tbl} where {$whereqry} ";
$row = $this->DB->queryFirstRow($sql, $whererow);
break;
}
return array(
"start_day" => $start_day,
"end_day" => $end_day,
"mons" => $mons,
"days" => $days,
"data" => $row,
);
}
}

292
lib/base/basecode.class.php Normal file
View File

@ -0,0 +1,292 @@
<?php
Class BaseCode extends BaseDB {
function __construct($db_option=""){
parent::__construct($db_option);
$this->DB->tableExists(TB_basecode);
}
public function getAllBaseCodeList($Bran_Uid="", $Group_Uid="", $Code_Uid="", $where=""){
if( !$where ){
$where = new DB_where("and");
}
if( $Bran_Uid !== "" ) $where->add("CD.Bran_Uid = ?", $Bran_Uid);
if( $Group_Uid !== "" ) $where->add("CD.Group_Uid = ?", $Group_Uid);
if( $Code_Uid !== "" ) $where->add("CD.Code_Uid = ?", $Code_Uid);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select
CD.Bran_Uid
,BR.Code_Val as Bran_Val
,CD.Group_Uid
,GR.Code_Val as Group_Val
,CD.Code_Uid
,CD.Code_Val
,CD.Code_Exp
,BR.Code_Idx as Bran_Idx
,case when CD.Bran_Uid = CD.Code_Uid then -1 else GR.Code_Idx end as Group_Idx
,CD.Code_Idx
,case when CD.Bran_Uid = CD.Code_Uid then -1 when CD.Group_Uid = CD.Code_Uid then 0 else CD.Code_Idx end as Code_Idx2
,BR.Active as Bran_Active
,GR.Active as Group_Active
,CD.Active as Code_Active
from ". TB_basecode ." as CD
inner join ". TB_basecode ." as BR on CD.Bran_Uid = BR.Code_Uid
inner Join ". TB_basecode ." as GR on CD.Bran_Uid = GR.Bran_Uid and CD.Group_Uid = GR.Code_Uid
where {$whereqry}
order by Bran_Idx, Bran_Uid, Group_Idx, Group_Uid, Code_Idx2, Code_Uid";
$this->DB->query_record = false; //query log 기록 금지
$rows = $this->DB->query($sql, $whererow);
$this->DB->query_record = true; //query log 기록 재개
return $rows;
}
public function getBaseCodeList($Bran_Uid="", $Group_Uid="", $Code_Uid="", $where=""){
if( !$where ){
$where = new DB_where("and");
}
$where->add("BR.Active = ?", 'Y');
$where->add("GR.Active = ?", 'Y');
$where->add("CD.Active = ?", 'Y');
return $this->getAllBaseCodeList($Bran_Uid, $Group_Uid, $Code_Uid, $where);
}
public function getBaseCode($Bran_Uid="", $Group_Uid="", $Code_Uid="", $where=""){
if( !$where ){
$where = new DB_where("and");
}
if( $Bran_Uid !== "" ) $where->add("Bran_Uid = ?", $Bran_Uid);
if( $Group_Uid !== "" ) $where->add("Group_Uid = ?", $Group_Uid);
if( $Code_Uid !== "" ) $where->add("Code_Uid = ?", $Code_Uid);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from ". TB_basecode ." where {$whereqry}";
$row = $this->DB->queryFirstRow($sql, $whererow);
return $row;
}
public function putBaseCode($sqldata){
return $this->DB->insert(TB_basecode, $sqldata);
}
public function setBaseCode($sqldata, $Bran_Uid="", $Group_Uid="", $Code_Uid="", $where=""){
if( !$where ){
$where = new DB_where("and");
}
if( $Bran_Uid !== "" ) $where->add("Bran_Uid = ?", $Bran_Uid);
if( $Group_Uid !== "" ) $where->add("Group_Uid = ?", $Group_Uid);
if( $Code_Uid !== "" ) $where->add("Code_Uid = ?", $Code_Uid);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->update(TB_basecode, $sqldata, $whereqry, $whererow);
}
public function delBaseCode($Bran_Uid="", $Group_Uid="", $Code_Uid="", $where=""){
if( !$where ){
$where = new DB_where("and");
}
if( $Bran_Uid !== "" ) $where->add("Bran_Uid = ?", $Bran_Uid);
if( $Group_Uid !== "" ) $where->add("Group_Uid = ?", $Group_Uid);
if( $Code_Uid !== "" ) $where->add("Code_Uid = ?", $Code_Uid);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->delete(TB_basecode, $whereqry, $whererow);
}
public function sortBaseCode($Bran_Uid, $Group_Uid, $Code_Uid, $Code_Idx, $adv=1){ //$incl => 코드 추가시 현 Code_Uid의 Code_idx 값보다 +1 씩 해서 sort 값을 줘야 하나, 삭제시에는 Code_Uid 자리부터 시작하므로 +1 하지 않기 위함.
$Code_Idx = $Code_Idx?:1;
$where = new DB_where("and");
$where->add("Code_Uid != ?",$Code_Uid);
$where->add("Code_Idx >= ?",$Code_Idx);
if( $Bran_Uid == $Code_Uid ){
$where->add("Bran_Uid = ?",$this->DB->sqleval("Code_Uid"));
}else if( $Group_Uid == $Code_Uid ){
$where->add("Bran_Uid = ?",$Bran_Uid);
$where->add("Group_Uid = ?",$this->DB->sqleval("Code_Uid"));
$where->add("Bran_Uid != ?",$this->DB->sqleval("Code_Uid"));
}else{
$where->add("Bran_Uid = ?",$Bran_Uid);
$where->add("Group_Uid = ?",$Group_Uid);
$where->add("Bran_Uid != ?",$this->DB->sqleval("Code_Uid"));
$where->add("Group_Uid != ?",$this->DB->sqleval("Code_Uid"));
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from ". TB_basecode ." where {$whereqry} order by Code_Idx";
$rst = $this->DB->qry($sql, $whererow);
$sidx = $Code_Idx + $adv;
$urst = true;
while( $row = $this->DB->fetch_array($rst) ){
$sqldata = Array("Code_Idx" => $sidx++);
$uwhere = new DB_where("and");
$uwhere->add("Bran_Uid = ?", $row['Bran_Uid']);
$uwhere->add("Group_Uid = ?", $row['Group_Uid']);
$uwhere->add("Code_Uid = ?", $row['Code_Uid']);
$uwqry = $uwhere->get_where();
$uwhereqry = $uwqry['qry'];
$uwhererow = $uwqry['val'];
$urst = $urst && $this->DB->update(TB_basecode, $sqldata, $uwhereqry, $uwhererow);
}
return $urst;
}
public function getMaxBaseCodeIdx($Bran_Uid="", $Group_Uid="", $where=""){
if( !$where ){
$where = new DB_where("and");
}
if( $Bran_Uid !== "" ){
$where->add("Bran_Uid = ?", $Bran_Uid);
$where->add("Bran_Uid != ?", $this->DB->sqleval("Code_Uid"));
}else{
$where->add("Bran_Uid = ?", $this->DB->sqleval("Group_Uid"));
}
if( $Group_Uid !== "" ){
$where->add("Group_Uid = ?", $Group_Uid);
$where->add("Group_Uid != ?", $this->DB->sqleval("Code_Uid"));
}else{
$where->add("Group_Uid = ?", $this->DB->sqleval("Code_Uid"));
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select max(Code_Idx) from ". TB_basecode ." where {$whereqry}";
$maxIdx = $this->DB->queryFirstField($sql, $whererow);
return $maxIdx;
}
public function getBaseCodeVars($Bran_Uid="", $Group_Uid=""){
$Bran_Uid = $Bran_Uid?:$Group_Uid;
$where = new DB_where("and");
$where->add("CD.Group_Uid != ?", $this->DB->sqleval("CD.Code_Uid"));
$row = $this->getBaseCodeList($Bran_Uid, $Group_Uid, "", $where);
$ret = array();
foreach( (array)$row as $val ){
$ret[$val['Code_Uid']] = $val['Code_Val'];
}
return $ret;
}
public function getBaseGroupVars($Bran_Uid){
$where = new DB_where("and");
$where->add("CD.Bran_Uid != ?", $this->DB->sqleval("CD.Code_Uid"));
$row = $this->getBaseCodeList($Bran_Uid, "", "", $where);
$ret = array();
foreach( (array)$row as $val ){
if( $val['Group_Uid'] == $val['Code_Uid'] ){
$ret[$val['Group_Uid']] = $val;
}else{
$ret[$val['Group_Uid']]['children'][$val['Code_Uid']] = $val['Code_Val'];
}
}
return $ret;
}
public function getBaseGCodeVars($Bran_Uid="", $Group_Uid=""){
$Bran_Uid = $Bran_Uid?:$Group_Uid;
$where = new DB_where("and");
$where->add("CD.Group_Uid != ?", $this->DB->sqleval("CD.Code_Uid"));
$row = $this->getBaseCodeList($Bran_Uid, $Group_Uid, "", $where);
$ret = array();
foreach( (array)$row as $val ){
if( !isset($ret[$val['Group_Uid']]) ){
$ret[$val['Group_Uid']] = array();
}
$ret[$val['Group_Uid']][$val['Code_Uid']] = $val['Code_Val'];
}
return $ret;
}
public function getBaseCodeVarsExp($Bran_Uid="", $Group_Uid=""){
$Bran_Uid = $Bran_Uid?:$Group_Uid;
$where = new DB_where("and");
$where->add("CD.Group_Uid != ?", $this->DB->sqleval("CD.Code_Uid"));
$row = $this->getBaseCodeList($Bran_Uid, $Group_Uid, "", $where);
$ret = array();
foreach( (array)$row as $val ){
$ret[$val['Code_Uid']] = Array($val['Code_Val'],$val['Code_Exp']);
}
return $ret;
}
public function getBaseCodeVarsAll($Bran_Uid="", $Group_Uid=""){
$Bran_Uid = $Bran_Uid?:$Group_Uid;
$where = new DB_where("and");
$where->add("CD.Group_Uid != ?", $this->DB->sqleval("CD.Code_Uid"));
$row = $this->getBaseCodeList($Bran_Uid, $Group_Uid, "", $where);
$ret = array(
"CODE" =>Array(),
"CODEEXP"=>Array(),
);
foreach( (array)$row as $val ){
if( !isset($ret['CODE'][$val['Bran_Uid']]) ){
$ret['CODE'][$val['Bran_Uid']] = Array();
$ret['CODEEXP'][$val['Bran_Uid']] = Array();
}
$ret['CODE'][$val['Bran_Uid']][$val['Code_Uid']] = $val['Code_Val'];;
$ret['CODEEXP'][$val['Bran_Uid']][$val['Code_Uid']] = Array($val['Code_Val'],$val['Code_Exp']);
}
return $ret;
}
// public static function val2code( $rows, $val ){
// foreach( $rows as $key => $vrow ){
// if( is_array($vrow) && $val == $vrow['val'] || $vrow == $val ){
// return $key;
// }
// }
// return false;
// }
//
// public static function val2txt( $rows, $val ){
// foreach( $rows as $key => $vrow ){
// if( is_array($vrow) && $val == $vrow['val'] ){
// return $vrow['txt'];
// }else if( $vrow == $val ){
// return $vrow;
// }
// }
// return false;
// }
}

179
lib/base/clist.class.php Normal file
View File

@ -0,0 +1,179 @@
<?php
/**
* Made By Frody: ffrody@gmail.com (H.S.Choi)
*
* 본인 이외에 복제/사용 금지
*/
class Clist extends BaseCode {
public $DB; //DB
public $rows; //데이터 배열
public $pages; //페이지 html
public $url; //페이지 URL
public $query; //uri query row (링크:URL 만들기용 URI Query필드)
public $fld; //SQL 검색필드
public $where; //SQL where
public $whererow; //SQL where 배열
public $viewnum; //라인수
public $rownum; //하단 페이지수
public $linktype; //클릭 링크 타입
public $allcnt; //전체 수
function __construct(){
parent::__construct();
$this->rows = array();
$this->pages = array();
$this->url = $_SERVER['PHP_SELF'];
$this->fld = "*";
$this->where = "1=1";
$this->query = array();
$this->page = 1;
$this->orderby = "1";
$this->viewnum = $GLOBALS['_varsBaseCode']['line_num']?:10;
$this->rownum = $GLOBALS['_varsBaseCode']['page_num']?:10;
$this->linktype = "";
}
public function getCommonList($tb="",$prt=false){//테이블, 필드, where절, order by절, 메인url, urlquery, 현재페이지, 목록수, 페이지수
if( $tb ){
$sql = "select count(*) from {$tb} where {$this->where}";
//if( $prt ) echo $sql;
$this->allcnt = $this->DB->queryFirstField($sql,$this->whererow,array(),$prt);
}
$pobj = new Pagenation();
$pgobj = $pobj->get_pagenation($this->allcnt, $this->viewnum, $this->rownum, $this->page);
$this->pagenation = $pgobj;
$this->line_cnt = $pgobj->total_rows - $this->viewnum*($pgobj->current - 1);
$this->pages = $this->getPages($pgobj);
if( $tb ){
//$sql = "select {$this->fld} from {$tb} where {$this->where} order by {$this->orderby} ". $this->DB->_limit($pgobj->limit[0],$pgobj->limit[1]);
$sql = $this->DB->addLimit("select {$this->fld} from {$tb} where {$this->where}",$this->orderby,$pgobj->limit[0],$pgobj->limit[1]);
$this->rows = $this->DB->query( $sql, $this->whererow );
if( !$this->rows ){
$this->rows = Array();
}
}
}
public function getCount($tb,$prt=false){//테이블, 필드, where절, order by절, 메인url, urlquery, 현재페이지, 목록수, 페이지수
$sql = "select count(*) from {$tb} where {$this->where}";
//if( $prt ) echo $sql;
$allcnt = $this->DB->queryFirstField($sql, $this->whererow,array(),$prt);
return $allcnt;
}
private function getHref( $url ){
if( $this->linktype == "script" ){
return 'href="###" onclick="common_page_move(\''.$url.'\')"';
}else{
return 'href='.$url;
}
}
private function getPages($pgobj){
$pagehtml = array();
$query = $this->getQuery($this->query);
if( $pgobj->pages[0] && $pgobj->pages[0] != 1 ){
$pagehtml[] = "<a class='pn_link btn btn-light' ".$this->getHref("{$this->url}?{$query}&page=1")."><span class='f_page'>[<</span></a>";
$pagehtml[] = "<a class='pn_link btn btn-light' ".$this->getHref("{$this->url}?{$query}&page={$pgobj->bprev}")."><span class='f_page'><</span></a>";
}
for( $a=0 ; $a<count($pgobj->pages) ; $a++ ){
if( $pgobj->current == $pgobj->pages[$a] ){
$pagehtml[] = "<a class='pn_link npage btn btn-light active' ".$this->getHref("{$this->url}?{$query}&page={$pgobj->pages[$a]}")."><span class='f_page'>{$pgobj->pages[$a]}</span></a>";
}else{
$pagehtml[] = "<a class='pn_link btn btn-light' ".$this->getHref("{$this->url}?{$query}&page={$pgobj->pages[$a]}")."><span class='f_page'>{$pgobj->pages[$a]}</span></a>";
}
}
if( $pgobj->pages[count($pgobj->pages)-1] != $pgobj->last ){
$pagehtml[] = "<a class='pn_link btn btn-light' ".$this->getHref("{$this->url}?{$query}&page={$pgobj->bnext}")."><span class='f_page'>></span></a>";
$pagehtml[] = "<a class='pn_link btn btn-light' ".$this->getHref("{$this->url}?{$query}&page={$pgobj->last}")."><span class='f_page '>>]</span></a>";
}
return $pagehtml;
}
private function getQuery($qrow, $field="",$value=""){
if( $field ){
$qrow[$field] = $value;
}
$query = array();
if( count($qrow) > 0 ){
foreach( $qrow as $key => $val ){
if( hasval($val) ){
$query[] = "{$key}={$val}";
}
}
}
return implode("&", $query);
}
public function getUrl( $chgrow ){ //기존 query 에 $chgrow 부분을 변경/적용하여 url 가져오기
$qrow = $this->query;
if( count($chgrow) > 0 ){
foreach( $chgrow as $key => $val ){
$qrow[$key] = $val;
}
}
return $this->url."?".$this->getQuery($qrow);
}
public function getOrdUrl($field,$oasc=""){ //기존 query에 order용 변경/적용할 부분을 간소화
$oasc = $oasc?:($this->query['oasc']=="asc"?"desc":"asc");
return $this->getUrl(array("ofld"=>$field,"oasc"=>$oasc,"page"=>1));
}
public function getEcptUrl($fields){ //기존 query 에 $fields 부분을 제외하고 url 가져오기
$qrow = $this->query;
if( count($qrow) > 0 ){
foreach( $qrow as $key => $val ){
if( is_array($fields) ){
if( in_array($key, $fields) ) unset($qrow[$key]);
}else{
if( $key == $fields ) unset($qrow[$key]);
}
}
}
return $this->url."?".$this->getQuery($qrow);
}
public function getSearchUrl(){ //기존 query에 정렬부분만 남기고 초기화 하여 url 가져오기
$qrow = $this->query;
if( count($qrow) > 0 ){
foreach( $qrow as $key => $val ){
if( $key != "ofld" && $key != "oasc" ) unset($qrow[$key]);
}
}
return $this->url."?".$this->getQuery($qrow);
}
public function getOrdQueryRow($field,$oasc=""){ //기존 query에 order용 변경/적용할 부분을 간소화하여 배열로 리턴
$oasc = $oasc?:($this->query['oasc']=="asc"?"desc":"asc");
return array("ofld"=>$field,"oasc"=>$oasc,"page"=>1);
}
public function getEcptQueryRow($fields){ //기존 query 에 $fields 부분을 제외하고 배열로 리턴
$qrow = $this->query;
if( count($qrow) > 0 ){
foreach( $qrow as $key => $val ){
if( is_array($fields) ){
if( in_array($key, $fields) ) unset($qrow[$key]);
}else{
if( $key == $fields ) unset($qrow[$key]);
}
}
}
return $qrow;
}
public function getSearchQueryRow(){ //기존 query에 정렬부분만 남기고 초기화 하여 배열로 리턴
$qrow = $this->query;
if( count($qrow) > 0 ){
foreach( $qrow as $key => $val ){
if( $key != "ofld" && $key != "oasc" ) unset($qrow[$key]);
}
}
return $qrow;
}
}

197
lib/base/cmanage.class.php Normal file
View File

@ -0,0 +1,197 @@
<?php
class Cmanage extends BaseCode {
public $TB;
function __construct( $table ){
parent::__construct();
$this->TB = $table;
}
public function getDataList( $fields="", $where="", $orderby="", $limit=array() ){ //데이터 리스트
if( !$fields ) $fields = "*";
if( !$where ){
$where = new DB_where("and");
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//$sql = "select {$fields} from {$this->TB} where {$whereqry} ".(($orderby)?"order by {$orderby}":""). $this->DB->_limit($limit[0],$limit[1]);
$sql = $this->DB->addLimit("select {$fields} from {$this->TB} where {$whereqry}",$orderby,$limit[0],$limit[1]);
$rst = $this->DB->qry($sql, $whererow);
$row = array();
while( $tmp = $this->DB->fetch_array($rst) ){
$row[] = $tmp;
}
return $row;
}
public function getDataPage($fields="", $query=array(), $where="" ,$orderby=""){ //데이터 리스트 (페이징)
$lists = $this->getDataPageCommon($fields, $query, $where, $orderby);
$lists->url = $_SERVER['PHP_SELF'];
$lists->linktype = "";
$lists->getCommonList($this->TB);
return $lists;
}
public function getDataPageScript($fields="", $query=array(), $where="" ,$orderby="", $url=""){ //데이터 리스트 (페이징)
$lists = $this->getDataPageCommon($fields, $query, $where, $orderby);
$lists->linktype = "script";
$lists->url = $url?:$_SERVER['PHP_SELF'];
$lists->getCommonList($this->TB);
return $lists;
}
public function getDataPageCommon($fields="", $sqldata=array(), $where="" ,$orderby=""){ //데이터 리스트 (페이징)
if( !$fields ) $fields = "*";
if( !$where ){
$where = new DB_where("and");
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$query = array_merge(array(
"mode" => $sqldata['mode']?:"",
"viewnum" => $sqldata['viewnum']?:"",
"sfld" => $sqldata['sfld']?:"",
"stxt" => $sqldata['stxt']?:"",
"ofld" => $sqldata['ofld']?:"",
"oasc" => $sqldata['oasc']?:"",
), $sqldata);
$page = $sqldata['page']?:1;
unset($query['page']);
$lists = new clist();
$lists->DB->query_print = $this->DB->query_print;
$lists->DB->query_record = $this->DB->query_record;
$lists->fld = $fields;
$lists->where = $whereqry;
$lists->whererow = $whererow;
$lists->orderby = $orderby;
$lists->url = $_SERVER['PHP_SELF'];
$lists->query = $query;
$lists->page = $page;
$lists->viewnum = $query['viewnum']?:$GLOBALS['_varsBaseCode']['line_num'];
$lists->rownum = $query['rownum']?:$GLOBALS['_varsBaseCode']['page_num'];
return $lists;
}
public function getData( $fields="", $urow="", $where="", $orderby="" ) {
if( !$fields ) $fields = "*";
if( gettype($urow) == "object" && get_class($urow) == "DB_where" ){
$where = $urow;
}
if( !$where ){
$where = new DB_where("and");
}
if( gettype($urow) == "array" ){
foreach((array)$urow as $key => $val){
if( $key ){
$where->add("{$key} = ?",$val);
}
}
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select {$fields} from ".$this->TB." where {$whereqry}". ($orderby?" order by {$orderby}":"");
return $this->DB->queryFirstRow($sql, $whererow);
}
public function putData( $sqldata ) { //데이터 등록
if( $this->DB->tableExists( $this->TB ) ){
return $this->DB->insert( $this->TB, $sqldata);
}
return 0;
}
public function setData( $sqldata, $urow="", $where="" ) { //데이터 수정
if( gettype($urow) == "object" && get_class($urow) == "DB_where" ){
$where = $urow;
}
if( !$where ){
$where = new DB_where("and");
}
if( gettype($urow) == "array" ){
foreach((array)$urow as $key => $val){
if( $key ){
$where->add("{$key} = ?",$val);
}
}
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->update( $this->TB, $sqldata, $whereqry, $whererow );
}
public function setDataParts( $sqldata, $field="", $urow="", $where=""){ //데이터 일괄 수정
$fld = "";
$arr = array();
$wre = new DB_where("and");
if( gettype($field) == "object" && get_class($field) == "DB_where" ){
$wre = $field;
}else if( gettype($urow) == "object" && get_class($urow) == "DB_where" ){
$wre = $urow;
}else if( $where ){
$wre = $where;
}
if( gettype($field) == "array" ){
$arr = $field;
}else if( gettype($urow) == "array" ){
$arr = $urow;
}
if( gettype($field) == "string" ){
$fld = $field;
}
if( @count($arr) > 0 ){
$subwhere = $wre->sub_where("or");
foreach((array)$arr as $key => $val){
$subwhere->add( ($fld?:$key)." = ?",$val);
}
}
$wqry = $wre->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->update( $this->TB, $sqldata, $whereqry, $whererow );
}
public function delData( $urow="", $where="" ) { //데이터 삭제
if( gettype($urow) == "object" && get_class($urow) == "DB_where" ){
$where = $urow;
}
if( !$where ){
$where = new DB_where("and");
}
if( gettype($urow) == "array" ){
foreach((array)$urow as $key => $val){
if( $key ){
$where->add("{$key} = ?",$val);
}
}
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->delete( $this->TB, $whereqry, $whererow );
}
}

624
lib/base/kcate.class.php Normal file
View File

@ -0,0 +1,624 @@
<?php
class kcate extends BaseCode {
public $dmax;
public $cate_table; //카테고리테이블
protected $cate_area; //카테고리구분
public $cate_auth;
public function __construct( $cate_table="" ){
parent::__construct();
$this->DB->query_record = false; //query log 기록 금지
if( $cate_table ){
$this->cate_table = $cate_table;
}else{
$this->cate_table = TB_cate;
}
$this->dmax = 4;
$this->cate_area = "";
$this->cate_auth = array("");
$this->DB->tableExists($this->cate_table);
}
public function set_cate_area($cate_area){
$this->cate_area = $cate_area;
}
public function get_cate_area(){
return $this->cate_area;
}
public function getAreaQry($where=""){
if( !$where ){
$where = new DB_where("and");
}
if( $this->cate_area ){
$where->add("cate_area = ?", $this->cate_area);
}
return $where;
}
public function getShowQry($where=""){
if( !$where ){
$where = new DB_where("and");
}
if( $this->cate_auth ){
$subwhere = $where->sub_where("or");
foreach( (array)$this->cate_auth as $val ){
$subwhere->add("cate_auth = ?", $val);
}
}
return $where;
/*
switch( $auth ){
case "1" :
$valrow = Array("Y","M","S","A");
break;
case "2" :
$valrow = Array("Y","M","S");
break;
case "3" :
$valrow = Array("Y","M");
break;
default :
$valrow = Array("Y");
break;
}
return " and cate_auth in ('".implode("','",$valrow)."') ";
*/
}
public function new_cate($pa_code, $where=""){ //새 카테고리 추가
//상위카테고리의 오류확인
$pa_code = (string)$pa_code;
$new_pa_code = $pa_code;
if( $pa_code != 0 && $pa_code != "" && $pa_code != "0" && strlen($pa_code) % $this->dmax != 0 ){
for( $i = 0 ; $i < $this->dmax - ( strlen($pa_code) % $this->dmax ) ; $i++ ){
$new_pa_code = "0{$new_pa_code}";
}
}
if( !$where ){
$where = $this->getAreaQry();
}
$where->add("cate_code like ?", "{$new_pa_code}%");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//주어진 카테고리의 1단계 아래 카테고리 중 최대값 찾음
$next_len = strlen($new_pa_code) + $this->dmax;
$sql = "select max(SUBSTRING(cate_code,1,$next_len)) from {$this->cate_table} where {$whereqry}";
$pre_cate = $this->DB->queryFirstField($sql, $whererow);
if( !$pre_cate ){
$pre_cate = $new_pa_code;
}
//1단계 아래 카테고리가 없을때-Y, 있을-N
if( $pre_cate == $new_pa_code ){
for( $i = 0 ; $i < $this->dmax ; $i++ ){
$pre_cate = $pre_cate."0";
}
$last_up = (string)( (int)substr($pre_cate, -$this->dmax) + 1 );
$forlen = $this->dmax - ( strlen($last_up) % $this->dmax );
for( $i = 0 ; $i < $forlen ; $i++ ){
$last_up = "0".$last_up;
}
$pre_cate = substr($pre_cate, 0, -$this->dmax).$last_up;
$forlen = ( $this->dmax - ( strlen($pre_cate) % $this->dmax ) ) % $this->dmax;
for( $i = 0 ; $i < $forlen ; $i++ ){
$pre_cate = "0".$pre_cate;
}
return $pre_cate;
}else{
$last_up = (int)substr($pre_cate, -$this->dmax) + 1;
if( $last_up < pow(10, $this->dmax) ){
$last_up = (string)$last_up;
$cnt = $this->dmax - strlen($last_up);
for( $i = 0 ; $i < $cnt ; $i++ ){
$last_up = "0".$last_up;
}
$pre_cate = substr($pre_cate, 0, -$this->dmax).$last_up;
return $pre_cate;
}else{
alert("카테고리 허용한도가 초과되었습니다.");
return false;
}
}
}
public function up_cate($cate_code){ // 상위카테고리 리턴
return substr($cate_code, 0, strlen($cate_code) - $this->dmax);
}
public function sub_cate($cate_code){ // 하위카테고리 배열 리턴
$where = $this->getAreaQry();
$where = $this->getShowQry($where);
$where->add("cate_code like ?", "{$cate_code}%");
$where->add("cate_code != ?", $cate_code?:"");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from {$this->cate_table} where {$whereqry} order by cate_code";
$rst = $this->DB->qry($sql, $whererow);
$i = 0;
$re_row = Array();
while( $sub_obj = $this->DB->fetch_array($rst) ){
foreach( (array)$sub_obj as $key => $val ){
$re_row[$key][$i] = $val;
}
$i++;
}
return $re_row;
}
public function sub_direct_cate($cate_code){ // 1단계아래의 하위카테고리 배열만 리턴
$temp_ren = strlen($cate_code) + $this->dmax;
$where = $this->getAreaQry();
$where = $this->getShowQry($where);
$where->add("cate_code like ?", "{$cate_code}%");
$where->add("cate_code != ?", $cate_code);
$where->add("len(cate_code) = ?", $temp_ren);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from {$this->cate_table} where {$whereqry} order by cate_code";
$rst = $this->DB->qry($sql, $whererow);
$i = 0;
$re_row = Array();
while( $sub_obj = $this->DB->fetch_array($rst) ){
foreach( $sub_obj as $key => $val ){
$re_row[$key][$i] = $val;
}
$i++;
}
return $re_row;
}
public function history_cate($cate_code){ // $cate_code 의 상위 카테고리 배열 리턴
$floor = strlen($cate_code) / $this->dmax;
for( $i = $floor ; $i > 0 ; $i-- ){
$info = $this->cate_info(substr($cate_code, 0, $this->dmax * $i));
if($info) foreach( $info as $key => $val ){
$re_row[$key][$i - 1] = $val;
}
}
return $re_row;
}
public function cate_info($cate_code, $where=""){ // 카테고리정보 리턴
if( !$where ){
$where = new DB_where("and");
}
$where = $this->getAreaQry($where);
$where->add("cate_code = ?", $cate_code);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from {$this->cate_table} where {$whereqry}";
$row = $this->DB->queryFirstRow($sql, $whererow);
return $row;
}
public function cate_info_id($cate_id, $where=""){ // 카테고리정보 리턴 id
if( !$where ){
$where = new DB_where("and");
}
$where = $this->getAreaQry($where);
$where->add("cate_id = ?", $cate_id);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from {$this->cate_table} where {$whereqry}";
$row = $this->DB->queryFirstRow($sql, $whererow);
return $row;
}
public function cate_info_data(){ // 카테고리정보 리턴 url
if( $_SERVER['REQUEST_URI'] != "/" ){
$where = $this->getAreaQry();
$where->add("charindex(?, cate_data) != 0", $_SERVER['REQUEST_URI']);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//$sql = "select * from {$this->cate_table} where cate_data is not null and cate_data != '' and {$whereqry} order by cate_code desc ".$this->DB->_limit(0,1);
$sql = $this->DB->addLimit("select * from {$this->cate_table} where cate_data is not null and cate_data != '' and {$whereqry}","cate_code desc",0,1);
$row = $this->DB->queryFirstRow($sql, $whererow);
return $row;
}
}
public function cate_name($cate_code, $field_name="cate_name"){ // 카테고리명 리턴
$where = $this->getAreaQry();
$where->add("cate_code = ?", $cate_code);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select {$field_name} from {$this->cate_table} where {$whereqry}";
return $this->DB->queryFirstField($sql, $whererow);
}
public function move_cate($cate_code, $dest_upcode){ // 카테고리 이동 (단순)
$temp_ren = strlen($cate_code)+1;
$new_code = $this->new_cate($dest_upcode);
$params = Array(
//"cate_code" => $this->DB->sqleval( "CONCAT('{$new_code}',SUBSTRING(cate_code,{$temp_ren},1000))" ),
"cate_code" => $this->DB->sqleval( "'{$new_code}' + SUBSTRING(cate_code,{$temp_ren},1000)" ),
);
$where = $this->getAreaQry();
$where->add("cate_code like ?", "{$cate_code}%");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->update($this->cate_table, $params, $whereqry, $whererow);
}
public function move_target_cate_id($cate_id,$dest_id,$pos_num){ // 카테고리 이동 _ id
$cinfo = $this->cate_info_id($cate_id);
$dinfo = $this->cate_info_id($dest_id);
$cate_code = $cinfo['cate_code'];
$dest_code = $dinfo['cate_code'];
//if( $this->up_cate($cate_code) == $dest_code && substr($cate_code,-$this->dmax) <= $pos_num ){ $pos_num++; }
return $this->move_target_cate($cate_code, $dest_code, $pos_num);
}
public function move_target_cate($cate_code,$dest_upcode,$pos_num){ // 카테고리 이동
$code_len = strlen($cate_code); //코드길이
$code_parent = substr($cate_code,0,-$this->dmax); //부모코드
$code_parlen = strlen($code_parent); //부모코드길이
$dest_len = strlen($dest_upcode); //대상코드길이
$dest_chilen = strlen($dest_upcode)+$this->dmax; //대상자식코드길이
$where = $this->getAreaQry();
$where->add("cate_code != ?", "{$cate_code}");
$where->add("cate_code != ?", "{$dest_upcode}");
$where->add("cate_code like ?", "{$dest_upcode}%");
$where->add("len(cate_code) = ?", strlen($dest_upcode)+$this->dmax);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
//$sql = "select cate_code from {$this->cate_table} where {$whereqry} order by cate_code asc ".$this->DB->_limit($pos_num,1);
$sql = $this->DB->addLimit("select cate_code from {$this->cate_table} where {$whereqry}","cate_code asc",$pos_num,1);
$dest_code = $this->DB->queryFirstField($sql, $whererow);
if( $dest_code ){ //대상위치에 존재하는 코드가 있으면
$tgt_num = (int)substr($dest_code,-$this->dmax);
}else{ //대상위치에 존재하는 코드가 없으면 마지막 코드 +1
$sql = $this->DB->addLimit("select cate_code from {$this->cate_table} where {$whereqry}","cate_code desc",0,1);
$dest_code = $this->DB->queryFirstField($sql, $whererow);
$tgt_num = (int)substr($dest_code,-$this->dmax) + 1;
}
if( strpos( $dest_upcode, $code_parent ) !== false && $dest_code > $cate_code ){ //같은 레벨 이동이거나 아래로 이동일 경우. (자신이 빠진것 만큼, 대상 부모의 자신의 레벨 부분을, -1만큼 보상해줘야 함.)
if( $dest_upcode == $code_parent ){ //같은 레벨 이동은 $tgt_num 이 바뀌고, 하위레벨로의 이동은 upcode 가 바뀐다.
$tgt_num--;
}else{
$code1 = substr($dest_upcode, 0, $code_len);
$code2 = substr($dest_upcode, $code_len);
$dest_upcode = substr($code1,0,-$this->dmax) . addzero((int)substr($code1,-$this->dmax) - 1, $this->dmax) . $code2;
}
}
$new_part = $dest_upcode.addzero($tgt_num,$this->dmax);
$params = Array(
//"cate_code" => $this->DB->sqleval( "CONCAT('xxxxxxxxxx',SUBSTRING(cate_code,".($code_len+1).",1000))" ),
"cate_code" => $this->DB->sqleval( "'xxxxxxxxxx' + SUBSTRING(cate_code,".($code_len+1).",1000)" ),
);
$where = $this->getAreaQry();
$where->add("cate_code like ?", "{$cate_code}%");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$this->DB->update($this->cate_table, $params, $whereqry, $whererow); //대상 임시보관
$params = Array(
//"cate_code" => $this->DB->sqleval( "CONCAT(SUBSTRING(cate_code,1,{$code_parlen}),REPLICATE('0',".$this->dmax."-LEN(CONVERT(VARCHAR,SUBSTRING(cate_code,".($code_parlen+1).",".$this->dmax.")-1)))+CONVERT(VARCHAR,SUBSTRING(cate_code,".($code_parlen+1).",".$this->dmax.")-1),SUBSTRING(cate_code,".($code_len+1).",1000))" ),
"cate_code" => $this->DB->sqleval( "SUBSTRING(cate_code,1,{$code_parlen}) + REPLICATE('0',".$this->dmax."-LEN(CONVERT(VARCHAR,SUBSTRING(cate_code,".($code_parlen+1).",".$this->dmax.")-1)))+CONVERT(VARCHAR,SUBSTRING(cate_code,".($code_parlen+1).",".$this->dmax.")-1) + SUBSTRING(cate_code,".($code_len+1).",1000)" ),
);
$where = $this->getAreaQry();
$where->add("cate_code like ?", "{$code_parent}%");
$where->add("cate_code > ?", $cate_code);
$where->add("cate_code not like ?", "{$cate_code}%");
$where->add("cate_code not like ?", "xxxxxxxxxx%");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$this->DB->update($this->cate_table, $params, $whereqry, $whererow); //원본 위치의 빠진공간 메움
$params = Array(
//"cate_code" => $this->DB->sqleval( "CONCAT(SUBSTRING(cate_code,1,{$dest_len}), REPLICATE('0', ".$this->dmax."-LEN(CONVERT(VARCHAR,SUBSTRING(cate_code,".($dest_len+1).",".$this->dmax.")+1)))+CONVERT(VARCHAR,SUBSTRING(cate_code,".($dest_len+1).",".$this->dmax.")+1), SUBSTRING(cate_code,".($dest_chilen+1).",1000))" ),
"cate_code" => $this->DB->sqleval( "SUBSTRING(cate_code,1,{$dest_len}) + REPLICATE('0', ".$this->dmax."-LEN(CONVERT(VARCHAR,SUBSTRING(cate_code,".($dest_len+1).",".$this->dmax.")+1)))+CONVERT(VARCHAR,SUBSTRING(cate_code,".($dest_len+1).",".$this->dmax.")+1) + SUBSTRING(cate_code,".($dest_chilen+1).",1000)" ),
);
$where = $this->getAreaQry();
$where->add("cate_code like ?", "{$dest_upcode}%");
$where->add("cate_code >= ?", $new_part);
$where->add("cate_code not like ?", "xxxxxxxxxx%");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$this->DB->update($this->cate_table, $params, $whereqry, $whererow); //대상 위치의 공간확보
$params = Array(
//"cate_code" => $this->DB->sqleval( "CONCAT('{$dest_upcode}','{$new_part}',SUBSTRING(cate_code,11,1000))" ),
"cate_code" => $this->DB->sqleval( "'{$new_part}' + SUBSTRING(cate_code,11,1000)" ),
);
$where = $this->getAreaQry();
$where->add("cate_code like ?", "xxxxxxxxxx%");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->update($this->cate_table, $params, $whereqry, $whererow); //대상 위치로 이동
}
public function drop_cate($cate_code, $cate_save_dir=""){ // 카테고리 삭제
$where = $this->getAreaQry();
$where->add("cate_code like ?", "{$cate_code}%");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->delete($this->cate_table, $whereqry, $whererow);
}
public function level_cate($cate_code){ // 카테고리 레벨 - 몇번째 카테고리인지 리턴
return strlen($cate_code) / $this->dmax;
}
public function max_level_cate(){ // 최고카테고리 레벨
$where = $this->getAreaQry();
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select max(len(cate_code)) from {$this->cate_table} where {$whereqry}";
return $this->DB->queryFirstField($sql, $whererow) / $this->dmax;
}
public function tree_cate($cate_code){ // 카테고리 트리배열 리턴
$where = $this->getAreaQry();
$where = $this->getShowQry($where);
$where->add("cate_code like ?", "{$cate_code}%");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from {$this->cate_table} where {$whereqry} order by cate_code";
$rst = $this->DB->qry($sql, $whererow);
return $this->tree_cate_exe($rst);
}
public function tree_cate_all($cate_code){ // 카테고리 트리배열 리턴. 조회방식과 무관
$where = $this->getAreaQry();
$where->add("cate_code like ?", "{$cate_code}%");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from {$this->cate_table} where {$whereqry} order by cate_code";
$rst = $this->DB->qry($sql, $whererow);
return $this->tree_cate_exe($rst);
}
public function tree_cate_exe($rst){
$i = 0;
$tree_row = Array();
while( $cate_obj = $this->DB->fetch_array($rst) ){
$sub_row = $this->sub_cate($cate_obj['cate_code']);
foreach( $cate_obj as $key => $val ){
$tree_row[$key][$i] = $val;
}
$tree_row['level'][$i] = $this->level_cate($cate_obj['cate_code']);
$tree_row['sub'][$i] = count((Array)$sub_row['cate_code']);
$i++;
}
return $tree_row;
}
public function draw_cate_all($cate_code, $page_url=""){ // 전체 카테고리 트리 작성
if( !$page_url ){
$page_url = $_SERVER['PHP_SELF'];
}
$tree_row = $this->tree_cate("");
$history_row = $this->history_cate($cate_code);
$all_num = count($tree_row['cate_code']);
$pre_level = 0;
$tree_html = "<div style='font-size:8pt;'><a href='{$page_url}'><img src='/img/folder_o.gif' align='absmiddle' border='0'>최상위</a></div>";
for( $i = 0 ; $i < $all_num ; $i++ ){
if( $pre_level >= $tree_row['level'][$i] ){
for( $k = 0 ; $k <= ( $pre_level - $tree_row['level'][$i] ) ; $k++ ){
$tree_html .= "\r\n</div>";
}
}
if( $cate_code == $tree_row['cate_code'][$i] or @in_array($tree_row['cate_code'][$i], $history_row['cate_code']) ){
$view_conv = "";
}else{
$view_conv = "none";
}
if( count($this->sub_direct_cate($tree_row['cate_code'][$i])) > 0 ){
$plus_img = "line_plus.gif";
}else{
$plus_img = "line_minus.gif";
}
if( $cate_code == $tree_row['cate_code'][$i] ){
$open_folder = "folder_o.gif";
$fg_col = 'font-weight:bold;color:#003366';
}else{
$open_folder = "folder_c.gif";
$fg_col = "";
}
$tree_html .= "\r\n<div style='font-size:8pt'>";
for( $ks = 0 ; $ks < $tree_row['level'][$i] ; $ks++ ){
$tree_html .= "<img src='/img/line.gif' align='absmiddle' border='0'>";
}
$tree_html .= "<a href='###'><img src='/img/{$plus_img}' align='absmiddle' border='0' id='{$tree_row['cate_code'][$i]}' class='Outline'></a><img src='/img/{$open_folder}' align='absmiddle' border='0' id='{$tree_row['cate_code'][$i]}' class='Outline'><a style='vertical-align:bottom' href='{$page_url}?cate_code={$tree_row['cate_code'][$i]}' style='{$fg_col}'>{$tree_row['cate_name'][$i]}</a></div>";
$tree_html .= "\r\n<div id='{$tree_row['cate_code'][$i]}_d' style='display:{$view_conv}'>";
$pre_level = $tree_row['level'][$i];
}
for( $i = 0 ; $i < $pre_level ; $i++ ){
$tree_html .= "\r\n</div>";
}
return $tree_html;
}
public function draw_cate_script($cate_code){ // 전체 카테고리 트리 작성(스크립트)
$tree_row = $this->tree_cate("");
$history_row = $this->history_cate($cate_code);
$all_num = count($tree_row['cate_code']);
$pre_level = 0;
$tree_html = "";
for( $i = 0 ; $i < $all_num ; $i++ ){
if( $pre_level >= $tree_row['level'][$i] ){
for( $k = 0 ; $k <= ( $pre_level - $tree_row['level'][$i] ) ; $k++ ){
$tree_html .= "\r\n</div>";
}
}
if( $cate_code == $tree_row['cate_code'][$i] or @in_array($tree_row['cate_code'][$i], $history_row['cate_code']) ){
$view_conv = "";
}else{
$view_conv = "none";
}
if( count($this->sub_direct_cate($tree_row['cate_code'][$i])) > 0 ){
$plus_img = "line_plus.gif";
}else{
$plus_img = "line_minus.gif";
}
if( $cate_code == $tree_row['cate_code'][$i] ){
$open_folder = "folder_o.gif";
$fg_col = 'font-weight:bold;color:#003366';
}else{
$open_folder = "folder_c.gif";
$fg_col = "";
}
$tree_html .= "\r\n<div>";
for( $ks = 0 ; $ks < $tree_row['level'][$i] ; $ks++ ){
$tree_html .= "<img src='/img/line.gif' align='absmiddle' border='0'>";
}
$tree_html .= "<a href='###'><img src='/img/{$plus_img}' align='absmiddle' border='0' id='{$tree_row['cate_code'][$i]}' class='Outline'></a><img src='/img/{$open_folder}' align='absmiddle' border='0' id='{$tree_row['cate_code'][$i]}' class='Outline'><a style='vertical-align:bottom' href='###' style='{$fg_col}'>{$tree_row['cate_name'][$i]}</a></div>";
$tree_html .= "\r\n<div id='{$tree_row['cate_code'][$i]}_d' style='display:{$view_conv}'>";
$pre_level = $tree_row['level'][$i];
}
for( $i = 0 ; $i < $pre_level ; $i++ ){
$tree_html .= "\r\n</div>";
}
return $tree_html;
}
public function list_cate($cate_code, $url, $spr){
$word = "<a href='###' onclick=\"location.href='{$url}'\" style='text-decoration:none'>최상위</a>";
$his_row = $this->history_cate($cate_code);
for( $i = 0 ; $i < count($his_row['cate_code']) ; $i++ ){
$word .= "{$spr}<a href='###' onclick=\"location.href='{$url}?cate_code={$his_row['cate_code'][$i]}'\" style='text-decoration:none'>{$his_row['menu_name'][$i]}</a>";
}
return $word;
}
public function get_cate($menu_id=""){
global $cmenu_id, $cmenu_cate, $d1n, $d2n, $d3n, $d4n;
if($menu_id){
$row = $this->cate_info_id($menu_id);
return $row['cate_code'];
}else if( $cmenu_id ){
$row = $this->cate_info_id($cmenu_id);
return $row['cate_code'];
}else if( $cmenu_cate ){
return $cmenu_cate;
}else if( $d1n ){/*이전방식 호환용*/
return ( ( $d1n )?addzero($d1n, $this->dmax):"" ).( ( $d2n )?addzero($d2n, $this->dmax):"" ).( ( $d3n )?addzero($d3n, $this->dmax):"" ).( ( $d4n )?addzero($d4n, $this->dmax):"" );
}else{
$row = $this->cate_info_data();
return $row['cate_code'];
}
}
function tree_by_parent( $row, $cd_fld, $pcd_fld, $pcd_val ){
$nrow = array_filter($row, function($v) use ($pcd_val, $pcd_fld, $cd_fld) {
return $pcd_val == $v[$pcd_fld] && !!$v[$cd_fld];
});
$arr = Array();
foreach( (Array)$nrow as $ar ){
$ar['children'] = $this->tree_by_parent($row, $cd_fld, $pcd_fld, $ar[$cd_fld]);
$arr[] = $ar;
}
return $arr;
}
public function __get($name){
$method = "get_{$name}";
if( method_exists($this, $method) ){
return $this->$method();
}
return false;
}
public function __set($name, $value){
$method = "set_{$name}";
if( method_exists($this, $method) ){
return $this->$method( $value );
}
return false;
}
}

125
lib/base/lcrypt.class.php Normal file
View File

@ -0,0 +1,125 @@
<?php
/**
* Made By Frody: ffrody@gmail.com (H.S.Choi)
*
* 본인 이외에 복제/사용 금지
*/
class lcrypt {
private $pwOpt = "kuls_";
private $pwHash = true; //sha 한 비밀번호를 다시 unix hash 할것인지 여부
//비밀번호 관련 함수
public function pw_make($pass) { // 보안 패스워드를 반환 - sha256 해쉬함수 hash("sha256",$site_pw) vs MSSQL HASHBYTES('SHA2_512','passwd_text');
if( $this->pwHash ){
$site_pw = hash ( "sha256", base64_encode ( strtolower ( $pass ) . $this->pwOpt ) );
$site_pw = password_hash( $site_pw, PASSWORD_DEFAULT);
}else{
$site_pw = hash ( "sha256", strtolower ( $pass ) . $this->pwOpt, true ); //Binary
}
return $site_pw;
}
public function pw_match($pass, $db_pass) { // 패스워드 체킹
if( $this->pwHash ){
$site_pw = hash ( "sha256", base64_encode ( strtolower ( $pass ) . $this->pwOpt ) );
$pwd = password_verify( $site_pw, $db_pass );
}else{
$site_pw = hash ( "sha256", strtolower ( $pass ) . $this->pwOpt, true ); //Binary
$pwd = ($site_pw == $db_pass);
}
if( $pwd ){
return true;
}
return false;
}
public function setPwOpt($pw_opt){
$this->pwOpt = $pw_opt;
}
public function setPwHash($bool){
$this->pwHash = !!$bool;
}
//암복호화 함수
public function enc_secure($sdata) {
$enc_key = $this -> hex2bin( md5($this->pwOpt, TRUE) );
$iv = $this -> hex2bin( md5($this->pwOpt, TRUE) );
$encrypted = $this -> encrypt ($enc_key, $iv, $sdata);
$encrypted = str_replace('+', '', $encrypted);
return $encrypted?:'';
}
public function dec_secure($sdata) {
$sdata = str_replace('', '+', $sdata);
$enc_key = $this -> hex2bin( md5($this->pwOpt, TRUE) );
$iv = $this -> hex2bin( md5($this->pwOpt, TRUE) );
$decrypted = $this -> decrypt ($enc_key, $iv, $sdata);
return $decrypted?:'';
}
public function hex2bin($hexdata){
return $hexdata;
$bindata = "";
for( $i = 0 ; $i < strlen($hexdata) ; $i += 2 ){
$bindata .= chr(hexdec(substr($hexdata, $i, 2)));
}
return $bindata;
}
public function encrypt($key, $iv, $value){
if( is_null($value) ){
$value = "";
}
if( function_exists("mcrypt_encrypt") ){
$value = $this->toPkcs7($value);
$output = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $value, MCRYPT_MODE_CBC, $iv);
}else{
$output = openssl_encrypt($value, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
}
return base64_encode($output);
}
public function decrypt($key, $iv, $value){
if( is_null($value) ){
$value = "";
}
$value = base64_decode($value);
if( function_exists("mcrypt_encrypt") ){
$output = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $value, MCRYPT_MODE_CBC, $iv);
$output = $this->fromPkcs7($output);
}else{
$output = openssl_decrypt($value, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
}
return $output;
}
private function toPkcs7($value){
if( is_null($value) ){
$value = "";
}
$padSize = 16 - intval(strlen($value) % 16);
return $value.str_repeat(chr($padSize), $padSize);
}
private function fromPkcs7($value){
$valueLen = strlen($value);
if( $valueLen % 16 > 0 ){
$value = "";
}
$padSize = ord($value[$valueLen - 1]);
if( ( $padSize < 1 ) or ( $padSize > 16 ) ){
$value = "";
}
// Check padding.
for( $i = 0 ; $i < $padSize ; $i++ ){
if( ord($value[$valueLen - $i - 1]) != $padSize ){
$value = "";
}
}
return substr($value, 0, $valueLen - $padSize);
}
}

View File

@ -0,0 +1,68 @@
<?php
/**
* Made By Frody: ffrody@gmail.com (H.S.Choi)
*
* 본인 이외에 복제/사용 금지
*/
class Pagenation {
public function __construct(){}
public function get_pagenation($total_rows, $rows_per_page, $show_pages, $page_num=1){ //전체 데이터수, 1페이지당 열수, Pagenation 갯수, 현재 페이지
$pages = new stdClass;
$pages->total_rows = $total_rows;
$last_page = ceil($total_rows / $rows_per_page);
$page_num = (int) $page_num;
if ($page_num < 1) {
$page_num = 1;
}
$upto = ($page_num - 1) * $rows_per_page;
if( $upto < 0 ){
$upto = 0;
}
$pages->limit = array($upto, $rows_per_page);
$pages->current = $page_num;
if ($page_num == 1){
$pages->prev = $page_num;
} else {
$pages->prev = $page_num - 1;
}
if ($page_num == $last_page) {
$pages->next = $last_page;
} else {
$pages->next = $page_num + 1;
}
$bprev = ceil(($page_num-$show_pages)/$show_pages) * $show_pages;
if( $bprev < 1 ){
$pages->bprev = 1;
}else{
$pages->bprev = $bprev;
}
$bnext = ceil($page_num/$show_pages) * $show_pages + 1;
if( $bnext > $last_page ){
$pages->bnext = $last_page;
}else{
$pages->bnext = $bnext;
}
$pages->last = $last_page;
$pages->info = "Page ({$page_num} of {$last_page})";
$pages->pages = $this->get_pages($page_num, $last_page, $pages->next, $show_pages);
return $pages;
}
public function get_pages($page_num, $last_page, $next, $show_pages) {
$arr = array();
$start = floor(($page_num-1) / $show_pages)*$show_pages;//주석대신 추가부분
$end = $start + $show_pages; //주석대신 추가부분
if ($start < 0) {
$start = 0; $end = $show_pages;
}
for ($i = $start; $i < $end; $i++) {
if ($i == $last_page){
break;
}
array_push($arr, $i + 1);
}
return $arr;
}
}

231
lib/base/token.class.php Normal file
View File

@ -0,0 +1,231 @@
<?php
class Token extends BaseCode { //미니 접속유지용 토큰
private const Ezconst = "kuls_Auth_key"; //md5용 Hash (HashCode 생성용)
private const RdByte = 20; //랜덤 처리용 byte (Unique 발생용)
private static $Config = Array( //기본설정
"valid_time" => 3600, //토큰 유효시간 - 1시간
"expire_time" => 3600 * 24 * 3, //토큰 재발행 유효시간 3일. 이후 재로그인
"logging_time" => 3600 * 24 * 31 * 3, //로그보관 시간 3달 (현재미사용 - 나중에 로그쌓이는것 보고 사용여부 결정)
);
private const SpareTime = 120;
public function __construct( $cate_table="" ){
parent::__construct();
$this->DB->tableExists(TB_token_log);
}
/**
* putToken => 토큰 저장
* @param string $member_id : 로그인된 사용자 아이디
* @param string $auth : 인증코드. 각각의 로그인의 Unique세션으로 사용되며 Default는 요청마다 랜덤으로 새로 생성되지만, 인증키를 사용자 아이디로 고정으로 지정하면 중복접속 방지용으로 사용가능(Single Sign On)
* @param array $config : 기본설정 대체환경
*/
public function putToken( $member_id, $auth="", $config=Array() ){ //$auth 를 ID로 잡으면 Single Sign On, 그냥두면 Multi login
$member_id = trim($member_id);
if( !$member_id ) return false;
if( defined('_SINGLE_LOGIN_') && _SINGLE_LOGIN_ ){ //Single Sign On 적용
$auth = $member_id;
}else{
$auth = $auth ?: bin2hex(openssl_random_pseudo_bytes(self::RdByte)); //인증키 랜덤생성
}
$token = md5(self::Ezconst . $auth . uniqid()); //토큰생성
$config = $config + self::$Config;
$valid_time = time() + $config['valid_time'];
$exprie_time = time() + $config['expire_time'];
$this->retireToken($auth);
//$sql = "INSERT INTO ". TB_token_log ." (member_id, auth, token, valid_time, expire_time, active, ip) VALUES (?, ?, ?, ?, ?, ?, ?)";
$sqlrow = Array(
"member_id" => $member_id,
"auth" => $auth,
"token" => $token,
"valid_time" => $valid_time,
"expire_time" => $exprie_time,
"Active" => "Y",
"ip" => get_ip()
);
$rst = $this->DB->insert(TB_token_log, $sqlrow);
if( $rst ){
return $token;
}
return false;
}
/**
* retireToken => 토큰 무효화. 비정상 접근시 사용
* @param string $auth : 인증코드. 해당 인증코드로 생성된 모든 토큰 무효화.
*/
public function retireToken( $auth ){//모든 $auth 비활성화 처리
//$sql = "UPDATE TB_token_log SET Active = 'N' WHERE Auth = ?";
$sqlrow = Array(
"active" => "N",
);
$where = new DB_where("and");
$where->add("auth = ?", $auth);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
return $this->DB->update(TB_token_log, $sqlrow, $whereqry, $whererow);
}
/**
* getFromToken => DB에서 토큰 관련정보 획득
* @param string $token : 사용자가 제출한 토큰.
*/
public function getFromToken( $token ){//Token 정보 Load
//$sql = "SELECT USER_ID, Auth, Valid_Time, Expire_Time, Active FROM TB_token_log WHERE Token = ?";
$where = new DB_where("and");
$where->add("token = ?", $token);
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$this->DB->query_record = false; //query log 기록 금지
$sql = "select member_id, auth, valid_time, expire_time, active from ". TB_token_log ." where {$whereqry}";
$row = $this->DB->queryFirstRow($sql, $whererow );
$this->DB->query_record = true; //query log 기록
return $row;
}
/**
* getLastToken => DB에서 Auth 관련 최종정보 획득
* @param string $auth : 요청 인증.
*/
public function getLastAuth( $auth ){//Token 정보 Load
//$sql = "SELECT USER_ID, Auth, Valid_Time, Expire_Time, Active FROM TB_token_log WHERE Token = ?";
$where = new DB_where("and");
$where->add("auth = ?", $auth);
$where->add("active = ?", "Y");
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$this->DB->query_record = false; //query log 기록 금지
$sql = "select top 1 member_id, auth, valid_time, expire_time, active from ". TB_token_log ." where {$whereqry} order by valid_time desc";
$row = $this->DB->queryFirstRow($sql, $whererow );
$this->DB->query_record = true; //query log 기록
return $row;
}
/**
* statusToken => Token의 현재상태 판단
* @param array|string $token_info : 토큰 또는 토큰 정보
* @return string
* Y: 인증성공
* N: 인증실패
* E: 연장필요 새로운 Token 발행
* F: 의심되는 접근. 전체 인증 Token 비활성화
*/
public function statusToken( $token_info ){//Token 상태 (Y:인증성공)
if( !is_array($token_info) ) $token_info = $this->getFromToken($token_info);
if( !$token_info['auth'] ) return 'N';
$now = time();
switch( true ){
case ( $token_info['expire_time'] < $now ) : //세션만료
return 'N'; //인증실패
case ( $token_info['valid_time'] >= $now ) : //유효시간 이내
if( trim($token_info['active']) != "Y" ) return "F"; //인증 비활성 필요
return 'Y'; //인증성공
case ( $token_info['expire_time'] >= $now ) :
if( trim($token_info['active']) != "Y" ){
if( ($token_info['expire_time'] + self::SpareTime) >= $now ){
return 'Y'; //동시 신호용 인증성공 $spare_time 초간 인정
}else{
return "F"; //인증 비활성 필요
}
}
return 'E'; //연장요청
}
return 'N';
}
public function chkToken( $token ){
//$fp = fopen(_UP_PATH_."/token_2t.txt", "a+");
//$fptxt = "=======================".PHP_EOL;
//$fptxt .= "NOW=> ".time().PHP_EOL;
//$fptxt .= "REQ=> ".print_r($_REQUEST,true).PHP_EOL;
$token_info = $this->getFromToken( $token );
$token_stauts = $this->statusToken($token_info);
//$fptxt .= "STATUS=> ".$token_stauts.PHP_EOL;
switch( $token_stauts ){
case "E" : //토큰 연장
$chk_token = $this->getLastAuth($token_info['auth']);
if( $token_info['token'] == $chk_token['token'] ){
$new_token = $this->putToken($token_info['member_id'], $token_info['auth']);
}
case "Y" : //토큰 유효
$_SESSION['auth_mem_id'] = $token_info['member_id'];
break;
// 토큰 연장처리 되어 새로운 토큰($new_token) 이 발행되었는데도 갱신하지 않고,
// 예전 토큰 그대로 사용하면 중복 인증요청으로 무효토큰 처리되니
// 새로운 토큰이 발행되면 다음 요청시엔 꼭 새로운 토큰으로 교체하는 과정이 필요.
// APP 에서 요청할때 응답이 필요한 요청이외의 단순 요청부분까지 응답을 필수 확인하여 $new_token 값이 있는지 점검후 교체하는 로직 필수!!
case "F" : //토큰 비활성
$this->retireToken( $token_info['auth'] );
case "N" : //토큰 무효
unset($_SESSION['auth_mem_id']);
break;
}
//fputs($fp, $fptxt);
//fclose($fp);
return $new_token;
}
/*
public static function getTokenLogin( $token, $config=Array() ){//Token 처리
$token_info = self::getToken($token);
$status = self::stateToken($token_info);
switch( $status ){
case "Y" :
$retval = $member;
break;
case "N" :
$retval = false;
break;
case "E" :
$token = self::putToken($token_info['member_id'], $token_info['auth'], $config);
$retval = $token;
break;
case "F" :
self::retireToken( $token_info['auth'] );
$retval = false;
break;
}
}
*/
}

381
lib/base/upload.class.php Normal file
View File

@ -0,0 +1,381 @@
<?php
/**
* Made By Frody: ffrody@gmail.com (H.S.Choi)
*
* 본인 이외에 복제/사용 금지
*/
namespace Frody\Util;
Class MultiFileUpload {
static public function swfFormFileInfo($fileids, $target_dir, $info_unlink="D"){
if( !preg_match("/\/$/",$target_dir) ) {
$target_dir = $target_dir . "/";
}
$k = 0;
$upfiles = array();
foreach( (array)$fileids as $cid => $fileid ) {
if (file_exists($target_dir . $fileid . ".info")) {
$fp = fopen($target_dir . $fileid . ".info", "r");
while (($line = fgets($fp, 4096)) !== false) {
$tmp = explode(":", $line);
$upfiles[$k][$tmp[0]] = chop($tmp[1]);
}
if( $upfiles[$k]['error'] ){ //등록시 오류가 발생한 경우 제외
unset($upfiles[$k]);
continue;
}
$upfiles[$k]['tmp_text'] = $fileid;
$upfiles[$k]['tmp_name'] = $target_dir . $fileid;
fclose($fp);
$k++;
if ($info_unlink == "D") { // 같은 자리에서 계속 등록을 할 경우 중복등록 방지용으로 삭제를 한다.
unlink($target_dir . $fileid . ".info");
}
}
}
return $upfiles;
}
static function swfInfoSaveFile($ufile){
$fileinfo["tmp_name"] = $ufile["tmp_name"];
$fileinfo["name"] = $ufile["name"];
$fileinfo["size"] = $ufile["size"];
$fileinfo["type"] = $ufile["type"];
$fileinfo['width'] = 0;
$fileinfo['height'] = 0;
$fileinfo["error"] = $ufile["error"];
if( strpos($ufile['type'], "image") !== false ){
$iinfo = getimagesize($ufile["tmp_name"]);
$fileinfo['width'] = $iinfo[0];
$fileinfo['height'] = $iinfo[1];
}
return $fileinfo;
}
static function swfFormSaveFile($ufile, $target_dir, $temp_id=""){
if( !preg_match("/\/$/",$target_dir) ) {
$target_dir = $target_dir . "/";
}
if( $temp_id ){
$fileid = $temp_id;
}else{
$fileid = uniqid("tmpfile_");
}
@move_uploaded_file($ufile["tmp_name"], $target_dir . $fileid);
$ufile['width'] = 0;
$ufile['height'] = 0;
if( strpos($ufile['type'], "image") !== false ){
$iinfo = getimagesize($target_dir . $fileid);
$ufile['width'] = $iinfo[0];
$ufile['height'] = $iinfo[1];
}
$fp = fopen($target_dir . $fileid . ".info","w+");
fputs($fp, "name:". $ufile["name"]."\r\n");
fputs($fp, "size:". $ufile["size"]."\r\n");
fputs($fp, "type:". $ufile["type"]."\r\n");
fputs($fp, "width:". $ufile["width"]."\r\n");
fputs($fp, "height:". $ufile["height"]."\r\n");
fputs($fp, "error:". $ufile["error"]."\r\n");
fclose($fp);
return $fileid;
}
static function swfMoveUploadedFile($src, $tgt){
rename($src, $tgt);
}
static function swfSaveFile($ufile, $sfile){
@move_uploaded_file($ufile["tmp_name"], $sfile);
$upfiles['name'] = $ufile['name'];
$upfiles['size'] = $ufile['size'];
return json_encode($upfiles);
}
static function swfCleanDir($target_dir){
if( !is_dir($target_dir) ) return;
$dp = opendir($target_dir);
if( !preg_match("/\/$/",$target_dir) ) {
$target_dir = $target_dir . "/";
}
while(false !== ($file = readdir($dp))) {
if ($file != "." && $file != "..") {
$ftime = filectime($target_dir.$file);
if( $ftime < time()-3600*24 ){
@unlink($target_dir.$file);
}
}
}
}
static public function mime_type( $file_ext ){
switch ( $file_ext )
{
case "doc" : $mime_type = "application/msword";
break;
case "xls" :
case "xlw" :
case "xla" :
case "xlc" :
case "xlm" :
case "xlt" : $mime_type= "application/vnd.ms-excel";
break;
case "ppt" :
case "pps" :
case "pot" : $mime_type= "application/vnd.ms-powerpoint";
break;
case "mpp" : $mime_type= "application/vnd.ms-project";
break;
case "mdb" : $mime_type= "application/x-msaccess";
break;
case "pub" : $mime_type= "application/x-mspublisher";
break;
case "scd" : $mime_type= "application/x-msschedule";
break;
case "hlp" : $mime_type= "application/winhlp";
break;
case "crd" : $mime_type= "application/x-mscardfile";
break;
case "clp" : $mime_type= "application/x-msclip";
break;
case "m13" :
case "m14" : $mime_type= "application/x-msmediaview ";
break;
case "wmf" : $mime_type= "application/x-msmetafile";
break;
case "mny" : $mime_type= "application/x-msmoney";
break;
case "trm" : $mime_type= "application/x-msterminal";
break;
case "wri" : $mime_type= "application/x-mswrite";
break;
case "bin" :
case "exe" :
case "com" : $mime_type= "application/octet-stream";
break;
case "asd" :
case "asn" : $mime_type= "application/astound";
break;
case "lcc" : $mime_type= "application/fastman";
break;
case "hqx" : $mime_type= "application/mac-binhex40";
break;
case "mbd" : $mime_type= "application/mbedlet";
break;
case "oda" : $mime_type= "application/oda";
break;
case "pdf" : $mime_type= "application/pdf";
break;
case "ai" :
case "eps" :
case "ps" : $mime_type= "application/postscript";
break;
case "rtf" : $mime_type= "application/rtf";
break;
case "smp" : $mime_type= "application/studiom";
break;
case "tbt" : $mime_type= "application/timbuktu";
break;
case "js" : $mime_type= "application/x-javascript";
break;
case "asp" : $mime_type= "application/x-asap";
break;
case "csh" : $mime_type= "application/x-csh";
break;
case "dot" : $mime_type= "application/x-dot";
break;
case "dvi" : $mime_type= "application/x-dvi";
break;
case "etc" : $mime_type= "application/x-earthtime";
break;
case "evy" : $mime_type= "application/x-envoy";
break;
case "xll" : $mime_type= "application/x-excel";
break;
case "gtar" : $mime_type= "application/x-gtar";
break;
case "hdf" : $mime_type= "application/x-hdf";
break;
case "latex" : $mime_type= "application/x-latex";
break;
case "fm" : $mime_type= "application/x-maker";
break;
case "mi" :
case "mif" : $mime_type= "application/x-mif";
break;
case "mocha" :
case "moc" : $mime_type= "application/x-mocha";
break;
case "ins" : $mime_type= "application/x-NET-Install";
break;
case "nc" :
case "cdf" : $mime_type= "application/x-netcdf";
break;
case "proxy" : $mime_type= "application/x-ns-proxy-autoconfig";
break;
case "css" : $mime_type= "application/x-pointplus";
break;
case "slc" : $mime_type= "application/x-salsa";
break;
case "sh" : $mime_type= "application/x-sh";
break;
case "shar" : $mime_type= "application/x-shar";
break;
case "spr" :
case "sprite" : $mime_type= "application/x-sprite";
break;
case "tar" : $mime_type= "application/x-tar";
break;
case "tcl" : $mime_type= "application/x-tcl";
break;
case "tex" : $mime_type= "application/x-tex";
break;
case "texi" :
case "texinfo" : $mime_type= "application/x-texinfo";
break;
case "tbp" : $mime_type= "application/x-timbuktu";
break;
case "tki" :
case "tkined" : $mime_type= "application/x-tkined";
break;
case "man" : $mime_type= "application/x-troff-man";
break;
case "me" : $mime_type= "application/x-troff-me";
break;
case "ms" : $mime_type= "application/x-troff-ms";
break;
case "t" :
case "tr" :
case "roff" : $mime_type= "application/x-troff";
break;
case "src" : $mime_type= "application/x-wais-source";
break;
case "zip" : $mime_type= "application/zip";
break;
case "hwp" : $mime_type= "application/hwp";
break;
case "au" :
case "snd" : $mime_type= "audio/basic";
break;
case "es" :
case "esl" : $mime_type= "audio/echospeech";
break;
case "midi" :
case "mid" : $mime_type= "audio/midi";
break;
case "aif" :
case "aiff" :
case "aifc" : $mime_type= "audio/x-aiff";
break;
case "wav" : $mime_type= "audio/x-wav";
break;
case "ra" :
case "ram" : $mime_type= "audio/x-pn-realaudio";
break;
case "pac" : $mime_type= "audio/x-pac";
break;
case "pae" : $mime_type= "audio/x-epac";
break;
case "fif" : $mime_type= "image/fif";
break;
case "gif" : $mime_type= "image/gif";
break;
case "ief" : $mime_type= "image/ief";
break;
case "ifs" : $mime_type= "image/ifs";
break;
case "jpg" :
case "jpe" :
case "jpeg" : $mime_type= "image/jpeg";
break;
case "png" : $mime_type= "image/png";
break;
case "tif" :
case "tiff" : $mime_type= "image/tiff";
break;
case "dwg" :
case "svf" : $mime_type= "image/vnd";
break;
case "wi" : $mime_type= "image/wavelet";
break;
case "bmp" : $mime_type= "image/bmp";
break;
case "ras" : $mime_type= "image/x-cmu-raster";
break;
case "pnm" : $mime_type= "image/x-portable-anymap";
break;
case "pbm" : $mime_type= "image/x-portable-bitmap";
break;
case "pgm" : $mime_type= "image/x-portable-graymap";
break;
case "ppm" : $mime_type= "image/x-portable-pixmap";
break;
case "rgb" : $mime_type= "image/x-rgb";
break;
case "xbm" : $mime_type= "image/x-xbitmap";
break;
case "xpm" : $mime_type= "image/x-xpixmap";
break;
case "xwd" : $mime_type= "image/x-xwindowdump";
break;
case "htm" :
case "html" : $mime_type= "text/html";
break;
case "txt" : $mime_type= "text/plain";
break;
case "rtx" : $mime_type= "text/richtext";
break;
case "tsv" : $mime_type= "text/tab-separated-values";
break;
case "etx" : $mime_type= "text/x-setext";
break;
case "talk" : $mime_type= "text/x-speech";
break;
case "fvi" : $mime_type= "video/isivideo";
break;
case "mpg" :
case "mpe" :
case "mpeg" : $mime_type= "video/mpeg";
break;
case "avi" : $mime_type= "video/msvideo";
break;
case "qt" :
case "mov" : $mime_type= "video/quicktime";
break;
case "viv" :
case "vivo" : $mime_type= "video/vivo";
break;
case "wv" : $mime_type= "video/wavelet";
break;
case "movie" : $mime_type= "video/x-sgi-movie";
break;
case "svr" : $mime_type= "x-world/x-svr";
break;
case "wrl" : $mime_type= "x-world/x-vrml";
break;
case "vrt" : $mime_type= "x-world/x-vrt";
break;
case "ice" : $mime_type= "x-conference/x-cooltalk";
break;
case "gz" : $mime_type= "x-gzip";
break;
case "z" : $mime_type= "x-compress";
break;
case "uue" :
case "uu" : $mime_type= "x-uuencode";
break;
case "map" : $mime_type= "magnus-internal/imagemap";
break;
case "shtml" : $mime_type= "magnus-internal/parsed-html";
break;
case "bat" :
case "cgi" : $mime_type= "magnus-internal/cgi";
break;
default :
$mime_type= "application/octet-stream";
}
return $mime_type;
}
}
?>

735
lib/base/usr_func.php Normal file
View File

@ -0,0 +1,735 @@
<?php
function p( $val, $title="" ){
if( $title ){
echo "==-- {$title} ==<br>".PHP_EOL;
}
if( is_array($val) || is_object($val) ){
print_r($val);
}else{
echo $val;
}
if( $title ){
echo PHP_EOL."<br>== {$title} --==<br>".PHP_EOL;
}
}
function pp( $val, $title="" ){
echo "<pre>";
if( $title ){
echo "==-- {$title} ==".PHP_EOL;
}
if( is_array($val) || is_object($val) ){
print_r($val);
}else{
echo $val;
}
if( $title ){
echo PHP_EOL."== {$title} --==".PHP_EOL;
}
echo "</pre>";
}
function alert($mesg, $url=""){
echo "<script>alert('{$mesg}')</script>";
if( $url ){
move_page($url);
exit;
}
}
function move_page($url, $mesg=""){
if( $mesg ){
alert($mesg);
}
echo "<script>location.href = '{$url}';</script>";
exit;
}
function hback($mesg=""){
if( $mesg ){
alert($mesg);
}
echo "<script>history.back();</script>";
exit;
}
function is_mobile(){
if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$_SERVER['HTTP_USER_AGENT'])||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($_SERVER['HTTP_USER_AGENT'],0,4))){
return true;
}
return false;
}
function strpos_arr($haystack, $needle) {
if(!is_array($needle)) $needle = array($needle);
foreach($needle as $what) {
if(($pos = strpos($haystack, $what))!==false) return $pos;
}
return false;
}
function referer_check(){//이전페이지 체크. 보안용
$refer = preg_replace("/https?:\/\//","",$_SERVER['HTTP_REFERER']);
$refer = substr($refer,0,strpos($refer,"/"));
return preg_match( "/".preg_quote($_SERVER['HTTP_HOST'],"/")."/i", $refer ) === 0;
}
function getDT_datetime( $dt, $format="Y-m-d H:i:s" ){
if( is_object($dt) && get_class($dt) == "DateTime" ){
return $dt->format($format);
}else if( $dt ){
return date($format,strtotime($dt));
}
return "";
}
function getDT_date( $dt, $format="Y-m-d" ){
if( is_object($dt) && get_class($dt) == "DateTime" ){
return $dt->format($format);
}else if( $dt ){
return date($format,strtotime($dt));
}
return "";
}
function strtodate( $str, $format="Y-m-d" ){
if( $str ){
return date($format, strtotime($str));
}
return "";
}
function ndate( $seconds, $format="Y-m-d" ){
if( (int)$seconds ){
return date($format, $seconds);
}
return "";
}
function hidden_input($key, $val){
return '<input type="hidden" name="'.$key.'" value="'.$val.'" />'.PHP_EOL;
}
function csrf_input($mode){
$name = '_CSRF_check_'.$mode;
$sess = uniqid($mode);
if( !isset($_SESSION[$name]) || count($_SESSION[$name]) > 1000 ){
$_SESSION[$name] = Array();
}
$_SESSION[$name][] = $sess;
return '<input type="hidden" name="'.$name.'" class="csrf_'.$mode.'" value="'.$sess.'" />'.PHP_EOL;
}
function csrf_check($mode, $del=false){ //찾을수 없으면 true 리턴
$name = '_CSRF_check_'.$mode;
if( is_array($_SESSION[$name] ) ){
$key = array_search($_REQUEST[$name],$_SESSION[$name]);
if( hasval($key) ){
if( $del ){
csrf_remove($mode);
}
return false;
}
}
return true;
}
function csrf_remove($mode){
$name = '_CSRF_check_'.$mode;
$key = array_search($_REQUEST[$name],$_SESSION[$name]);
if( hasval($key) ){
unset($_SESSION[$name][$key]);
}
}
function image_thumb($src_img, $dest_img, $dest_w, $dest_h, $stretch="N", $force="N", $dest_ext=""){//이미지 변환 - 아이구 지겨워 재미없음..
$src_image = @getimagesize($src_img);
$src_w = $src_image[0];
$src_h = $src_image[1];
$src_ext = $src_image[2];
$img_size = image_size($src_w, $src_h, $dest_w, $dest_h, $stretch, $force);
$dest_w = $img_size['width'];
$dest_h = $img_size['height'];
switch($src_ext){
case 1 :
$src_image_stream = @imagecreatefromgif($src_img);
break;
case 2 :
$src_image_stream = @imagecreatefromjpeg($src_img);
break;
case 3 :
$src_image_stream = @imagecreatefrompng($src_img);
break;
case 15 :
$src_image_stream = @imagecreatefromwbmp($src_img);
break;
default :
echo "<script>alert('Not Supported File Type!!!')</script>";
return false;
}
// $dest_image_stream = imagecreate($dest_w, $dest_h); // GD 2.0 이상 지원시 이것을 사용
$dest_image_stream = @imagecreatetruecolor($dest_w, $dest_h);
// imagecolorallocate($dest_image_stream, 255, 255, 255);
// @imagecopyresized($dest_image_stream, $src_image_stream, 0, 0, 0, 0, $dest_w, $dest_h, $src_w, $src_h);
imagecopyresampled($dest_image_stream, $src_image_stream, 0, 0, 0, 0, $dest_w, $dest_h, $src_w, $src_h); //<-php4.0이후
if( $dest_ext ){
switch($dest_ext) {
case 1 :
@imagegif($dest_image_stream,$dest_img);
break;
case 2 :
@imagejpeg($dest_image_stream,$dest_img,100);
break;
case 3 :
@imagepng($dest_image_stream,$dest_img);
break;
case 15 :
@imagewbmp($dest_image_stream,$dest_img);
break;
default :
echo "<script>alert('지원되지 않는 화일형식!!!')</script>";
return false;
}
}else{
switch($src_ext){
case 1 :
@imagegif($dest_image_stream,$dest_img);
break;
case 2 :
@imagejpeg($dest_image_stream,$dest_img,100);
break;
case 3 :
@imagepng($dest_image_stream,$dest_img);
break;
case 15 :
@imagewbmp($dest_image_stream,$dest_img);
break;
default :
echo "<script>alert('지원되지 않는 화일형식!!!')</script>";
return false;
}
}
}
function image_cthumb($src_img, $dest_img, $dest_w, $dest_h){//이미지 크기 맞춤 이외삭제
$src_image = @getimagesize($src_img);
$src_w = $src_image[0];
$src_h = $src_image[1];
$src_ext = $src_image[2];
if( $src_w < $dest_w || $src_h < $dest_h ){
return image_thumb($src_img, $dest_img, $dest_w, $dest_h);
}
if( ($src_w - $dest_w) > ($src_h - $dest_h) ){
$last_w = $dest_w * $src_h/$dest_h;
$last_h = $src_h;
}else{
$last_w = $src_w;
$last_h = $dest_h * $src_w/$dest_w;
}
switch($src_ext){
case 1 :
$src_image_stream = @imagecreatefromgif($src_img);
break;
case 2 :
$src_image_stream = @imagecreatefromjpeg($src_img);
break;
case 3 :
$src_image_stream = @imagecreatefrompng($src_img);
break;
case 15 :
$src_image_stream = @imagecreatefromwbmp($src_img);
break;
default :
echo "<script>alert('Not Supported File Type!!!')</script>";
return false;
}
$dest_image_stream = @imagecreatetruecolor($dest_w, $dest_h);
imagecopyresampled($dest_image_stream, $src_image_stream, 0, 0, ($src_w-$last_w)/2, ($src_h-$last_h)/2, $dest_w, $dest_h, $last_w, $last_h);
@imagejpeg($dest_image_stream,$dest_img,100);
}
function image_size($s_wd, $s_ht, $d_wd, $d_ht, $stretch = "N", $force = "N"){//stretch 늘이기, force 대상크기로 강제맞춤(이미지변형)
if( !$s_wd or !$s_ht or !$d_wd and !$d_ht ){
echo "Error : image_size function parameter error";
}
if( $d_wd and !$d_ht ){
$d_ht = $s_ht * $d_wd / $s_wd;
}else if( !$d_wd and $d_ht ){
$d_wd = $s_wd * $d_ht / $s_ht;
}
if( $force == "Y" ){
if( $stretch == "Y" ){
$size['width'] = $d_wd;
$size['height'] = $d_ht;
}else{
if( $s_wd < $d_wd ){
$size['width'] = $s_wd;
}else{
$size['width'] = $d_wd;
}
if( $s_ht < $d_ht ){
$size['height'] = $s_ht;
}else{
$size['height'] = $d_ht;
}
}
}else{
if( ($s_wd/$d_wd) > ($s_ht/$d_ht) ){
if( $stretch == "N" and $s_wd < $d_wd ){
$d_wd = $s_wd;
}
$size['width'] = $d_wd;
$size['height'] = $s_ht * $d_wd / $s_wd;
}else{
if( $stretch == "N" and $s_ht < $d_ht ){
$d_ht = $s_ht;
}
$size['width'] = $s_wd * $d_ht / $s_ht;
$size['height'] = $d_ht;
}
}
return $size;
}
function file_remove($filepath, $unremove=""){
$glob = glob($filepath);
$rst = true;
foreach( $glob as $filename ) {
if( !$unremove || $filename != $unremove ){
$rst = $rst && @unlink($filename);
}
}
return $rst;
}
function oldfile_remove($filepath, $day=1, $unremove=""){
$glob = glob($filepath);
$rmday = $day * 86400;
$rst = true;
foreach( $glob as $filename ) {
if( fileatime($filename) < time()-$rmday && ( !$unremove || $filename != $unremove && substr(strrchr($filename,'/'),1) != $unremove ) ){
$rst = $rst && @unlink($filename);
}
}
return $rst;
}
function get_ip(){
switch(true){
case (!empty($_SERVER['HTTP_X_REAL_IP'])) :
$real_ip = $_SERVER['HTTP_X_REAL_IP']; break;
case (!empty($_SERVER['HTTP_CLIENT_IP'])) :
$real_ip = $_SERVER['HTTP_CLIENT_IP']; break;
case (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) :
$real_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; break;
default :
$real_ip = $_SERVER['REMOTE_ADDR'];
}
$real_ip = explode(":",$real_ip);
return $real_ip[0];
}
function getRefRow($fields=array()){ //HTTP_REFERER 를 배열로 변경, $fields가 존재하면 그부분 제외
$query= explode("?",$_SERVER['HTTP_REFERER']);
$query= explode("&",$query[1]);
$qrow = Array();
if( count($query) > 0 ){
foreach( $query as $val ){
$temp = explode("=",$val);
if( !in_array($temp[0], $fields) ){
$qrow[$temp[0]] = $temp[1];
}
}
}
return $qrow;
}
function getQuery($qrow, $addrow=array()){
if( count($addrow) > 0 ){
$qrow = array_merge($qrow, $addrow);
}
$query = array();
if( count($qrow) > 0 ){
foreach( $qrow as $key => $val ){
if( hasval($val) ){
$query[] = "{$key}={$val}";
}
}
}
return implode("&", $query);
}
function base64url_encode($data){
$base64 = base64_encode($data);
if ($base64 === false) {
return false;
}
$url = strtr($base64, '+/', '-_');
return rtrim($url, '=');
}
function base64url_decode($data, $strict = false){
$b64 = strtr($data, '-_', '+/');
return base64_decode($b64, $strict);
}
function cval($key){
if( isset($$key) ){
return $$key;
}
return "";
}
function crowval($row, $key, $dval=""){
if( isset($row[$key]) ){
return $row[$key];
}
return $dval;
}
function hasval( $val ){
if( isset($val) && ($val || $val === 0 || $val === "0") ){
return true;
}
return false;
}
function array_merge_static( $row1, $row2 ){
foreach( (array)$row2 as $k => $v ){
$row1[$k] = $v;
}
return $row1;
}
/** getSelectOptions
* @param $row : 선택값
* @param string $emptv : 빈값추가
* @param array $exck : 선택값중 제외(기준키)
* @param array $excv : 선택값중 제외(기준값)
* @return string
*/
function getSelectOptions( $row, $emptv="", $defval="", $exck=array(), $excv=array() ){
$reopt = array();
if( $emptv ){
$reopt[] = "<option value=''>{$emptv}</option>";
}
foreach( (array)$row as $key => $val ){
if( in_array($key, (array)$exck) ) continue;
if( in_array($val, (array)$excv) ) continue;
$selected = false;
if( $defval ){
if( is_array($defval) && in_array( $key, $defval ) ){
$selected = true;
}else if( $key == $defval ){
$selected = true;
}
}
$reopt[] = "<option value='{$key}'".($selected?" selected":"").">{$val}</option>";
}
return implode(PHP_EOL,$reopt);
}
function getSelectOptionsExp( $row, $emptv="", $defval="", $exck=array(), $excv=array() ){
$reopt = array();
if( $emptv ){
$reopt[] = "<option value=''>{$emptv}</option>";
}
foreach( (array)$row as $key => $val ){
if( in_array($key, (array)$exck) ) continue;
if( in_array($val[0], (array)$excv) ) continue;
$selected = false;
if( $defval ){
if( is_array($defval) && in_array( $key, $defval ) ){
$selected = true;
}else if( $key == $defval ){
$selected = true;
}
}
$reopt[] = "<option value='{$key}'".($selected?" selected":"").">{$val[1]} ({$val[0]})</option>";
}
return implode(PHP_EOL,$reopt);
}
/** getCheckboxes
* @param $name : name Attr
* @param $vrow : 선택값
* @param string $defval : default
* @param string $cls1 : 클래스1 label
* @param string $cls2 : 클래스2 input
* @return string
*/
function getCheckboxes( $name, $vrow, $defval="", $cls1="", $cls2="" ){
$reopt = array();
$checked = false;
foreach( (array)$vrow as $key => $val ){
if( $defval ){
if( is_array($defval) && in_array( $key, $defval ) ){
$checked = true;
}else if( $key == $defval ){
$checked = true;
}
}
//$reopt[] = "<label".(($cls1)?" class='{$cls1}'":"")."><input type='checkbox' name='{$name}' value='{$key}' data-defval='".json_encode($defval)."' ".(($cls2)?" class='{$cls2}'":"")."> {$val}</label>";
$reopt[] = "<label".(($cls1)?" class='{$cls1}'":"")."><input type='checkbox' name='{$name}' value='{$key}' ".($checked?" checked":"")." ".(($cls2)?" class='{$cls2}'":"")."> {$val}</label>";
}
return implode(PHP_EOL,$reopt);
}
/** getRadios
* @param $name : name Attr
* @param $vrow : 선택값
* @param string $defval : default
* @param string $cls1 : 클래스1 label
* @param string $cls2 : 클래스2 input
* @return string
*/
function getRadios( $name, $vrow, $defval='', $cls1='', $cls2='' ){
$reopt = array();
foreach( (array)$vrow as $key => $val ){
if( is_object($defval) || is_array($defval) ){
$defval = json_encode($defval);
}
//$reopt[] = "<label".(($cls1)?" class='{$cls1}'":"")."><input type='radio' name='{$name}' value='{$key}' data-defval='".$defval."' ".(($cls2)?" class='{$cls2}'":"")."> {$val}</label>";
$reopt[] = "<label".(($cls1)?" class='{$cls1}'":"")."><input type='radio' name='{$name}' value='{$key}' ". (($defval == $key)?"checked":"") ." ".(($cls2)?" class='{$cls2}'":"")."> {$val}</label>";
}
return implode(PHP_EOL,$reopt);
}
function chkValiMail( $email ){
if( !$email || preg_match("/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/", $email) ){
return true;
}
return false;
}
function chkValiDomain( $domain ){
if( !$domain || preg_match("/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/", $domain) ){
return true;
}
return false;
}
function chkValiUrl( $url ){
if( !$url || preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $url) ){
return true;
}
return false;
}
function chkValiPhone( $phone ){
if( !$phone || preg_match("/^\d{2,3}-\d{3,4}-\d{4}$/", $phone) ){
return true;
}
return false;
}
function chkValiDate( $date ){
if( !$date || preg_match("/^(19|20)\d\d([-])(0[1-9]|1[012])\2(0[1-9]|[12][0-9]|3[01])$/", $date) ){
return true;
}
return false;
}
function chkValiAaSpNum( $str ){
if( !$str || preg_match("/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]$/im", $str) ){
return true;
}
return false;
}
function chkValiAaSp( $str ){
if( !$str || preg_match("/^(?=.*[a-z])(?=.*[A-Z])(?=.*[@$!%*?&])[A-Za-z@$!%*?&]$/im", $str) ){
return true;
}
return false;
}
function chkValiAaNum( $str ){
if( !$str || preg_match("/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d]$/im", $str) ){
return true;
}
return false;
}
function chkValiSpNum( $str ){
if( !$str || preg_match("/^(?=.*[a-z])(?=.*\d)(?=.*[@$!%*?&])[a-z\d@$!%*?&]$/im", $str) ){
return true;
}
return false;
}
function addzero($num, $dan){
return str_pad($num,$dan,'0',STR_PAD_LEFT);
}
function _notAuth( $auth, &$rval="", $cate_id="", $msg="" ){ //단축형... 귀찮아서
global $retval;
if( !$rval ) $rval = &$retval['mesg'];
if( !$GLOBALS['_Auth_']['menuObj']->hasMenuAuth( $auth, $cate_id ) ){
$rval = $msg?:$GLOBALS['_Auth_']['deny_mesg'];
return true;
}
return false;
}
function file_size($bytes, $precision=2){
$unit = ["B", "KB", "MB", "GB"];
$exp = floor(log($bytes, 1024)) ?: 0;
return round($bytes / (pow(1024, $exp)), $precision).$unit[$exp];
}
function get_encode_base64_str($en_word, $charset="UTF-8"){
return "=?" . strtolower($charset) . "?B?" . base64_encode($en_word) . "?=";
}
/*
* javascript : btoa(encodeURIComponent(JSON.stringify(data))) , 배열처리
* */
function decode_Post($pval){
return json_decode(urldecode(base64_decode($pval)),true);
}
function curl_request( $access_url, $query="", $method="GET", $headers="", $options="", $cookie="", $retm="body" ){
if( is_array($query) ){
$strquery = http_build_query($query);
}else{
$strquery = $query;
}
$ch = curl_init();
switch( strtoupper($method) ){
case "POST" :
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $strquery);
break;
case "GET" :
if( $strquery ){
$access_url = $access_url."?".$strquery;
}
break;
case "PUT" :
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt( $ch, CURLOPT_POSTFIELDS, $strquery);
break;
case "DELETE" :
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt( $ch, CURLOPT_POSTFIELDS, $strquery);
break;
case "RAW" :
if( is_array($query) ){
$strquery = json_encode( $query );
};
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $strquery);
if( $headers ){
if( !is_array($headers) ){
$headers = Array($headers);
}
}else{
$headers = array();
}
$headers[] = 'Content-Type: application/json';
break;
}
if( $headers ) { //(e.g., array("fruit: apple", "colour: red")
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
if( $options ) { //(e.g., array("fruit"=>"apple", "colour"=>"red")
curl_setopt_array($ch, $options);
}
curl_setopt( $ch, CURLOPT_URL, $access_url);
curl_setopt( $ch, CURLOPT_USERAGENT, "Kuls Api" );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 1);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
if( $cookie ){ //(e.g., "fruit=apple; colour=red")
curl_setopt( $ch, CURLOPT_COOKIE, $cookie);
}
$curl_result = curl_exec( $ch );
curl_close( $ch );
list( $header, $response ) = explode("\r\n\r\n", $curl_result, 2);
$header = get_http_header_as_array($header);
switch( $retm ){
case "all":
return Array(
"header" => $header,
"response" => $response,
);
case "header":
return $header;
case "body":
default:
return $response;
}
}
function get_http_header_as_array($rawheader){
$header_array = array();
$header_rows = explode("\n",$rawheader);
for($i=0;$i<count($header_rows);$i++){
$fields = explode(":",$header_rows[$i]);
if($i != 0 && !isset($fields[1])){//carriage return bug fix.
if(substr($fields[0], 0, 1) == "\t"){
end($header_array);
$header_array[key($header_array)] .= "\r\n\t".trim($fields[0]);
}else{
end($header_array);
$header_array[key($header_array)] .= trim($fields[0]);
}
}else{
$field_title = trim($fields[0]);
if (!isset($header_array[$field_title])){
$header_array[$field_title]=trim($fields[1]);
}else if(is_array($header_array[$field_title])){
$header_array[$field_title] = array_merge($header_array[$fields[0]], array(trim($fields[1])));
}else{
$header_array[$field_title] = array_merge(array($header_array[$fields[0]]), array(trim($fields[1])));
}
}
}
return $header_array;
}
function Spcurl_response($url, $query, $method) {
return curl_request( $url, $query, $method, "", "", "" );
}
function Spcurl_header($url, $query, $method) {
return curl_request( $url, $query, $method, "", "", "", "header" );
}
function Spcurl($url, $query, $method) {
return curl_request( $url, $query, $method, "", "", "", "all" );
}
//테스트결과 저정/확인용 함수
function chkToFile( $filename, $contents ){
$fp = fopen(_UP_PATH_."/{$filename}","a+");
fwrite($fp, $contents.PHP_EOL);
fclose($fp);
}

38
lib/common_lib.php Normal file
View File

@ -0,0 +1,38 @@
<?php
/* 외부 */
include_once __DIR__."/vendor/Altorouter.php";
include_once __DIR__."/vendor/mail_lib.php";
include_once __DIR__."/vendor/UserAgentParser.php";
include_once __DIR__."/vendor/Punycode.php";
/* Base1 */
include_once __DIR__."/base/lcrypt.class.php";
include_once __DIR__."/base/pagenation.class.php";
include_once __DIR__."/db/db_inc.php";
/* Base2 */
include_once __DIR__."/base/basecode.class.php";
include_once __DIR__."/base/clist.class.php";
include_once __DIR__."/base/cmanage.class.php";
include_once __DIR__."/base/kcate.class.php";
include_once __DIR__."/base/upload.class.php";
include_once __DIR__."/base/token.class.php";
/* App */
include_once __DIR__."/usrlib/mlang.class.php";
include_once __DIR__."/app/auth.class.php";
include_once __DIR__."/app/member.class.php";
include_once __DIR__."/app/menu.class.php";
include_once __DIR__."/app/cust.class.php";
include_once __DIR__."/app/board.class.php";
include_once __DIR__."/app/attach.class.php";
include_once __DIR__."/app/visit.class.php";
include_once __DIR__."/app/qrylog.class.php";
include_once __DIR__."/usrlib/common_vars.class.php";
include_once __DIR__."/usrlib/sk_attach.class.php";
include_once __DIR__."/usrlib/sangseng_api.class.php";
/* Function */
include_once __DIR__."/base/usr_func.php";

18
lib/db/db_inc.php Normal file
View File

@ -0,0 +1,18 @@
<?php
switch( $_DBConfig['database_type'] ){
case "mssql" :
//include __DIR__."/db/mssql_lib.php";
include_once __DIR__."/db_where.class.php";
include_once __DIR__."/mssql.class.php"; //BaseDB Class 포함
break;
case "mysql" :
default :
//include __DIR__."/db/mysql_lib.php";
include_once __DIR__."/mysql.class.php"; //없음
}
$_BDB = new BaseDB();
$__dbconn__ = $_BDB->DB->dbconn;

75
lib/db/db_where.class.php Normal file
View File

@ -0,0 +1,75 @@
<?php
class DB_where{ //함수가 같은 값이 들어올때는 ? 대신 적용하는걸 생각해야 한다.
public $where_obj;
public function __construct( $com="and" ){
$this->where_obj = new stdClass();
$this->where_obj->com = $com;
$this->where_obj->row = array();
switch( $com ){
case "and":
$this->add("1=?",1); break;
case "or":
$this->add("1<>?",1); break;
}
}
public function add($qry, $val="EMPTY"){
if( is_array($val) ){
foreach( $val as $v ){
$this->where_obj->row[] = array("qry"=>$qry,"val"=>$v);
}
}else{
$this->where_obj->row[] = array("qry"=>$qry,"val"=>$val);
}
}
public function sub_where($com){
$sub_where = new DB_where($com);
$this->where_obj->row[] = $sub_where;
return $sub_where;
}
public function get_where(){
$qryrow = array();
$valrow = array();
foreach( (array)$this->where_obj->row as $wval ){
if( is_object($wval) ){
$subs = $wval->get_where();
$qryrow[] = "( {$subs['qry']} )";
$valrow = array_merge($valrow, $subs['val']);
}else{
if( $wval['val'] == "EMPTY" ) {
$qryrow[] = "{$wval['qry']}";
}else{
if ($this->chkeval($wval['val'])) {
$qryrow[] = str_replace("?", $this->valeval($wval['val']), $wval['qry']);
} else {
$qryrow[] = "{$wval['qry']}";
array_push($valrow, $wval['val']);
}
}
}
}
return array(
'qry' => implode( " {$this->where_obj->com} ", $qryrow ),
'val' => $valrow,
);
}
public function sqleval($str){
return chr(27).$str;
}
public function chkeval($str){
if( preg_match("/^".chr(27)."/ims",$str) ){
return true;
}
return false;
}
public function valeval($str,$val=""){
return preg_replace("/^".chr(27)."/ims",$val,$str);
}
}

508
lib/db/mssql.class.php Normal file
View File

@ -0,0 +1,508 @@
<?php
class DB_Mssql {
public $dbconn;
public $dboption;
public $query_print = false;
public $query_record = true;
public function __construct($db_option=""){
global $__dbconn__;
$_config_db_option = @parse_ini_file("db_config.php");
$this->dboption = $db_option ?: $_config_db_option;
if( !$db_option && $__dbconn__ ) { //기본 Connection을 이용
$this->dbconn = $__dbconn__;
}else{ //전용 Connection을 이용
$this->dbConn($db_option);
}
}
public function dbConn($db_option=""){
$_config_db_option = @parse_ini_file("db_config.php");
if( !$_config_db_option ){
$_config_db_option = @parse_ini_file(_ROOT_PATH_."/config/db_config.php");
}
if( !$db_option ) $db_option = array();
/*위에 있어서 필요없는 코드*/
$db_option["database_type"] = $db_option["database_type"] ?: $_config_db_option["database_type"];
$db_option["database_host"] = $db_option["database_host"] ?: $_config_db_option["database_host"];
$db_option["database_port"] = $db_option["database_port"] ?: $_config_db_option["database_port"];
$db_option["database_name"] = $db_option["database_name"] ?: $_config_db_option["database_name"];
$db_option["database_user"] = $db_option["database_user"] ?: $_config_db_option["database_user"];
$db_option["database_pass"] = $db_option["database_pass"] ?: $_config_db_option["database_pass"];
$db_option["database_encode"] = $db_option["database_encode"] ?: $_config_db_option["database_encode"];
$db_option["database_charset"] = $db_option["database_charset"] ?: $_config_db_option["database_charset"];
$db_option["database_old"] = $db_option["database_old"] ?: $_config_db_option["database_old"];
if( !$this->dboption ){
$this->dboption = $db_option;
}
$addr = "{$db_option['database_host']},{$db_option['database_port']}";
$option = Array(
"Database" => $db_option['database_name'],
"Uid" => $db_option['database_user'],
"PWD" => $db_option['database_pass'],
"CharacterSet" => $db_option['database_encode'],
"TrustServerCertificate" => "yes",
"ConnectionPooling" => 0,
);
$conn = sqlsrv_connect( $addr, $option);
if( $conn ){
$this->dbconn = $conn;
if( defined("TB_query_log") ){
$this->tableExists(TB_query_log);
}
return $conn;
}else{
die('Could not connect: ' . print_r(sqlsrv_errors(), true));
}
}
public function qry($sql, $sqlrow="", $options="", $print=""){
return $this->cqry($sql, $sqlrow, $options, $print);
}
public function cqry($sql, $sqlrow="", $options="", $print="", $rev=1){
if( $rev === 1 ){
$anrow = $this->anqry($sqlrow);
$params = $anrow['params'];
}else{
$params = $sqlrow;
}
if( $print || $this->query_print ){
echo $this->mkstr($sql,$params?:Array());
}
if( $print ){exit;}
$stmt = @sqlsrv_query($this->dbconn, $sql, $params?:Array(), $options?:Array());
if( $stmt ){
$result = "SUCCESS";
$rst = $stmt;
}else{
$bpage = debug_backtrace();
$fname = $bpage[count($bpage)-1]['file'];
if( !$GLOBALS['NO_SQL_ERR'] ){
$result = print_r(sqlsrv_errors(), true);
echo "<pre>{$fname}".PHP_EOL.$sql.PHP_EOL.print_r($params?:Array(),1).PHP_EOL.PHP_EOL.print_r(sqlsrv_errors(), true)."</pre>";
}else{
$result = "NO_SQL_ERROR";
}
$rst = false;
}
if( $this->query_record ){
$this->putQueryLog( $sql, $params, $result );
}
return $rst;
}
public function query($sql, $params="", $options="", $print=""){
$stmt = $this->qry($sql, $params?:Array(), $options?:Array(), $print);
if( !$stmt ) return false;
$rows = Array();
while( $row = $this->fetch_array($stmt) ){
$rows[] = $row;
}
return $rows;
}
public function call( $procedure, $params=array() ){
$anrow = $this->anqry($params);
$sql = "{CALL {$procedure} (".implode(",",$anrow['val']).")}";
return $this->qry($sql, $params);
}
public function call_output( $procedure, $params=array() ){
$anrow = $this->anqry($params);
$sql = "{CALL {$procedure} ".implode(",",$anrow['val']).")}";
return $this->cqry($sql, $params,"","",2);
}
public function call_next( $stmt ){
return @sqlsrv_next_result($stmt);
}
public function call_all( $procedure, $params=array() ){
$rst = $this->call( $procedure, $params );
if( $rst ){
$rows = Array();
while( $row = $this->fetch_array($rst) ){
$rows[] = $row;
}
return $rows;
}
return $rst;
}
public function exec( $procedure, $params=array() ){
$anrow = $this->anqry($params);
$sql = "EXEC {$procedure} ".implode(",",$anrow['val'])."";
return $this->qry($sql, $params);
}
public function exec_output( $procedure, $params=array() ){ //$params => 숫자키 배열
$anrow = $this->anqry($params);
$sql = "EXEC {$procedure} ".implode(",",$anrow['val'])."";
return $this->cqry($sql, $params,"","",2);
}
public function exec_output_merge( $procedure, $params=array() ){ //$params => 문자 키 배열. output요소가 array(array("값",SQLSRV_PARAM_OUT)) 가 되어야 한다.
$oparams = Array();
foreach( $params as $val ){
$oparams[] = $val;
}
$anrow = $this->anqry($oparams);
$sql = "EXEC {$procedure} ".implode(",",$anrow['val'])."";
return $this->cqry($sql, $oparams,"","",2);
}
public function exec_next( $stmt ){
return @sqlsrv_next_result($stmt);
}
public function exec_all( $procedure, $params=array() ){
$rst = $this->exec( $procedure, $params );
if( $rst ){
$rows = Array();
while( $row = $this->fetch_array($rst) ){
$rows[] = $row;
}
return $rows;
}
return $rst;
}
public function queryFirstField($sql, $params="", $options="", $print=""){
$stmt = $this->qry($sql, $params?:Array(), $options?:Array(), $print);
if( !$stmt ) return false;
return $this->result($stmt,0,0);
}
public function queryFirstRow($sql, $params="", $options="", $print=""){
$stmt = $this->qry($sql, $params?:Array(), $options?:Array(), $print);
if( !$stmt ) return false;
return $this->fetch_array($stmt);
}
public function pqry($sql, $params="", $options=""){
return $this->qry($sql, $params?:Array(), $options?:Array(), 1);
}
public function pquery($sql, $params="", $options=""){
return $this->query($sql, $params?:Array(), $options?:Array(), 1);
}
public function fetch_row($stmt){
if( $stmt ){
return @sqlsrv_fetch_array($stmt, 1);
}
return "sqlsrv_fetch_array Error #1";
}
public function fetch_array($stmt){
if( $stmt ){
return @sqlsrv_fetch_array($stmt, 2);
}
echo "sqlsrv_fetch_array Error #2";
}
public function fetch_object($stmt){
if( $stmt ){
return @sqlsrv_fetch_object($stmt, 2);
}
echo "sqlsrv_fetch_object Error #2";
}
public function num_rows($stmt){
if( $stmt ){
return @sqlsrv_num_rows($stmt);
}
echo "sqlsrv_num_rows Error";
}
public function select_count($tb, $where="", $whererow="", $print=""){
$where = $where?:"1=1";
$sql = "select count(*) from {$tb} where {$where}";
return $this->queryFirstField($sql, $whererow?:array(), $print);
}
public function insert($tb, $row, $print=""){
$anrow = $this->anqry($row);
$sql = "insert into {$tb} (".implode(",",$anrow['fld']).") values (".implode(",",$anrow['val']).")";
$rst = $this->qry($sql, $anrow['params'], "", $print);
return (bool)$rst;
}
public function update($tb, $row, $where="", $whererow="", $print=""){
$where = $where?:"1=1";
$anrow = $this->anqry($row);
$sql = "update {$tb} set ";
$setrow = array();
foreach( (array)$anrow['fld'] as $k => $v ){
$setrow[] = " {$v} = {$anrow['val'][$k]} ";
}
$sql.= implode(",",$setrow)." where {$where}";
foreach( (array)$whererow as $k => $v ){
$anrow['params'][] = $v;
}
$rst = $this->qry($sql, $anrow['params'], "", $print);
return (bool)$rst;
}
public function insertupdate($tb, $ins_row, $upt_row, $where="", $whererow="", $print=""){
$where = $where?:"1=1";
$ins_anrow = $this->anqry($ins_row);
$upt_anrow = $this->anqry($upt_row);
$setrow = array();
foreach( (array)$upt_anrow['fld'] as $k => $v ){
$setrow[] = " {$v} = {$upt_anrow['val'][$k]} ";
}
$sql = "merge into {$tb} as A using (select 1 as dual) as B on ({$where}) ";
$sql.= "when matched then ";
$sql.= "update set ".implode(",",$setrow)." ";
$sql.= "when not matched then ";
$sql.= "insert (".implode(",",$ins_anrow['fld']).") values (".implode(",",$ins_anrow['val']).");";
$params = array_merge($whererow, $upt_anrow['params'], $ins_anrow['params']);
$rst = $this->qry($sql, $params?:Array(), "", $print);
return (bool)$rst;
}
public function delete($tb, $where, $whererow="", $print=""){
$where = $where?:"1=1";
$sql = "delete from {$tb} where {$where}";
$rst = $this->qry($sql, $whererow?:Array(), "", $print);
return (bool)$rst;
}
public function insertId($tb){
if( $tb ){
$sql = "select ident_current(?)";
return $this->queryFirstField($sql,array($tb));
}else{
$sql = "select @@identity";
return $this->queryFirstField($sql);
}
//@@IDENTITY 현재 세션의 테이블에서 생성된 마지막 ID 값을 반환합니다. --// 현재 세션내 모든 테이블에서 발생하는 ID값중 마지막
//SCOPE_IDENTITY() 현재 세션의 테이블에서 생성된 마지막 ID 값을 반환합니다. --// 현재 세션내 특
//IDENT_CURRENT() 임의 세션 및 범위에 있는 특정 테이블에 생성된 값을 반환합니다.
}
public function anqry($row){ // 필드와 값 분리 + assign value
$fld = array();
$val = array();
$params = array();
foreach( (array)$row as $k => $v ){
$fld[] = $k;
if( $this->chkeval($v) ){
$val[] = $this->valeval($v);
}else{
$val[] = "?";
$params[] = $v;
}
}
return Array( "fld"=>$fld, "val"=>$val, "params"=>$params );
}
public function result($stmt, $rows=0, $cols=0){
$rows = intval($rows);
for( $a=0 ; $a<=$rows ; $a++ ){
if( is_int($cols) ){
$arr = $this->fetch_row($stmt);
}else{
$arr = $this->fetch_array($stmt);
}
}
return is_array($arr)?$arr[$cols]:$arr;
}
public function mkstr( $sql, $params="" ){ //쿼리 출력
$params = $params?:Array();
$str = $sql;
for( $a=0 ; $a < substr_count($sql, "?") ; $a++ ){
$str = $this->str_freplace("?","'{$params[$a]}'",$str);
}
return $str;
}
public function str_freplace( $needle, $replace, $str ){
$pos = strpos($str, $needle);
if( $pos !== false ){
$nstr = substr_replace($str, $replace, $pos, strlen($needle));
}
return $nstr;
}
public function limit($start, $length){
if( $length > 0 ){
return " offset {$start} rows fetch next {$length} rows only ";
}
return '';
}
public function addLimit($sql, $ordby, $start, $length){
$ordby = $ordby?:1;
$start = $start?:0;
$length = $length?:999999999998;
if( $this->dboption["database_version"] && $this->dboption["database_version"] <= "2008" ){
$start = $start+1;
$length = $start+$length-1;
$sql = "select * from ( select *, row_number() over(order by {$ordby}) as ROWNUM from ({$sql}) as tblsub ) as tblmain where ROWNUM between {$start} and {$length}";
}else {
$sql = "{$sql} order by {$ordby} offset {$start} rows fetch next {$length} rows only ";
}
return $sql;
}
public function sqleval($str){
return chr(27).$str;
}
public function chkeval($str){
if( !is_array($str) && preg_match("/^".chr(27)."/ims",$str) ){
return true;
}
return false;
}
public function valeval($str,$val=""){
return preg_replace("/^".chr(27)."/ims",$val,$str);
}
public function tableExists( $table ){
if( !$table ) return false;
$tbl = explode(".",$table);
if( !$tbl[1] ){
$database = "dbo";
$table = $tbl[0];
}else{
$database = $tbl[0];
$table = $tbl[1];
}
$cnt = $this->queryFirstField("select 1 from Information_schema.tables where TABLE_TYPE = ? and TABLE_NAME = ?", array(
"BASE TABLE",
$table
));
if( $cnt ){
return true;
}else{
if( !( $fs = fopen( TB_schema_file, "r") ) ) return false;
while( $rw = fgets($fs, 255) ){
$tbname = defined("TB_HEAD")?preg_replace("/^".TB_HEAD."/","",$table):$table;
if( chop($rw) == "[{$tbname}]" ) break;
}
$query = "create table {$database}.{$table} ";
while( $rw = fgets($fs, 255) ){
if( chop($rw) != "-end-" ){
$rw = preg_replace("/ comment[ \=].*\'.*\'/ims","",$rw);
$rw = preg_replace("/CONSTRAINT pk\_/ims","CONSTRAINT pk_".TB_HEAD,$rw);
$rw = preg_replace("/CONSTRAINT fk\_/ims","CONSTRAINT fk_".TB_HEAD,$rw);
$rw = preg_replace("/CONSTRAINT uk\_/ims","CONSTRAINT uk_".TB_HEAD,$rw);
$rw = preg_replace("/CONSTRAINT ik\_/ims","CONSTRAINT ik_".TB_HEAD,$rw);
$query .= $rw;
}else{
break;
}
}
fclose($fs);
$rst = $this->qry($query);
if( $rst ){
include TB_data_file;
if( isset($table_base_data[$tbname]) ){
foreach( $table_base_data[$tbname] as $val ){
$this->insert($table, $val);
}
}
}
return $rst;
}
}
public function putQueryLog( $save_sql, $save_params, $result ){
global $__dbconn__;
if( !defined("TB_query_log") ) return false;
if( preg_match("/Information_schema.tables/ims", $save_sql) ) return false;
$this->delQueryLog(1);
$qryrow = Array(
"query_date" => $this->sqleval("CURRENT_TIMESTAMP"),
"query_result" => $result,
"host_name" => $this->dboption["database_host"],
"db_name" => $this->dboption["database_name"],
"query_string" => $save_sql,
"query_params" => @print_r($save_params, true),
"visit_sess" => $_SESSION['visit_sess'],
"member_id" => $GLOBALS['_Umem']['member_id'],
);
$anrow = $this->anqry($qryrow);
$sql = "insert into ".TB_query_log." (".implode(",",$anrow['fld']).") values (".implode(",",$anrow['val']).")";
return @sqlsrv_query($__dbconn__, $sql, $anrow['params']);
}
public function delQueryLog( $month = 6 ){
global $__dbconn__;
if( rand(1,100) === 50 ){ // 1% 확률로 삭제
$month= -1*abs($month);
$sql = "delete from ".TB_query_log." where query_date < dateadd(month, {$month}, getdate()) ";
return @sqlsrv_query($__dbconn__, $sql);
}
return false;
}
public function callTransaction(){
return sqlsrv_begin_transaction( $this->dbconn );
}
public function callCommit(){
return sqlsrv_commit( $this->dbconn );
}
public function callRollBack(){
return sqlsrv_rollback( $this->dbconn );
}
public function setPrint(){
$this->query_print = true;
}
public function resetPrint(){
$this->query_print = false;
}
public function setRecord(){
$this->query_record = true;
}
public function resetRecord(){
$this->query_record = false;
}
}
class BaseDB {
public $DB;
public $lcrypt;
public function __construct($db_option=""){
$this->DB = new DB_Mssql($db_option);
$this->lcrypt = new lcrypt();
}
}

31
lib/db/mssql_lib.php Normal file
View File

@ -0,0 +1,31 @@
<?php
function DB_conn($db_option){
$addr = "{$db_option['database_host']},{$db_option['database_port']}";
$option = Array(
"Database" => $db_option['database_name'],
"Uid" => $db_option['database_user'],
"PWD" => $db_option['database_pass'],
"CharacterSet" => $db_option['database_encode'],
);
if( $db_option['database_old'] ){
$option['Encrypt'] = "yes";
$option['TrustServerCertificate'] = "yes";
}
$conn = sqlsrv_connect( $addr, $option);
if( $conn ){
return $conn;
}else{
die('Could not connect: ' . print_r(sqlsrv_errors(), true));
}
}
function sqlsrv_qry($conn, $tsql, $params=Array(), $options=Array()){
$stmt = @sqlsrv_query($conn, $tsql, $params, $options);
if( $stmt ) return $stmt;
else {
echo "<pre>".print_r(sqlsrv_errors(), true)."</pre>";
return false;
}
}
//에러 처리용으로 하나만 만들고 기본 예약함수만 쓴다.

12
lib/db/mysql_lib.php Normal file
View File

@ -0,0 +1,12 @@
<?php
function DB_conn($option){
$conn = mysqli_connect($option['database_host'], $option['database_user'], $option['database_pass'], $option['database_name'], $option['database_port']);
if( $conn ){
$option['database_encode'] ? mysqli_set_charset($conn, preg_replace("/\-|\_/ims","",$option['database_encode'])) : "";
return $conn;
}else{
die('Could not connect: ' . mysqli_connect_error());
}
}
//안만든다. 안쓸거니까.

260
lib/globals_inc.php Normal file
View File

@ -0,0 +1,260 @@
<?php
if( !$_REQUEST['mode'] ){
$_RAW_TMP = file_get_contents("php://input");
$_RAW = json_decode($_RAW_TMP, true);
if( $_RAW['mode'] ){
$_REQUEST = $_RAW;
}
}
if( $_REQUEST['member_token'] ){
$tkObj = new Token();
$token_info = $tkObj->getFromToken($_REQUEST['member_token']);
$token_stauts = $tkObj->statusToken($token_info);
switch( $token_stauts ){
case "E" : //토큰 연장
$new_token = $tkObj->putToken($token_info['member_id'], $token_info['auth']);
case "Y" : //토큰 유효
$_SESSION['auth_mem_id'] = $token_info['member_id'];
break;
// 토큰 연장처리 되어 새로운 토큰($new_token) 이 발행되었는데도 갱신하지 않고,
// 예전 토큰 그대로 사용하면 중복 인증요청으로 무효토큰 처리되니
// 새로운 토큰이 발행되면 다음 요청시엔 꼭 새로운 토큰으로 교체하는 과정이 필요.
// APP 에서 요청할때 응답이 필요한 요청이외의 단순 요청부분까지 응답을 필수 확인하여 $new_token 값이 있는지 점검후 교체하는 로직 필수!!
case "F" : //토큰 비활성
$tkObj->retireToken( $token_info['auth'] );
case "N" : //토큰 무효
unset($_SESSION['auth_mem_id']);
break;
}
}
$GLOBALS['week_word'] = Array(
"eng" => Array(
"sun",
"mon",
"the",
"wed",
"thu",
"fri",
"sat",
),
"kor" => Array(
"",
"",
"",
"",
"",
"",
"",
)
);
$GLOBALS['mon_word'] = Array(
"eng" => Array(
"jan",
"feb",
"mar",
"apr",
"may",
"jun",
"jul",
"aug",
"sep",
"oct",
"nov",
"dec",
),
"kor" => Array(
"01월",
"02월",
"03월",
"04월",
"05월",
"06월",
"07월",
"08월",
"09월",
"10월",
"11월",
"12월",
)
);
$baseObj = new Member();
$GLOBALS['_Umem'] = $baseObj->loginCheck($_SESSION['auth_mem_id']);
$GLOBALS['_varsBaseCode'] = Array( //기본변수
"line_num" => 20, //기본 라인수
"page_num" => 5, //기본 페이지 출력수
"id_len" => 6, //아이디 길이
"pw_len" => 6, //비밀번호 길이
"cate_depth" => 4, //카테고리 분류 최대 자리수. 4자리는 0001 ~ 9999 까지 레벨당 총 9999개 Child를 가지게 된다.
);
$GLOBALS['_varsMemStatus'] = Array( //회원상태
1 => "활동중",
2 => "승인대기",
3 => "정지",
);
$GLOBALS['_varsLoginResult'] = Array( //로그인결과
0 => "실패",
1 => "성공",
);
$GLOBALS['_varsMenuArea'] = Array( //사용 페이지구분
"service" => "사용자/실무자 화면",
"partner" => "고객사 관리화면",
"admin" => "관리자 화면"
);
$GLOBALS['_varsAuthArea'] = Array( //권한대상
"G" => "그룹권한",
"M" => "개별권한",
);
$GLOBALS['_varsAuthAdmin'] = Array( //관리자구분
"SA" => "슈퍼관리자",
"A" => "일반관리자",
);
$GLOBALS['_varsAuthMember'] = Array( //회원구분
"SM" => "특별회원",
"M" => "일반회원",
"Y" => "게스트",
);
$GLOBALS['_varsCommonStatus'] = Array( //공통 상태허용
"0" => "정지",
"1" => "활동중",
);
$GLOBALS['_varsBoardEditor'] = Array( //웹에디터 선택
"tinymce" => "웹에디터",
"text" => "텍스트",
);
$GLOBALS['_varsPagingList'] = Array("5"=>5,"10"=>10,"20"=>20,"50"=>50,"100"=>100,"200"=>200,"500"=>500,"1000"=>1000,"2000"=>2000,"5000"=>5000,"10000"=>10000);
/* 디폴트 값을 기준정보 관리와 매칭 시켜야 한다. */
//$GLOBALS['_varsBaseCode'] = array_merge_static($GLOBALS['_varsBaseCode'], $baseObj->getBaseCodeVars("cm_var","cm_var"));
//$GLOBALS['_varsMemStatus'] = $baseObj->getBaseCodeVars("mem_status","mem_status") ?: $GLOBALS['_varsMemStatus'];
//$GLOBALS['_varsLoginResult'] = $baseObj->getBaseCodeVars("login_result","login_result") ?: $GLOBALS['_varsLoginResult'];
//$GLOBALS['_varsMenuArea'] = $baseObj->getBaseCodeVars("menu_area","menu_area") ?: $GLOBALS['_varsMenuArea'];
//$GLOBALS['_varsAuthArea'] = $baseObj->getBaseCodeVars("auth_area","auth_area") ?: $GLOBALS['_varsAuthArea'];
//$GLOBALS['_varsAuthAdmin'] = $baseObj->getBaseCodeVars("auth_admin","auth_admin") ?: $GLOBALS['_varsAuthAdmin'];
//$GLOBALS['_varsAuthMember'] = $baseObj->getBaseCodeVars("auth_member","auth_member") ?: $GLOBALS['_varsAuthMember'];
//$GLOBALS['_varsCommonStatus'] = $baseObj->getBaseCodeVars("common_status","common_status") ?: $GLOBALS['_varsCommonStatus'];
//$GLOBALS['_varsBoardEditor'] = $baseObj->getBaseCodeVars("board_editor","board_editor") ?: $GLOBALS['_varsBoardEditor'];
//$GLOBALS['_varsPosition'] = $baseObj->getBaseCodeVars("position","position") ?: $GLOBALS['_varsPosition'];
//$GLOBALS['_varsJobrole'] = $baseObj->getBaseCodeVars("JOB_ROLE","JOB_ROLE") ?: $GLOBALS['_varsJobrole'];
//$GLOBALS['_varsJobfunc'] = $baseObj->getBaseCodeVars("JOB_FUNC","JOB_FUNC") ?: $GLOBALS['_varsJobfunc'];
//$GLOBALS['_varsEmptype'] = $baseObj->getBaseCodeVars("EMP_TYPE","EMP_TYPE") ?: $GLOBALS['_varsEmptype'];
//$GLOBALS['_varsNations'] = $baseObj->getBaseCodeVars("nation_code","nation_code") ?: $GLOBALS['_varsNations'];
//$GLOBALS['_varsCurrency'] = $baseObj->getBaseCodeVars("currency","currency") ?: $GLOBALS['_varsCurrency'];
//$GLOBALS['_varsCurrencyExp'] = $baseObj->getBaseCodeVarsExp("currency","currency") ?: $GLOBALS['_varsCurrency'];
//$GLOBALS['_WH_TYPE'] = $baseObj->getBaseCodeVars("WH_TYPE","WH_TYPE") ?: $GLOBALS['_WH_TYPE'];
//$GLOBALS['_ITEM_GRP'] = $baseObj->getBaseCodeVars("ITEM_GRP","ITEM_GRP") ?: $GLOBALS['_ITEM_GRP'];
//$GLOBALS['_SHAPE_GRP'] = $baseObj->getBaseGroupVars("SHAPE_TYPE") ?: $GLOBALS['_SHAPE_TYPE'];
//$GLOBALS['_SHAPE_TYPE'] = $baseObj->getBaseCodeVars("SHAPE_TYPE") ?: $GLOBALS['_SHAPE_TYPE'];
//$GLOBALS['_ITEM_ACCNT'] = $baseObj->getBaseCodeVars("ITEM_ACCNT","ITEM_ACCNT") ?: $GLOBALS['_ITEM_ACCNT'];
//$GLOBALS['_LOCATION_TYPE'] = $baseObj->getBaseCodeVars("LOCATION_TYPE","LOCATION_TYPE") ?: $GLOBALS['_LOCATION_TYPE'];
//$GLOBALS['_OP_GRP'] = $baseObj->getBaseCodeVars("OP_GRP","OP_GRP") ?: $GLOBALS['_OP_GRP'];
//$GLOBALS['_ITEM_SPEC'] = $baseObj->getBaseCodeVars("ITEM_SPEC","ITEM_SPEC") ?: $GLOBALS['_ITEM_SPEC'];
//$GLOBALS['_INSP_ITEM'] = $baseObj->getBaseCodeVars("INSP_ITEM","INSP_ITEM") ?: $GLOBALS['_INSP_ITEM'];
//$GLOBALS['_SALES_GRP'] = $baseObj->getBaseCodeVars("SALES_GRP","SALES_GRP") ?: $GLOBALS['_SALES_GRP'];
//$GLOBALS['_DEAL_TYPE'] = $baseObj->getBaseCodeVars("DEAL_TYPE","DEAL_TYPE") ?: $GLOBALS['_DEAL_TYPE'];
//$GLOBALS['_PAY_METH'] = $baseObj->getBaseCodeVars("PAY_METH","PAY_METH") ?: $GLOBALS['_PAY_METH'];
//$GLOBALS['_UNIT'] = $baseObj->getBaseCodeVars("UNIT","UNIT") ?: $GLOBALS['_UNIT'];
//$GLOBALS['_SHIFT_ID'] = $baseObj->getBaseCodeVars("SHIFT_ID","SHIFT_ID") ?: $GLOBALS['_SHIFT_ID'];
//$GLOBALS['_SHIFT_TYPE'] = $baseObj->getBaseCodeVars("SHIFT_TYPE","SHIFT_TYPE") ?: $GLOBALS['_SHIFT_TYPE'];
//$GLOBALS['_TM_TYPE'] = $baseObj->getBaseCodeVars("TM_TYPE","TM_TYPE") ?: $GLOBALS['_TM_TYPE'];
//$GLOBALS['_FACLT_TYPE'] = $baseObj->getBaseCodeVars("FACLT_TYPE","FACLT_TYPE") ?: $GLOBALS['_FACLT_TYPE'];
//$GLOBALS['_FACLT_TYPE_EXP'] = $baseObj->getBaseCodeVarsExp("FACLT_TYPE","FACLT_TYPE") ?: $GLOBALS['_FACLT_TYPE'];
//$GLOBALS['_IN_TYPE'] = $baseObj->getBaseCodeVars("IN_TYPE","IN_TYPE") ?: $GLOBALS['_IN_TYPE'];
//$GLOBALS['_EXPEN_TYPE'] = $baseObj->getBaseCodeVars("EXPEN_TYPE","EXPEN_TYPE") ?: $GLOBALS['_EXPEN_TYPE'];
//$GLOBALS['_OP_PART'] = $baseObj->getBaseCodeVars("OP_PART","OP_PART") ?: $GLOBALS['_OP_PART'];
//$GLOBALS['_RUNSTOP_GB'] = $baseObj->getBaseCodeVars("RUNSTOP_GB","RUNSTOP_GB") ?: $GLOBALS['_RUNSTOP_GB'];
//$GLOBALS['_ITEN_STATUS'] = $baseObj->getBaseCodeVars("ITEN_STATUS","ITEN_STATUS") ?: $GLOBALS['_ITEN_STATUS'];
//$GLOBALS['_PROD_STATUS'] = $baseObj->getBaseCodeVars("PROD_STATUS","PROD_STATUS") ?: $GLOBALS['_PROD_STATUS'];
//$GLOBALS['_FOUND_TYPE'] = $baseObj->getBaseCodeVars("FOUND_TYPE","FOUND_TYPE") ?: $GLOBALS['_FOUND_TYPE'];
//$GLOBALS['_JUDG_CD'] = $baseObj->getBaseCodeVars("JUDG_CD","JUDG_CD") ?: $GLOBALS['_JUDG_CD'];
//$GLOBALS['_LOAD_TYPE'] = $baseObj->getBaseCodeVars("LOAD_TYPE","LOAD_TYPE") ?: $GLOBALS['_LOAD_TYPE'];
//$GLOBALS['_REQ_INSP_ITEM'] = $baseObj->getBaseCodeVars("REQ_INSP_ITEM","REQ_INSP_ITEM") ?: $GLOBALS['_REQ_INSP_ITEM'];
$GLOBALS['_ALL_BASE'] = $baseObj->getBaseCodeVarsAll("","") ?: "";
$GLOBALS['_varsBaseCode'] = array_merge_static($GLOBALS['_varsBaseCode'], $GLOBALS['_ALL_BASE']['CODE']['cm_var']);
$GLOBALS['_SHAPE_GRP'] = $baseObj->getBaseGroupVars("SHAPE_TYPE") ?: $GLOBALS['_SHAPE_TYPE'];
$GLOBALS['_varsMemStatus'] = $GLOBALS['_ALL_BASE']['CODE']['mem_status'] ?: $GLOBALS['_varsMemStatus'];
$GLOBALS['_varsLoginResult'] = $GLOBALS['_ALL_BASE']['CODE']['login_result'] ?: $GLOBALS['_varsLoginResult'];
$GLOBALS['_varsMenuArea'] = $GLOBALS['_ALL_BASE']['CODE']['menu_area'] ?: $GLOBALS['_varsMenuArea'];
$GLOBALS['_varsAuthArea'] = $GLOBALS['_ALL_BASE']['CODE']['auth_area'] ?: $GLOBALS['_varsAuthArea'];
$GLOBALS['_varsAuthAdmin'] = $GLOBALS['_ALL_BASE']['CODE']['auth_admin'] ?: $GLOBALS['_varsAuthAdmin'];
$GLOBALS['_varsAuthMember'] = $GLOBALS['_ALL_BASE']['CODE']['auth_member'] ?: $GLOBALS['_varsAuthMember'];
$GLOBALS['_varsCommonStatus'] = $GLOBALS['_ALL_BASE']['CODE']['common_status'] ?: $GLOBALS['_varsCommonStatus'];
// $GLOBALS['_varsBoardEditor'] = $GLOBALS['_ALL_BASE']['CODE']['board_editor'] ?: $GLOBALS['_varsBoardEditor'];
$GLOBALS['_varsPosition'] = $GLOBALS['_ALL_BASE']['CODE']['position'] ?: $GLOBALS['_varsPosition'];
$GLOBALS['_varsJobrole'] = $GLOBALS['_ALL_BASE']['CODE']['JOB_ROLE'] ?: $GLOBALS['_varsJobrole'];
$GLOBALS['_varsJobfunc'] = $GLOBALS['_ALL_BASE']['CODE']['JOB_FUNC'] ?: $GLOBALS['_varsJobfunc'];
$GLOBALS['_varsEmptype'] = $GLOBALS['_ALL_BASE']['CODE']['EMP_TYPE'] ?: $GLOBALS['_varsEmptype'];
$GLOBALS['_varsNations'] = $GLOBALS['_ALL_BASE']['CODE']['nation_code'] ?: $GLOBALS['_varsNations'];
$GLOBALS['_varsCurrency'] = $GLOBALS['_ALL_BASE']['CODE']['currency'] ?: $GLOBALS['_varsCurrency'];
$GLOBALS['_varsCurrencyExp'] = $GLOBALS['_ALL_BASE']['CODEEXP']['currency'] ?: $GLOBALS['_varsCurrency'];
$GLOBALS['_WH_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['WH_TYPE'] ?: $GLOBALS['_WH_TYPE'];
$GLOBALS['_ITEM_GRP'] = $GLOBALS['_ALL_BASE']['CODE']['ITEM_GRP'] ?: $GLOBALS['_ITEM_GRP'];
$GLOBALS['_SHAPE_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['SHAPE_TYPE'] ?: $GLOBALS['_SHAPE_TYPE'];
$GLOBALS['_ITEM_ACCNT'] = $GLOBALS['_ALL_BASE']['CODE']['ITEM_ACCNT'] ?: $GLOBALS['_ITEM_ACCNT'];
$GLOBALS['_LOCATION_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['LOCATION_TYPE'] ?: $GLOBALS['_LOCATION_TYPE'];
$GLOBALS['_OP_GRP'] = $GLOBALS['_ALL_BASE']['CODE']['OP_GRP'] ?: $GLOBALS['_OP_GRP'];
$GLOBALS['_ITEM_SPEC'] = $GLOBALS['_ALL_BASE']['CODE']['ITEM_SPEC'] ?: $GLOBALS['_ITEM_SPEC'];
$GLOBALS['_INSP_ITEM'] = $GLOBALS['_ALL_BASE']['CODE']['INSP_ITEM'] ?: $GLOBALS['_INSP_ITEM'];
$GLOBALS['_SALES_GRP'] = $GLOBALS['_ALL_BASE']['CODE']['SALES_GRP'] ?: $GLOBALS['_SALES_GRP'];
$GLOBALS['_DEAL_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['DEAL_TYPE'] ?: $GLOBALS['_DEAL_TYPE'];
$GLOBALS['_PAY_METH'] = $GLOBALS['_ALL_BASE']['CODE']['PAY_METH'] ?: $GLOBALS['_PAY_METH'];
$GLOBALS['_UNIT'] = $GLOBALS['_ALL_BASE']['CODE']['UNIT'] ?: $GLOBALS['_UNIT'];
$GLOBALS['_SHIFT_ID'] = $GLOBALS['_ALL_BASE']['CODE']['SHIFT_ID'] ?: $GLOBALS['_SHIFT_ID'];
$GLOBALS['_SHIFT_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['SHIFT_TYPE'] ?: $GLOBALS['_SHIFT_TYPE'];
$GLOBALS['_TM_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['TM_TYPE'] ?: $GLOBALS['_TM_TYPE'];
$GLOBALS['_FACLT_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['FACLT_TYPE'] ?: $GLOBALS['_FACLT_TYPE'];
$GLOBALS['_FACLT_TYPE_EXP'] = $GLOBALS['_ALL_BASE']['CODEEXP']['FACLT_TYPE'] ?: $GLOBALS['_FACLT_TYPE'];
$GLOBALS['_IN_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['IN_TYPE'] ?: $GLOBALS['_IN_TYPE'];
$GLOBALS['_EXPEN_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['EXPEN_TYPE'] ?: $GLOBALS['_EXPEN_TYPE'];
$GLOBALS['_OP_PART'] = $GLOBALS['_ALL_BASE']['CODE']['OP_PART'] ?: $GLOBALS['_OP_PART'];
$GLOBALS['_RUNSTOP_GB'] = $GLOBALS['_ALL_BASE']['CODE']['RUNSTOP_GB'] ?: $GLOBALS['_RUNSTOP_GB'];
$GLOBALS['_ITEN_STATUS'] = $GLOBALS['_ALL_BASE']['CODE']['ITEN_STATUS'] ?: $GLOBALS['_ITEN_STATUS'];
$GLOBALS['_PROD_STATUS'] = $GLOBALS['_ALL_BASE']['CODE']['PROD_STATUS'] ?: $GLOBALS['_PROD_STATUS'];
$GLOBALS['_FOUND_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['FOUND_TYPE'] ?: $GLOBALS['_FOUND_TYPE'];
$GLOBALS['_JUDG_CD'] = $GLOBALS['_ALL_BASE']['CODE']['JUDG_CD'] ?: $GLOBALS['_JUDG_CD'];
$GLOBALS['_LOAD_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['LOAD_TYPE'] ?: $GLOBALS['_LOAD_TYPE'];
$GLOBALS['_REQ_INSP_ITEM'] = $GLOBALS['_ALL_BASE']['CODE']['REQ_INSP_ITEM'] ?: $GLOBALS['_REQ_INSP_ITEM'];
$GLOBALS['_SAMP_CUSTOM'] = $GLOBALS['_ALL_BASE']['CODE']['SAMP_CUSTOM'] ?: $GLOBALS['_SAMP_CUSTOM'];
$GLOBALS['_TLColor'] = $GLOBALS['_ALL_BASE']['CODEEXP']['TLColor'] ?: $GLOBALS['_TLColor'];
$GLOBALS['_IO_TYPE_FIN'] = $GLOBALS['_ALL_BASE']['CODE']['IO_TYPE_FIN'] ?: $GLOBALS['_IO_TYPE_FIN'];
$GLOBALS['_NCR_CD'] = $GLOBALS['_ALL_BASE']['CODE']['NCR_CD'] ?: $GLOBALS['_NCR_CD'];
$GLOBALS['_TASK_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['TASK_TYPE'] ?: $GLOBALS['_TASK_TYPE'];
$GLOBALS['_STOP_CD'] = $GLOBALS['_ALL_BASE']['CODE']['STOP_CD'] ?: $GLOBALS['_STOP_CD'];
$GLOBALS['_DEF_CD'] = $GLOBALS['_ALL_BASE']['CODE']['DEF_CD'] ?: $GLOBALS['_DEF_CD'];
$GLOBALS['_RSLT_GRP'] = $GLOBALS['_ALL_BASE']['CODE']['RSLT_GRP'] ?: $GLOBALS['_RSLT_GRP'];
$GLOBALS['_ORD_TYPE'] = $GLOBALS['_ALL_BASE']['CODE']['ORD_TYPE'] ?: $GLOBALS['_ORD_TYPE'];
$GLOBALS['_WO_STATUS'] = $GLOBALS['_ALL_BASE']['CODE']['WO_STATUS'] ?: $GLOBALS['_WO_STATUS'];
$GLOBALS['_INSP_TOOL'] = $GLOBALS['_ALL_BASE']['CODE']['INSP_TOOL'] ?: $GLOBALS['_INSP_TOOL'];
$GLOBALS['_INSP_METH'] = $GLOBALS['_ALL_BASE']['CODE']['INSP_METH'] ?: $GLOBALS['_INSP_METH'];
//$GLOBALS['_WRK_TEAM'] = $GLOBALS['_ALL_BASE']['CODE']['WRK_TEAM'] ?: $GLOBALS['_WRK_TEAM'];
$GLOBALS['_FACLT_GRP'] = $GLOBALS['_ALL_BASE']['CODE']['FACLT_GRP'] ?: $GLOBALS['_FACLT_GRP'];
$GLOBALS['_OP_STATUS'] = $GLOBALS['_ALL_BASE']['CODE']['OP_STATUS'] ?: $GLOBALS['_OP_STATUS'];
// sort($GLOBALS['_varsNations']);
// ksort($GLOBALS['_varsCurrency']);
//ksort($GLOBALS['_varsCurrencyExp']);
//$GLOBALS['_OP_STATUS'] = Array(
// "PRE" => Array(NULL,"","S"), //S확정
// "PLAN" => Array("P","I"), //P계획, I지시
// "WORK" => Array("W","F",), //W작업, F완료
//);
$cmv_obj = new Common_vars(); //공통변수 클래스

View File

@ -0,0 +1,344 @@
<?php
class Common_vars extends BaseCode {
function __construct(){
parent::__construct();
}
function getBizAreaList(){ //사업장 리스트
$sql = "USP_B_BIZ_AREA_S10";
$params = Array(
"",
"USE_FLG" => "Y",
);
$rst = $this->DB->exec($sql, $params);
$bzarea_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
$bzarea_rows[$row['BIZ_AREA_CD']] = $row['BIZ_AREA_NM'];
}
}
return $bzarea_rows?:array();
}
function getItemList(){ // 품목 리스트
$sql = "USP_B_ITEM_S10";
$rst = $this->DB->exec($sql);
$bzarea_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
$bzarea_rows[$row['ITEM_CD']] = $row['ITEM_NM'];
}
}
return $bzarea_rows?:array();
}
function getOperationList(){ //공정리스트 (tree)
$sql = "USP_B_OPERATION_S10";
$params = Array(
"USE_FLG" => "Y",
);
$rst = $this->DB->exec($sql, $params);
$oper_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
$key = array_search($row['OP_GRP'], array_column($oper_rows, "OP_GRP"));
if( $key === false ){
$oper_rows[] = Array(
"OP_GRP" => $row['OP_GRP'],
"OP_GRP_NM" => $row['OP_GRP_NM'],
"OPTIONS" => Array($row),
);
}else{
$oper_rows[$key]['OPTIONS'][] = $row;
}
}
}
return $oper_rows?:array();
}
function getOperList(){ //공정리스트
$sql = "USP_B_OPERATION_S10";
$params = Array(
"USE_FLG" => "Y",
);
$rst = $this->DB->exec($sql, $params);
$oper_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
$oper_rows[$row['OP_CD']] = $row;
}
}
return $oper_rows?:array();
}
function getFacilityList(){ //설비리스트
$sql = "USP_B_FACILITY_S10";
$params = Array(
"USE_FLG" => "Y",
);
$rst = $this->DB->exec($sql, $params);
$fac_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
$fac_rows[] = $row;
}
}
return $fac_rows?:array();
}
function getFacilityList2(){ //설비리스트
$sql = "USP_B_FACILITY_S10";
$params = Array(
"USE_FLG" => "Y",
);
$rst = $this->DB->exec($sql, $params);
$fac_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
$fac_rows[$row['FACLT_CD']] = $row['FACLT_NM'];
}
}
return $fac_rows?:array();
}
function getEmployeeList($DEPT_CD="", $JOB_POS=""){ //설비리스트
$sql = "USP_B_EMPLOYEE_S30";
$params = Array(
"",
"",
"RET_FLG" => "N",
);
$rst = $this->DB->exec($sql, $params);
$emp_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
if(
(!$DEPT_CD || $DEPT_CD == $row['DEPT_CD']) &&
(!$JOB_POS || $JOB_POS == $row['JOB_POS'])
){
$emp_rows[] = $row;
}
}
}
return $emp_rows?:array();
}
function getLocList(){ //로케이션리스트 (tree)
$sql = "USP_B_LOC_S10";
$params = Array(
"WH_CD" => "",
"USE_FLG" => "Y",
);
$rst = $this->DB->exec($sql, $params);
$lc_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
$key = array_search($row['WH_CD'], array_column($lc_rows, "WH_CD"));
if( $key === false ){
$lc_rows[] = Array(
"WH_CD" => $row['WH_CD'],
"WH_NM" => $row['WH_NM'],
"OPTIONS" => Array($row),
);
}else{
$lc_rows[$key]['OPTIONS'][] = $row;
}
}
}
return $lc_rows?:array();
}
function getWkStTime(){
$sql = "select DBO.UFN_GET_BASECODE('WDAY_BTIME','WDAY_BTIME','DAY_ST') as WkStTime";
$WkStTime = $this->DB->queryFirstField($sql);
return $WkStTime;
}
function getScheduleList($bizarea, $from="", $to=""){ //근무캘린더
if( !$from ){
$from = date("Y-m-01");
}
if( !$to ){
$to = date("Y-m-t");
}
$sql = "USP_B_CALENDAR_S20";
$params = Array(
"BIZ_AREA_CD" => $bizarea,
"SDATE" => $from,
"FDATE" => $to,
);
$rst = $this->DB->exec($sql, $params);
$cal_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
$cal_rows[] = Array(
"DT" => getDT_date($row['DT']),
"DAY_TYPE" => $row['DAY_TYPE'],
"DAY_SHAPE" => $row['DAY_SHAPE'],
"DAY_NM" => $row['DAY_NM'],
"WEEK_DAY" => $row['WEEK_DAY'],
);
}
}
return $cal_rows?:array();
}
function getWprktimeList($bizarea){ //조업시간
$sql = "USP_B_WORKTIME_S10";
$params = Array(
"BIZ_AREA_CD" => $bizarea,
"USE_FLG" => "Y",
);
$rst = $this->DB->exec($sql, $params);
$wtime_rows = array();
if( $rst ){
$retval['code'] = true;
while( $row = $this->DB->fetch_array($rst) ){
$wtime_rows[] = $row;
}
}
// $min_wt = min( array_column( $wtime_rows, 'ST_TM' ) );
// $max_wt = max( array_column( $wtime_rows, 'ED_TM' ) );
// if( 0 && $min_wt && $min_wt > '00:00' ){
// $wtime_rows[] = Array(
// "ST_TM" => "00:00",
// "ED_TM" => $min_wt,
// //"WORK_TM_NM" => "OFF-HOURS",
// "WORK_TM_NM" => "OFF",
// "TM_TYPE" => "OFF",
// "RUNSTOP_FLG" => "N",
// "USE_FLG" => "Y",
// );
// }
// if( 0 && $max_wt && $max_wt < "24:00" ){
// $wtime_rows[] = Array(
// "ST_TM" => $max_wt,
// "ED_TM" => "24:00",
// //"WORK_TM_NM" => "OFF-HOURS",
// "WORK_TM_NM" => "OFF",
// "TM_TYPE" => "OFF",
// "RUNSTOP_FLG" => "N",
// "USE_FLG" => "Y",
// );
// }
return $wtime_rows?:array();
}
function getProcConds( $shape_type="" ){
$procRow = Array(
"SHARE" => Array(),
"TURN" => Array(),
"HOLE" => Array(),
"RATE" => Array(),
"WTAMT" => Array(),
);
$params = Array();
if( $shape_type ){
$params['SHAPE_TYPE'] = $shape_type;
}
$sql = "USP_B_PROC_SPARE_S10";
$rst = $this->DB->exec($sql, $params);
if( $rst ){
while( $row = $this->DB->fetch_array($rst) ){
if( !isset($procRow['SHARE'][$row['SHAPE_TYPE']]) ) $procRow['SHARE'][$row['SHAPE_TYPE']] = Array();
$procRow['SHARE'][$row['SHAPE_TYPE']][] = $row;
}
}
$sql = "USP_B_PROC_TURN_S10";
$rst = $this->DB->exec($sql, $params);
if( $rst ){
while( $row = $this->DB->fetch_array($rst) ){
if( !isset($procRow['TURN'][$row['SHAPE_TYPE']]) ) $procRow['TURN'][$row['SHAPE_TYPE']] = Array();
$procRow['TURN'][$row['SHAPE_TYPE']][] = $row;
}
}
$sql = "USP_B_PROC_HOLE_S10";
$rst = $this->DB->exec($sql, $params);
if( $rst ){
while( $row = $this->DB->fetch_array($rst) ){
if( !isset($procRow['HOLE'][$row['SHAPE_TYPE']]) ) $procRow['HOLE'][$row['SHAPE_TYPE']] = Array();
$procRow['HOLE'][$row['SHAPE_TYPE']][] = $row;
}
}
$sql = "USP_B_PROC_RATE_S10";
$rst = $this->DB->exec($sql, $params);
if( $rst ){
while( $row = $this->DB->fetch_array($rst) ){
if( !isset($procRow['RATE'][$row['SHAPE_TYPE']]) ) $procRow['RATE'][$row['SHAPE_TYPE']] = Array();
$procRow['RATE'][$row['SHAPE_TYPE']][] = $row;
}
}
$sql = "USP_B_PROC_WTAMT_S10";
$rst = $this->DB->exec($sql, $params);
if( $rst ){
while( $row = $this->DB->fetch_array($rst) ){
if( !isset($procRow['WTAMT'][$row['SHAPE_TYPE']]) ) $procRow['WTAMT'][$row['SHAPE_TYPE']] = Array();
$procRow['WTAMT'][$row['SHAPE_TYPE']][] = $row;
}
}
return $procRow;
}
static function dateRformat( $number, $conf=Array() ){
$number = (int)$number;
$dan = $conf['dan']?:'s';
$days = 0;
$hours = 0;
$minutes = 0;
$seconds = 0;
$rem = 0;
$retstr = '';
switch( $dan ){
case "m": //분단위
$number *= 60;
break;
case "h": //시간단위
$number *= 60*60;
break;
}
$days = floor( $number / (3600*24) );
$rem = $number % (3600*24);
$hours = floor($rem / 3600);
$rem = $rem % (3600);
$minutes = floor($rem / 60);
$seconds = $rem % (60);
if( $days ) $retstr .= ($retstr?' ':'') . $days . ($conf['text']['d']?:'일');
if( $hours ) $retstr .= ($retstr?' ':'') . $hours . ($conf['text']['h']?:'시간');
if( $minutes ) $retstr .= ($retstr?' ':'') . $minutes . ($conf['text']['m']?:'분');
if( $seconds ) $retstr .= ($retstr?' ':'') . $seconds . ($conf['text']['s']?:'초');
return $retstr;
}
}

262
lib/usrlib/mlang.class.php Normal file
View File

@ -0,0 +1,262 @@
<?php
namespace cUtil;
use Cmanage;
use DB_where;
Class Mlang extends Cmanage {
public $LANG;
public $TB;
function __construct(){
//parent::__construct(TB_BIZ_MOFACT);
//$this->DB->tableExists(TB_BIZ_MOFACT);
parent::__construct(TB_COMMENT);
$this->TB = TB_COMMENT;
$this->DB->tableExists($this->TB);
$this->DB->tableExists(TB_COMMENT_LANG);
$this->LANG = "KR";
}
function loadWord( $str, $lang="" ){
$tran = $this->getWord( $str, $lang );
if( !$tran ){
$this->putWord( $str );
}else{
return $tran;
}
return $str;
// $sql = "USP_B_MSG_S10";
// $params = Array(
// "TRAN_TEXT" => $str?:"",
// );
//
// $rst = $this->DB->exec($sql, $params);
// if( $this->DB->num_rows($rst) ){
// $txt = $this->DB->fetch_array($rst);
// $tran = json_decode($txt['TRAN']);
// return $tran[$this->LANG];
// }else{
// $sql = "USP_B_MSG_I10";
// $params = Array(
// "TRAN_TEXT" => $str?:"",
// "TRAN_DATA" => Array("KR"=>$str),
// "EN" => "",
// "BD" => "",
// "BD" => "",
// "JP" => "",
// "VN" => "",
// "PH" => "",
// "TH" => "",
// "ID" => "",
// "IN" => "",
// "CN" => "",
// "MN" => "",
// "NP" => "",
// "PK" => "",
// "UZ" => "",
// );
// $rst = $this->DB->exec($sql, $params);
// return $str;
// }
}
function getTran( $str, $isId="" ){
// $sql = "USP_B_MSG_S10";
// $params = Array(
// "TRAN_TEXT" => $str?:"",
// );
//
// $rst = $this->DB->exec($sql, $params);
// if( $this->DB->num_rows($rst) ){
// $txt = $this->DB->fetch_array($rst);
// $tran = json_decode($txt['TRAN_DATA']);
// return $tran;
// }
// return false;
$where = new DB_where("and");
if( $isId ){
$where->add("TRAN_ID = ?", $str);
}else{
$where->add("TRAN_TEXT = ?", $str);
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select * from {$this->TB} where {$whereqry}";
$this->DB->query_record = false; //query log 기록 금지
$txt = $this->DB->queryFirstRow($sql, $whererow);
$this->DB->query_record = true; //query log 기록 재개
if( $txt ){
$tran = (Array)json_decode($txt['TRAN_DATA']);
return $tran;
}
return false;
}
function getWordList($fields, $where=""){
if( !$where ){
$where = new DB_where("and");
}
$orderby="TRAN_TEXT asc";
$limit=array();
$rows = $this->getDataList($fields, $where, $orderby, $limit);
return $rows;
}
public function getWordPage($sqldata, $where=""){
if( !$where ){
$where = new DB_where("and");
}
if( $sqldata['stxt'] ){
$subwhere = $where->sub_where("or");
if( $sqldata['sfld'] ){
$subwhere->add("{$sqldata['sfld']} like ?", "%{$sqldata['stxt']}%");
}else{
$subwhere->add("TRAN_TEXT like ?", "%{$sqldata['stxt']}%");
}
}
$orderby = "TRAN_TEXT desc";
if( $sqldata['ofld'] && $sqldata['oasc'] ){
$orderby = "{$sqldata['ofld']} {$sqldata['oasc']}";
}
$query = array(
"mode" => $sqldata['mode'],
"viewnum" => $sqldata['viewnum'],
"sdate" => $sqldata['sdate']?:"",
"fdate" => $sqldata['fdate']?:"",
"page" => $sqldata['page'],
"sfld" => $sqldata['sfld'],
"stxt" => $sqldata['stxt'],
"ofld" => $sqldata['ofld'],
"oasc" => $sqldata['oasc'],
);
$lists = $this->getDataPage("*", $query, $where ,$orderby);
return $lists;
}
function getWord( $str, $lang ){
$str = $this->getTran($str);
$lang = $lang ?: $this->LANG;
if( $str ){
return $str[$lang];
}
return false;
}
function getWordId( $id, $lang="" ){
$str = $this->getTran($id, 1);
$lang = $lang ?: $this->LANG;
if( $str ){
return $str[$lang];
}
return false;
}
function putWord( $str ){
// $sql = "USP_B_MSG_I10";
// $params = Array(
// "TRAN_TEXT" => $str?:"",
// "TRAN_DATA" => json_encode(Array("KR"=>$str)),
// );
// $rst = $this->DB->exec($sql, $params);
// return $rst;
$sqldata = Array(
"TRAN_TEXT" => $str?:"",
"TRAN_DATA" => json_encode(Array("KR"=>$str)),
"MAKE_TM" => $this->DB->sqleval("getdate()"),
);
$this->DB->insert($this->TB, $sqldata);
}
function setWord( $str, $stran, $isId="" ){
$tran = $this->getTran( $str, $isId );
$tran = array_filter(array_merge($tran, $stran));
// $sql = "USP_B_MSG_U10";
// $params = Array(
// "TRAN_TEXT" => $str?:"",
// "TRAN_DATA" => json_encode($tran),
// );
// $rst = $this->DB->exec($sql, $params);
// return $rst;
$where = new DB_where("and");
if( $isId ){
$where->add("TRAN_ID = ?", $str);
}else{
$where->add("TRAN_TEXT = ?", $str);
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sqldata = Array(
"TRAN_DATA" => json_encode($tran),
"EDIT_TM" => $this->DB->sqleval("getdate()"),
);
return $this->DB->update($this->TB, $sqldata, $whereqry, $whererow);
}
public static function getText( $str, $var=array() ){
$langObj = new Mlang();
$str = $langObj->loadWord( $str );
for( $a=0 ; $a<@count($var) ; $a++ ){
$str = str_replace("{@".($a+1)."}", $var[$a], $str);
}
return $str;
}
function getLang ( $slang="", $use="" ){
$where = new DB_where("and");
$where->add("bc.Bran_Uid = ?", "nation_code");
$where->add("bc.Code_Uid != ?", "nation_code");
$where->add("bc.Code_Uid != ?", "KR");
$where->add("bc.Active = ?", "Y");
if( $use ){
$where->add("cl.USE_FLG = ?", "Y");
}
if( $slang ){
$swhere = $where->sub_where("or");
foreach( (array)$slang as $lang ){
$swhere->add("bc.Code_Uid = ?", $lang);
}
}
$wqry = $where->get_where();
$whereqry = $wqry['qry'];
$whererow = $wqry['val'];
$sql = "select bc.Code_Uid, bc.Code_Val, cl.USE_FLG from ".TB_basecode." as bc left join ".TB_COMMENT_LANG." as cl on bc.Code_Uid = cl.LANG_ID where {$whereqry} order by bc.Code_Val";
$row = $this->DB->query($sql, $whererow);
return $row;
}
function setLang($params){
$sql = "delete from ".TB_COMMENT_LANG;
$this->DB->qry($sql);
$rows = $this->getLang($params);
foreach( $rows as $lang ){
$qryrow = Array(
"LANG_ID" => $lang['Code_Uid'],
"LANG_NM" => $lang['Code_Val'],
"USE_FLG" => "Y",
"MAKE_TM" => $this->DB->sqleval("getdate()"),
"EDIT_TM" => $this->DB->sqleval("getdate()"),
);
$this->DB->insert(TB_COMMENT_LANG, $qryrow);
}
}
}

View File

@ -0,0 +1,29 @@
<?php
class SangsengApi extends BaseCode {
function __construct() {
parent::__construct();
$this->DB->tableExists(TB_API_REC);
}
function pushApi($userid, $gubun = "접속", $datas = 0) {
return true;
$access_url = "https://log.smart-factory.kr/apisvc/sendLogData.json";
$params = array(
"crtfcKey" => '$5$API$7XWCxM/vX7QCI4WT940IExYHkNs7Nx9JtzwU0bOmGt2',
"logDt" => date("Y-m-d H:i:s.000"),
"useSe" => $gubun,
"sysUser" => $userid?:($GLOBALS['_Umem']['member_name']?:"giiest"),
"conectIp" => get_ip(),
"dataUsgqty" => $datas,
);
$ret = curl_request($access_url, $params, "POST");
$rparams = json_decode($ret);
$sum_params = array_merge($params, (Array) $rparams->result);
unset($sum_params['crtfcKey']);
$this->DB->insert(TB_API_REC, $sum_params);
}
}

View File

@ -0,0 +1,103 @@
<?php
class Sk_Attach extends Attach {
function __construct( $table ){
parent::__construct($table);
}
public function putAttach( $upfile, $gubun, $nid, $sid, $exp="" ) {
$target_dir = _UP_PATH_."/{$gubun}";
if( !file_exists($target_dir) ){
mkdir($target_dir);
}
$rst = move_uploaded_file($upfile['tmp_name'], "{$target_dir}/{$nid}_{$sid}.dat");
if( !$rst ) return false;
if( strpos($upfile['type'], "image") !== false ){
$iinfo = getimagesize("{$target_dir}/{$nid}_{$sid}.dat");
$upfile['width'] = $iinfo[0];
$upfile['height'] = $iinfo[1];
}
$sqldata = Array(
"gubun" => $gubun?:"",
"nid" => $nid?:"",
"sid" => $sid?:"",
"file_name" => $upfile['name']?:"",
"file_size" => $upfile['size']?:0,
"file_type" => $upfile['type']?:"",
"file_width" => $upfile['width']?:"",
"file_height" => $upfile['height']?:"",
"file_exp" => $exp,
"reg_date" => $this->DB->sqleval("getdate()"),
);
return $this->putData( $sqldata );
}
public function setAttach( $upfile, $gubun, $nid, $sid, $exp="" ) {
$target_dir = _UP_PATH_."/{$gubun}";
if( !file_exists($target_dir) ){
mkdir($target_dir);
}
$rst = move_uploaded_file($upfile['tmp_name'], "{$target_dir}/{$nid}_{$sid}.dat");
if( !$rst ) return false;
if( strpos($upfile['type'], "image") !== false ){
$iinfo = getimagesize("{$target_dir}/{$nid}_{$sid}.dat");
$upfile['width'] = $iinfo[0];
$upfile['height'] = $iinfo[1];
}
$sqldata = Array(
"gubun" => $gubun?:"",
"nid" => $nid?:"",
"sid" => $sid?:"",
"file_name" => $upfile['name']?:"",
"file_size" => $upfile['size']?:0,
"file_type" => $upfile['type']?:"",
"file_width" => $upfile['width']?:"",
"file_height" => $upfile['height']?:"",
"file_exp" => $exp,
"reg_date" => $this->DB->sqleval("getdate()"),
);
$whererow = Array(
"gubun" => $gubun?:"",
"nid" => $nid?:"",
"sid" => $sid?:"",
);
return $this->setData( $sqldata, $whererow );
}
public function putAttachRemk($filepath){
$filename = '/example.txt';
$content = '이것은 텍스트 파일에 쓰여질 내용입니다.';
$fpath = explode("/", $filepath);
$fpath = $fpath + $filename;
if (file_exists($filename)) {
// 파일 열기 (쓰기 모드)
// $file = fopen($filename, 'w');
print_r($fpath);
if ($file) {
// 파일에 내용 쓰기
// fwrite($file, $content);
// // 파일 닫기
// fclose($file);
echo "텍스트 파일이 성공적으로 생성되었습니다.";
} else {
echo "파일을 열 수 없습니다.";
}
}
}
}

294
lib/vendor/Altorouter.php vendored Normal file
View File

@ -0,0 +1,294 @@
<?php
class AltoRouter {
/**
* @var array Array of all routes (incl. named routes).
*/
protected $routes = array();
/**
* @var array Array of all named routes.
*/
protected $namedRoutes = array();
/**
* @var string Can be used to ignore leading part of the Request URL (if main file lives in subdirectory of host)
*/
protected $basePath = '';
/**
* @var array Array of default match types (regex helpers)
*/
protected $matchTypes = array(
'i' => '[0-9]++',
'a' => '[0-9A-Za-z]++',
'h' => '[0-9A-Fa-f]++',
'*' => '.+?',
'**' => '.++',
'' => '[^/\.]++'
);
/**
* Create router in one call from config.
*
* @param array $routes
* @param string $basePath
* @param array $matchTypes
*/
public function __construct( $routes = array(), $basePath = '', $matchTypes = array() ) {
$this->addRoutes($routes);
$this->setBasePath($basePath);
$this->addMatchTypes($matchTypes);
}
/**
* Retrieves all routes.
* Useful if you want to process or display routes.
* @return array All routes.
*/
public function getRoutes() {
return $this->routes;
}
/**
* Add multiple routes at once from array in the following format:
*
* $routes = array(
* array($method, $route, $target, $name)
* );
*
* @param array $routes
* @return void
* @author Koen Punt
* @throws Exception
*/
public function addRoutes($routes){
if(!is_array($routes) && !$routes instanceof Traversable) {
throw new \Exception('Routes should be an array or an instance of Traversable');
}
foreach($routes as $route) {
call_user_func_array(array($this, 'map'), $route);
}
}
/**
* Set the base path.
* Useful if you are running your application from a subdirectory.
*/
public function setBasePath($basePath) {
$this->basePath = $basePath;
}
/**
* Add named match types. It uses array_merge so keys can be overwritten.
*
* @param array $matchTypes The key is the name and the value is the regex.
*/
public function addMatchTypes($matchTypes) {
$this->matchTypes = array_merge($this->matchTypes, $matchTypes);
}
/**
* Map a route to a target
*
* @param string $method One of 5 HTTP Methods, or a pipe-separated list of multiple HTTP Methods (GET|POST|PATCH|PUT|DELETE)
* @param string $route The route regex, custom regex must start with an @. You can use multiple pre-set regex filters, like [i:id]
* @param mixed $target The target where this route should point to. Can be anything.
* @param string $name Optional name of this route. Supply if you want to reverse route this url in your application.
* @throws Exception
*/
public function map($method, $route, $target, $name = null) {
$this->routes[] = array($method, $route, $target, $name);
if($name) {
if(isset($this->namedRoutes[$name])) {
throw new \Exception("Can not redeclare route '{$name}'");
} else {
$this->namedRoutes[$name] = $route;
}
}
return;
}
/**
* Reversed routing
*
* Generate the URL for a named route. Replace regexes with supplied parameters
*
* @param string $routeName The name of the route.
* @param array @params Associative array of parameters to replace placeholders with.
* @return string The URL of the route with named parameters in place.
* @throws Exception
*/
public function generate($routeName, array $params = array()) {
// Check if named route exists
if(!isset($this->namedRoutes[$routeName])) {
throw new \Exception("Route '{$routeName}' does not exist.");
}
// Replace named parameters
$route = $this->namedRoutes[$routeName];
// prepend base path to route url again
$url = $this->basePath . $route;
if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) {
foreach($matches as $match) {
list($block, $pre, $type, $param, $optional) = $match;
if ($pre) {
$block = substr($block, 1);
}
if(isset($params[$param])) {
$url = str_replace($block, $params[$param], $url);
} elseif ($optional) {
$url = str_replace($pre . $block, '', $url);
}
}
}
return $url;
}
/**
* Match a given Request Url against stored routes
* @param string $requestUrl
* @param string $requestMethod
* @return array|boolean Array with route information on success, false on failure (no match).
*/
public function match($requestUrl = null, $requestMethod = null) {
$params = array();
$match = false;
// set Request Url if it isn't passed as parameter
if($requestUrl === null) {
$requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
}
// strip base path from request url
$requestUrl = substr($requestUrl, strlen($this->basePath));
// Strip query string (?a=b) from Request Url
if (($strpos = strpos($requestUrl, '?')) !== false) {
$requestUrl = substr($requestUrl, 0, $strpos);
}
// set Request Method if it isn't passed as a parameter
if($requestMethod === null) {
$requestMethod = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
}
foreach($this->routes as $handler) {
list($method, $_route, $target, $name) = $handler;
$methods = explode('|', $method);
$method_match = false;
// Check if request method matches. If not, abandon early. (CHEAP)
foreach($methods as $method) {
if (strcasecmp($requestMethod, $method) === 0) {
$method_match = true;
break;
}
}
// Method did not match, continue to next route.
if(!$method_match) continue;
// Check for a wildcard (matches all)
if ($_route === '*') {
$match = true;
} elseif (isset($_route[0]) && $_route[0] === '@') {
$pattern = '`' . substr($_route, 1) . '`u';
$match = preg_match($pattern, $requestUrl, $params);
} else {
$route = null;
$regex = false;
$j = 0;
$n = isset($_route[0]) ? $_route[0] : null;
$i = 0;
// Find the longest non-regex substring and match it against the URI
while (true) {
if (!isset($_route[$i])) {
break;
} elseif (false === $regex) {
$c = $n;
$regex = $c === '[' || $c === '(' || $c === '.';
if (false === $regex && false !== isset($_route[$i+1])) {
$n = $_route[$i + 1];
$regex = $n === '?' || $n === '+' || $n === '*' || $n === '{';
}
if (false === $regex && $c !== '/' && (!isset($requestUrl[$j]) || $c !== $requestUrl[$j])) {
continue 2;
}
$j++;
}
$route .= $_route[$i++];
}
$regex = $this->compileRoute($route);
$match = preg_match($regex, $requestUrl, $params);
}
if(($match == true || $match > 0)) {
if($params) {
foreach($params as $key => $value) {
if(is_numeric($key)) unset($params[$key]);
}
}
return array(
'target' => $target,
'params' => $params,
'name' => $name
);
}
}
return false;
}
/**
* Compile the regex for a given route (EXPENSIVE)
*/
private function compileRoute($route) {
if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) {
$matchTypes = $this->matchTypes;
foreach($matches as $match) {
list($block, $pre, $type, $param, $optional) = $match;
if (isset($matchTypes[$type])) {
$type = $matchTypes[$type];
}
if ($pre === '.') {
$pre = '\.';
}
//Older versions of PCRE require the 'P' in (?P<named>)
$pattern = '(?:'
. ($pre !== '' ? $pre : null)
. '('
. ($param !== '' ? "?P<$param>" : null)
. $type
. '))'
. ($optional !== '' ? '?' : null);
$route = str_replace($block, $pattern, $route);
}
}
return "`^$route$`u";
}
}

502
lib/vendor/PHPMailer/LICENSE vendored Normal file
View File

@ -0,0 +1,502 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -0,0 +1,49 @@
<?php
/**
* PHPMailer SPL autoloader.
* PHP Version 5
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* PHPMailer SPL autoloader.
* @param string $classname The name of the class to load
*/
function PHPMailerAutoload($classname)
{
//Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) {
require $filename;
}
}
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true);
} else {
spl_autoload_register('PHPMailerAutoload');
}
} else {
/**
* Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load
*/
function __autoload($classname)
{
PHPMailerAutoload($classname);
}
}

1
lib/vendor/PHPMailer/VERSION vendored Normal file
View File

@ -0,0 +1 @@
5.2.27

4062
lib/vendor/PHPMailer/class.webmail.php vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,198 @@
<?php
/**
* PHPMailer - PHP email creation and transport class.
* PHP Version 5.4
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace Frody\Util;
/**
* PHPMailerOAuth - PHPMailer subclass adding OAuth support.
* @package PHPMailer
* @author @sherryl4george
* @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
*/
class PHPMailerOAuth extends PHPMailer
{
/**
* The OAuth user's email address
* @var string
*/
public $oauthUserEmail = '';
/**
* The OAuth refresh token
* @var string
*/
public $oauthRefreshToken = '';
/**
* The OAuth client ID
* @var string
*/
public $oauthClientId = '';
/**
* The OAuth client secret
* @var string
*/
public $oauthClientSecret = '';
/**
* An instance of the PHPMailerOAuthGoogle class.
* @var PHPMailerOAuthGoogle
* @access protected
*/
protected $oauth = null;
/**
* Get a PHPMailerOAuthGoogle instance to use.
* @return PHPMailerOAuthGoogle
*/
public function getOAUTHInstance()
{
if (!is_object($this->oauth)) {
$this->oauth = new PHPMailerOAuthGoogle(
$this->oauthUserEmail,
$this->oauthClientSecret,
$this->oauthClientId,
$this->oauthRefreshToken
);
}
return $this->oauth;
}
/**
* Initiate a connection to an SMTP server.
* Overrides the original smtpConnect method to add support for OAuth.
* @param array $options An array of options compatible with stream_context_create()
* @uses SMTP
* @access public
* @return bool
* @throws phpmailerException
*/
public function smtpConnect($options = array())
{
if (is_null($this->smtp)) {
$this->smtp = $this->getSMTPInstance();
}
if (is_null($this->oauth)) {
$this->oauth = $this->getOAUTHInstance();
}
// Already connected?
if ($this->smtp->connected()) {
return true;
}
$this->smtp->setTimeout($this->Timeout);
$this->smtp->setDebugLevel($this->SMTPDebug);
$this->smtp->setDebugOutput($this->Debugoutput);
$this->smtp->setVerp($this->do_verp);
$hosts = explode(';', $this->Host);
$lastexception = null;
foreach ($hosts as $hostentry) {
$hostinfo = array();
if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
// Not a valid host entry
continue;
}
// $hostinfo[2]: optional ssl or tls prefix
// $hostinfo[3]: the hostname
// $hostinfo[4]: optional port number
// The host string prefix can temporarily override the current setting for SMTPSecure
// If it's not specified, the default value is used
$prefix = '';
$secure = $this->SMTPSecure;
$tls = ($this->SMTPSecure == 'tls');
if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
$prefix = 'ssl://';
$tls = false; // Can't have SSL and TLS at the same time
$secure = 'ssl';
} elseif ($hostinfo[2] == 'tls') {
$tls = true;
// tls doesn't use a prefix
$secure = 'tls';
}
//Do we need the OpenSSL extension?
$sslext = defined('OPENSSL_ALGO_SHA1');
if ('tls' === $secure or 'ssl' === $secure) {
//Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
if (!$sslext) {
throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
}
}
$host = $hostinfo[3];
$port = $this->Port;
$tport = (integer)$hostinfo[4];
if ($tport > 0 and $tport < 65536) {
$port = $tport;
}
if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
try {
if ($this->Helo) {
$hello = $this->Helo;
} else {
$hello = $this->serverHostname();
}
$this->smtp->hello($hello);
//Automatically enable TLS encryption if:
// * it's not disabled
// * we have openssl extension
// * we are not already using SSL
// * the server offers STARTTLS
if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) {
$tls = true;
}
if ($tls) {
if (!$this->smtp->startTLS()) {
throw new phpmailerException($this->lang('connect_host'));
}
// We must resend HELO after tls negotiation
$this->smtp->hello($hello);
}
if ($this->SMTPAuth) {
if (!$this->smtp->authenticate(
$this->Username,
$this->Password,
$this->AuthType,
$this->Realm,
$this->Workstation,
$this->oauth
)
) {
throw new phpmailerException($this->lang('authenticate'));
}
}
return true;
} catch (phpmailerException $exc) {
$lastexception = $exc;
$this->edebug($exc->getMessage());
// We must have connected, but then failed TLS or Auth, so close connection nicely
$this->smtp->quit();
}
}
}
// If we get here, all connection attempts have failed, so close connection hard
$this->smtp->close();
// As we've caught all exceptions, just report whatever the last one was
if ($this->exceptions and !is_null($lastexception)) {
throw $lastexception;
}
return false;
}
}

View File

@ -0,0 +1,78 @@
<?php
/**
* PHPMailer - PHP email creation and transport class.
* PHP Version 5.4
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace Frody\Util;
/**
* PHPMailerOAuthGoogle - Wrapper for League OAuth2 Google provider.
* @package PHPMailer
* @author @sherryl4george
* @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
* @link https://github.com/thephpleague/oauth2-client
*/
class PHPMailerOAuthGoogle
{
private $oauthUserEmail = '';
private $oauthRefreshToken = '';
private $oauthClientId = '';
private $oauthClientSecret = '';
/**
* @param string $UserEmail
* @param string $ClientSecret
* @param string $ClientId
* @param string $RefreshToken
*/
public function __construct(
$UserEmail,
$ClientSecret,
$ClientId,
$RefreshToken
) {
$this->oauthClientId = $ClientId;
$this->oauthClientSecret = $ClientSecret;
$this->oauthRefreshToken = $RefreshToken;
$this->oauthUserEmail = $UserEmail;
}
private function getProvider()
{
return new League\OAuth2\Client\Provider\Google(Array(
'clientId' => $this->oauthClientId,
'clientSecret' => $this->oauthClientSecret
));
}
private function getGrant()
{
return new \League\OAuth2\Client\Grant\RefreshToken();
}
private function getToken()
{
$provider = $this->getProvider();
$grant = $this->getGrant();
return $provider->getAccessToken($grant, Array('refresh_token' => $this->oauthRefreshToken));
}
public function getOauth64()
{
$token = $this->getToken();
return base64_encode("user=" . $this->oauthUserEmail . "\001auth=Bearer " . $token . "\001\001");
}
}

View File

@ -0,0 +1,408 @@
<?php
/**
* PHPMailer POP-Before-SMTP Authentication Class.
* PHP Version 5
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace Frody\Util;
/**
* PHPMailer POP-Before-SMTP Authentication Class.
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
* Does not support APOP.
* @package PHPMailer
* @author Richard Davey (original author) <rich@corephp.co.uk>
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
*/
class POP3
{
/**
* The POP3 PHPMailer Version number.
* @var string
* @access public
*/
public $Version = '5.2.27';
/**
* Default POP3 port number.
* @var integer
* @access public
*/
public $POP3_PORT = 110;
/**
* Default timeout in seconds.
* @var integer
* @access public
*/
public $POP3_TIMEOUT = 30;
/**
* POP3 Carriage Return + Line Feed.
* @var string
* @access public
* @deprecated Use the constant instead
*/
public $CRLF = "\r\n";
/**
* Debug display level.
* Options: 0 = no, 1+ = yes
* @var integer
* @access public
*/
public $do_debug = 0;
/**
* POP3 mail server hostname.
* @var string
* @access public
*/
public $host;
/**
* POP3 port number.
* @var integer
* @access public
*/
public $port;
/**
* POP3 Timeout Value in seconds.
* @var integer
* @access public
*/
public $tval;
/**
* POP3 username
* @var string
* @access public
*/
public $username;
/**
* POP3 password.
* @var string
* @access public
*/
public $password;
/**
* Resource handle for the POP3 connection socket.
* @var resource
* @access protected
*/
protected $pop_conn;
/**
* Are we connected?
* @var boolean
* @access protected
*/
protected $connected = false;
/**
* Error container.
* @var array
* @access protected
*/
protected $errors = array();
/**
* Line break constant
*/
const CRLF = "\r\n";
/**
* Simple static wrapper for all-in-one POP before SMTP
* @param $host
* @param integer|boolean $port The port number to connect to
* @param integer|boolean $timeout The timeout value
* @param string $username
* @param string $password
* @param integer $debug_level
* @return boolean
*/
public static function popBeforeSmtp(
$host,
$port = false,
$timeout = false,
$username = '',
$password = '',
$debug_level = 0
) {
$pop = new POP3;
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
}
/**
* Authenticate with a POP3 server.
* A connect, login, disconnect sequence
* appropriate for POP-before SMTP authorisation.
* @access public
* @param string $host The hostname to connect to
* @param integer|boolean $port The port number to connect to
* @param integer|boolean $timeout The timeout value
* @param string $username
* @param string $password
* @param integer $debug_level
* @return boolean
*/
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
{
$this->host = $host;
// If no port value provided, use default
if (false === $port) {
$this->port = $this->POP3_PORT;
} else {
$this->port = (integer)$port;
}
// If no timeout value provided, use default
if (false === $timeout) {
$this->tval = $this->POP3_TIMEOUT;
} else {
$this->tval = (integer)$timeout;
}
$this->do_debug = $debug_level;
$this->username = $username;
$this->password = $password;
// Reset the error log
$this->errors = array();
// connect
$result = $this->connect($this->host, $this->port, $this->tval);
if ($result) {
$login_result = $this->login($this->username, $this->password);
if ($login_result) {
$this->disconnect();
return true;
}
}
// We need to disconnect regardless of whether the login succeeded
$this->disconnect();
return false;
}
/**
* Connect to a POP3 server.
* @access public
* @param string $host
* @param integer|boolean $port
* @param integer $tval
* @return boolean
*/
public function connect($host, $port = false, $tval = 30)
{
// Are we already connected?
if ($this->connected) {
return true;
}
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it cleanly instead
set_error_handler(array($this, 'catchWarning'));
if (false === $port) {
$port = $this->POP3_PORT;
}
// connect to the POP3 server
$this->pop_conn = fsockopen(
$host, // POP3 Host
$port, // Port #
$errno, // Error Number
$errstr, // Error Message
$tval
); // Timeout (seconds)
// Restore the error handler
restore_error_handler();
// Did we connect?
if (false === $this->pop_conn) {
// It would appear not...
$this->setError(array(
'error' => "Failed to connect to server $host on port $port",
'errno' => $errno,
'errstr' => $errstr
));
return false;
}
// Increase the stream time-out
stream_set_timeout($this->pop_conn, $tval, 0);
// Get the POP3 server response
$pop3_response = $this->getResponse();
// Check for the +OK
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
return true;
}
return false;
}
/**
* Log in to the POP3 server.
* Does not support APOP (RFC 2828, 4949).
* @access public
* @param string $username
* @param string $password
* @return boolean
*/
public function login($username = '', $password = '')
{
if (!$this->connected) {
$this->setError('Not connected to POP3 server');
}
if (empty($username)) {
$username = $this->username;
}
if (empty($password)) {
$password = $this->password;
}
// Send the Username
$this->sendString("USER $username" . self::CRLF);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
// Send the Password
$this->sendString("PASS $password" . self::CRLF);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
return true;
}
}
return false;
}
/**
* Disconnect from the POP3 server.
* @access public
*/
public function disconnect()
{
$this->sendString('QUIT');
//The QUIT command may cause the daemon to exit, which will kill our connection
//So ignore errors here
try {
@fclose($this->pop_conn);
} catch (Exception $e) {
//Do nothing
};
}
/**
* Get a response from the POP3 server.
* $size is the maximum number of bytes to retrieve
* @param integer $size
* @return string
* @access protected
*/
protected function getResponse($size = 128)
{
$response = fgets($this->pop_conn, $size);
if ($this->do_debug >= 1) {
echo "Server -> Client: $response";
}
return $response;
}
/**
* Send raw data to the POP3 server.
* @param string $string
* @return integer
* @access protected
*/
protected function sendString($string)
{
if ($this->pop_conn) {
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
echo "Client -> Server: $string";
}
return fwrite($this->pop_conn, $string, strlen($string));
}
return 0;
}
/**
* Checks the POP3 server response.
* Looks for for +OK or -ERR.
* @param string $string
* @return boolean
* @access protected
*/
protected function checkResponse($string)
{
if (substr($string, 0, 3) !== '+OK') {
$this->setError(array(
'error' => "Server reported an error: $string",
'errno' => 0,
'errstr' => ''
));
return false;
} else {
return true;
}
}
/**
* Add an error to the internal error store.
* Also display debug output if it's enabled.
* @param $error
* @access protected
*/
protected function setError($error)
{
$this->errors[] = $error;
if ($this->do_debug >= 1) {
echo '<pre>';
foreach ($this->errors as $error) {
print_r($error);
}
echo '</pre>';
}
}
/**
* Get an array of error messages, if any.
* @return array
*/
public function getErrors()
{
return $this->errors;
}
/**
* POP3 connection error handler.
* @param integer $errno
* @param string $errstr
* @param string $errfile
* @param integer $errline
* @access protected
*/
protected function catchWarning($errno, $errstr, $errfile, $errline)
{
$this->setError(array(
'error' => "Connecting to the POP3 server raised a PHP warning: ",
'errno' => $errno,
'errstr' => $errstr,
'errfile' => $errfile,
'errline' => $errline
));
}
}

1277
lib/vendor/PHPMailer/class.webmailsmtp.php vendored Normal file

File diff suppressed because it is too large Load Diff

61
lib/vendor/PHPMailer/composer.json vendored Normal file
View File

@ -0,0 +1,61 @@
{
"name": "phpmailer/phpmailer",
"type": "library",
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"authors": [
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
},
{
"name": "Brent R. Matzelle"
}
],
"require": {
"ext-ctype": "*",
"php": ">=5.0.0"
},
"require-dev": {
"doctrine/annotations": "1.2.*",
"jms/serializer": "0.16.*",
"phpdocumentor/phpdocumentor": "2.*",
"phpunit/phpunit": "4.8.*",
"symfony/debug": "2.8.*",
"symfony/filesystem": "2.8.*",
"symfony/translation": "2.8.*",
"symfony/yaml": "2.8.*",
"zendframework/zend-cache": "2.5.1",
"zendframework/zend-config": "2.5.1",
"zendframework/zend-eventmanager": "2.5.1",
"zendframework/zend-filter": "2.5.1",
"zendframework/zend-i18n": "2.5.1",
"zendframework/zend-json": "2.5.1",
"zendframework/zend-math": "2.5.1",
"zendframework/zend-serializer": "2.5.*",
"zendframework/zend-servicemanager": "2.5.*",
"zendframework/zend-stdlib": "2.5.1"
},
"suggest": {
"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
},
"autoload": {
"classmap": [
"class.phpmailer.php",
"class.phpmaileroauth.php",
"class.phpmaileroauthgoogle.php",
"class.smtp.php",
"class.pop3.php",
"extras/EasyPeasyICS.php",
"extras/ntlm_sasl_client.php"
]
},
"license": "LGPL-2.1"
}

3593
lib/vendor/PHPMailer/composer.lock generated vendored Normal file

File diff suppressed because it is too large Load Diff

38
lib/vendor/PHPMailer/examples/DKIM.phps vendored Normal file
View File

@ -0,0 +1,38 @@
<?php
/**
* This example shows how to use DKIM message authentication with PHPMailer.
* There's more to using DKIM than just this code - check out this article:
* @link https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
* See also the DKIM code in the PHPMailer unit tests,
* which shows how to make a key pair from PHP.
*/
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer DKIM test';
//This should be the same as the domain of your From address
$mail->DKIM_domain = 'example.com';
//Path to your private key file
$mail->DKIM_private = 'dkim_private.pem';
//Set this to your own selector
$mail->DKIM_selector = 'phpmailer';
//If your private key has a passphrase, set it here
$mail->DKIM_passphrase = '';
//The identity you're signing as - usually your From address
$mail->DKIM_identity = $mail->From;
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@ -0,0 +1,604 @@
<?php
/*
* A web form that both generates and uses PHPMailer code.
* revised, updated and corrected 27/02/2013
* by matt.sturdy@gmail.com
*/
require '../PHPMailerAutoload.php';
$CFG['smtp_debug'] = 2; //0 == off, 1 for client output, 2 for client and server
$CFG['smtp_debugoutput'] = 'html';
$CFG['smtp_server'] = 'localhost';
$CFG['smtp_port'] = '25';
$CFG['smtp_authenticate'] = false;
$CFG['smtp_username'] = 'name@example.com';
$CFG['smtp_password'] = 'yourpassword';
$CFG['smtp_secure'] = 'None';
$from_name = (isset($_POST['From_Name'])) ? $_POST['From_Name'] : '';
$from_email = (isset($_POST['From_Email'])) ? $_POST['From_Email'] : '';
$to_name = (isset($_POST['To_Name'])) ? $_POST['To_Name'] : '';
$to_email = (isset($_POST['To_Email'])) ? $_POST['To_Email'] : '';
$cc_email = (isset($_POST['cc_Email'])) ? $_POST['cc_Email'] : '';
$bcc_email = (isset($_POST['bcc_Email'])) ? $_POST['bcc_Email'] : '';
$subject = (isset($_POST['Subject'])) ? $_POST['Subject'] : '';
$message = (isset($_POST['Message'])) ? $_POST['Message'] : '';
$test_type = (isset($_POST['test_type'])) ? $_POST['test_type'] : 'smtp';
$smtp_debug = (isset($_POST['smtp_debug'])) ? $_POST['smtp_debug'] : $CFG['smtp_debug'];
$smtp_server = (isset($_POST['smtp_server'])) ? $_POST['smtp_server'] : $CFG['smtp_server'];
$smtp_port = (isset($_POST['smtp_port'])) ? $_POST['smtp_port'] : $CFG['smtp_port'];
$smtp_secure = strtolower((isset($_POST['smtp_secure'])) ? $_POST['smtp_secure'] : $CFG['smtp_secure']);
$smtp_authenticate = (isset($_POST['smtp_authenticate'])) ?
$_POST['smtp_authenticate'] : $CFG['smtp_authenticate'];
$authenticate_password = (isset($_POST['authenticate_password'])) ?
$_POST['authenticate_password'] : $CFG['smtp_password'];
$authenticate_username = (isset($_POST['authenticate_username'])) ?
$_POST['authenticate_username'] : $CFG['smtp_username'];
// storing all status output from the script to be shown to the user later
$results_messages = array();
// $example_code represents the "final code" that we're using, and will
// be shown to the user at the end.
$example_code = "\nrequire_once '../PHPMailerAutoload.php';";
$example_code .= "\n\n\$results_messages = array();";
$mail = new PHPMailer(true); //PHPMailer instance with exceptions enabled
$mail->CharSet = 'utf-8';
ini_set('default_charset', 'UTF-8');
$mail->Debugoutput = $CFG['smtp_debugoutput'];
$example_code .= "\n\n\$mail = new PHPMailer(true);";
$example_code .= "\n\$mail->CharSet = 'utf-8';";
$example_code .= "\nini_set('default_charset', 'UTF-8');";
class phpmailerAppException extends phpmailerException
{
}
$example_code .= "\n\nclass phpmailerAppException extends phpmailerException {}";
$example_code .= "\n\ntry {";
// Convert a string to its JavaScript representation.
function JSString($s) {
static $from = array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"');
static $to = array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\\"');
return is_null($s)? 'null': '"' . str_replace($from, $to, "$s") . '"';
}
try {
if (isset($_POST["submit"]) && $_POST['submit'] == "Submit") {
$to = $to_email;
if (!PHPMailer::validateAddress($to)) {
throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!");
}
$example_code .= "\n\$to = '" . addslashes($to_email) . "';";
$example_code .= "\nif(!PHPMailer::validateAddress(\$to)) {";
$example_code .= "\n throw new phpmailerAppException(\"Email address \" . " .
"\$to . \" is invalid -- aborting!\");";
$example_code .= "\n}";
switch ($test_type) {
case 'smtp':
$mail->isSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = (integer)$smtp_debug;
$mail->Host = $smtp_server; // SMTP server
$mail->Port = (integer)$smtp_port; // set the SMTP port
if ($smtp_secure) {
$mail->SMTPSecure = strtolower($smtp_secure);
}
$mail->SMTPAuth = array_key_exists('smtp_authenticate', $_POST); // enable SMTP authentication?
if (array_key_exists('smtp_authenticate', $_POST)) {
$mail->Username = $authenticate_username; // SMTP account username
$mail->Password = $authenticate_password; // SMTP account password
}
$example_code .= "\n\$mail->isSMTP();";
$example_code .= "\n\$mail->SMTPDebug = " . (integer) $smtp_debug . ";";
$example_code .= "\n\$mail->Host = \"" . addslashes($smtp_server) . "\";";
$example_code .= "\n\$mail->Port = \"" . addslashes($smtp_port) . "\";";
$example_code .= "\n\$mail->SMTPSecure = \"" . addslashes(strtolower($smtp_secure)) . "\";";
$example_code .= "\n\$mail->SMTPAuth = " . (array_key_exists(
'smtp_authenticate',
$_POST
) ? 'true' : 'false') . ";";
if (array_key_exists('smtp_authenticate', $_POST)) {
$example_code .= "\n\$mail->Username = \"" . addslashes($authenticate_username) . "\";";
$example_code .= "\n\$mail->Password = \"" . addslashes($authenticate_password) . "\";";
}
break;
case 'mail':
$mail->isMail(); // telling the class to use PHP's mail()
$example_code .= "\n\$mail->isMail();";
break;
case 'sendmail':
$mail->isSendmail(); // telling the class to use Sendmail
$example_code .= "\n\$mail->isSendmail();";
break;
case 'qmail':
$mail->isQmail(); // telling the class to use Qmail
$example_code .= "\n\$mail->isQmail();";
break;
default:
throw new phpmailerAppException('Invalid test_type provided');
}
try {
if ($_POST['From_Name'] != '') {
$mail->addReplyTo($from_email, $from_name);
$mail->setFrom($from_email, $from_name);
$example_code .= "\n\$mail->addReplyTo(\"" .
addslashes($from_email) . "\", \"" . addslashes($from_name) . "\");";
$example_code .= "\n\$mail->setFrom(\"" .
addslashes($from_email) . "\", \"" . addslashes($from_name) . "\");";
} else {
$mail->addReplyTo($from_email);
$mail->setFrom($from_email, $from_email);
$example_code .= "\n\$mail->addReplyTo(\"" . addslashes($from_email) . "\");";
$example_code .= "\n\$mail->setFrom(\"" .
addslashes($from_email) . "\", \"" . addslashes($from_email) . "\");";
}
if ($_POST['To_Name'] != '') {
$mail->addAddress($to, $to_name);
$example_code .= "\n\$mail->addAddress(\"$to\", \"" . addslashes($to_name) . "\");";
} else {
$mail->addAddress($to);
$example_code .= "\n\$mail->addAddress(\"$to\");";
}
if ($_POST['bcc_Email'] != '') {
$indiBCC = explode(" ", $bcc_email);
foreach ($indiBCC as $key => $value) {
$mail->addBCC($value);
$example_code .= "\n\$mail->addBCC(\"" . addslashes($value) . "\");";
}
}
if ($_POST['cc_Email'] != '') {
$indiCC = explode(" ", $cc_Email);
foreach ($indiCC as $key => $value) {
$mail->addCC($value);
$example_code .= "\n\$mail->addCC(\"" . addslashes($value) . "\");";
}
}
} catch (phpmailerException $e) { //Catch all kinds of bad addressing
throw new phpmailerAppException($e->getMessage());
}
$mail->Subject = $subject . ' (PHPMailer test using ' . strtoupper($test_type) . ')';
$example_code .= "\n\$mail->Subject = \"" . addslashes($subject) .
' (PHPMailer test using ' . addslashes(strtoupper($test_type)) . ')";';
if ($_POST['Message'] == '') {
$body = file_get_contents('contents.html');
} else {
$body = $message;
}
$example_code .= "\n\$body = <<<'EOT'\n$body\nEOT;";
$mail->WordWrap = 78; // set word wrap to the RFC2822 limit
$mail->msgHTML($body, dirname(__FILE__), true); //Create message bodies and embed images
$example_code .= "\n\$mail->WordWrap = 78;";
$example_code .= "\n\$mail->msgHTML(\$body, dirname(__FILE__), true); //Create message bodies and embed images";
$mail->addAttachment('images/phpmailer_mini.png', 'phpmailer_mini.png'); // optional name
$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name
$example_code .= "\n\$mail->addAttachment('images/phpmailer_mini.png'," .
"'phpmailer_mini.png'); // optional name";
$example_code .= "\n\$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name";
$example_code .= "\n\ntry {";
$example_code .= "\n \$mail->send();";
$example_code .= "\n \$results_messages[] = \"Message has been sent using " .
addslashes(strtoupper($test_type)) . "\";";
$example_code .= "\n}";
$example_code .= "\ncatch (phpmailerException \$e) {";
$example_code .= "\n throw new phpmailerAppException('Unable to send to: ' . \$to. ': '.\$e->getMessage());";
$example_code .= "\n}";
try {
$mail->send();
$results_messages[] = "Message has been sent using " . strtoupper($test_type);
} catch (phpmailerException $e) {
throw new phpmailerAppException("Unable to send to: " . $to . ': ' . $e->getMessage());
}
}
} catch (phpmailerAppException $e) {
$results_messages[] = $e->errorMessage();
}
$example_code .= "\n}";
$example_code .= "\ncatch (phpmailerAppException \$e) {";
$example_code .= "\n \$results_messages[] = \$e->errorMessage();";
$example_code .= "\n}";
$example_code .= "\n\nif (count(\$results_messages) > 0) {";
$example_code .= "\n echo \"<h2>Run results</h2>\\n\";";
$example_code .= "\n echo \"<ul>\\n\";";
$example_code .= "\nforeach (\$results_messages as \$result) {";
$example_code .= "\n echo \"<li>\$result</li>\\n\";";
$example_code .= "\n}";
$example_code .= "\necho \"</ul>\\n\";";
$example_code .= "\n}";
?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Test Page</title>
<script type="text/javascript" src="scripts/shCore.js"></script>
<script type="text/javascript" src="scripts/shBrushPhp.js"></script>
<link type="text/css" rel="stylesheet" href="styles/shCore.css">
<link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 1em;
padding: 1em;
}
table {
margin: 0 auto;
border-spacing: 0;
border-collapse: collapse;
}
table.column {
border-collapse: collapse;
background-color: #FFFFFF;
padding: 0.5em;
width: 35em;
}
td {
font-size: 1em;
padding: 0.1em 0.25em;
-moz-border-radius: 1em;
-webkit-border-radius: 1em;
border-radius: 1em;
}
td.colleft {
text-align: right;
width: 35%;
}
td.colrite {
text-align: left;
width: 65%;
}
fieldset {
padding: 1em 1em 1em 1em;
margin: 0 2em;
border-radius: 1.5em;
-webkit-border-radius: 1em;
-moz-border-radius: 1em;
}
fieldset.inner {
width: 40%;
}
fieldset:hover, tr:hover {
background-color: #fafafa;
}
legend {
font-weight: bold;
font-size: 1.1em;
}
div.column-left {
float: left;
width: 45em;
height: 31em;
}
div.column-right {
display: inline;
width: 45em;
max-height: 31em;
}
input.radio {
float: left;
}
div.radio {
padding: 0.2em;
}
</style>
<script>
SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
SyntaxHighlighter.all();
function startAgain() {
var post_params = {
"From_Name": <?php echo JSString($from_name); ?>,
"From_Email": <?php echo JSString($from_email); ?>,
"To_Name": <?php echo JSString($to_name); ?>,
"To_Email": <?php echo JSString($to_email); ?>,
"cc_Email": <?php echo JSString($cc_email); ?>,
"bcc_Email": <?php echo JSString($bcc_email); ?>,
"Subject": <?php echo JSString($subject); ?>,
"Message": <?php echo JSString($message); ?>,
"test_type": <?php echo JSString($test_type); ?>,
"smtp_debug": <?php echo JSString($smtp_debug); ?>,
"smtp_server": <?php echo JSString($smtp_server); ?>,
"smtp_port": <?php echo JSString($smtp_port); ?>,
"smtp_secure": <?php echo JSString($smtp_secure); ?>,
"smtp_authenticate": <?php echo JSString($smtp_authenticate); ?>,
"authenticate_username": <?php echo JSString($authenticate_username); ?>,
"authenticate_password": <?php echo JSString($authenticate_password); ?>
};
var resetForm = document.createElement("form");
resetForm.setAttribute("method", "POST");
resetForm.setAttribute("path", "index.php");
for (var k in post_params) {
var h = document.createElement("input");
h.setAttribute("type", "hidden");
h.setAttribute("name", k);
h.setAttribute("value", post_params[k]);
resetForm.appendChild(h);
}
document.body.appendChild(resetForm);
resetForm.submit();
}
function showHideDiv(test, element_id) {
var ops = {"smtp-options-table": "smtp"};
if (test == ops[element_id]) {
document.getElementById(element_id).style.display = "block";
} else {
document.getElementById(element_id).style.display = "none";
}
}
</script>
</head>
<body>
<?php
if (version_compare(PHP_VERSION, '5.0.0', '<')) {
echo 'Current PHP version: ' . phpversion() . "<br>";
echo exit("ERROR: Wrong PHP version. Must be PHP 5 or above.");
}
if (count($results_messages) > 0) {
echo '<h2>Run results</h2>';
echo '<ul>';
foreach ($results_messages as $result) {
echo "<li>$result</li>";
}
echo '</ul>';
}
if (isset($_POST["submit"]) && $_POST["submit"] == "Submit") {
echo "<button type=\"submit\" onclick=\"startAgain();\">Start Over</button><br>\n";
echo "<br><span>Script:</span>\n";
echo "<pre class=\"brush: php;\">\n";
echo htmlentities($example_code);
echo "\n</pre>\n";
echo "\n<hr style=\"margin: 3em;\">\n";
}
?>
<form method="POST" enctype="multipart/form-data">
<div>
<div class="column-left">
<fieldset>
<legend>Mail Details</legend>
<table border="1" class="column">
<tr>
<td class="colleft">
<label for="From_Name"><strong>From</strong> Name</label>
</td>
<td class="colrite">
<input type="text" id="From_Name" name="From_Name" value="<?php echo htmlentities($from_name); ?>"
style="width:95%;" autofocus placeholder="Your Name">
</td>
</tr>
<tr>
<td class="colleft">
<label for="From_Email"><strong>From</strong> Email Address</label>
</td>
<td class="colrite">
<input type="text" id="From_Email" name="From_Email" value="<?php echo htmlentities($from_email); ?>"
style="width:95%;" required placeholder="Your.Email@example.com">
</td>
</tr>
<tr>
<td class="colleft">
<label for="To_Name"><strong>To</strong> Name</label>
</td>
<td class="colrite">
<input type="text" id="To_Name" name="To_Name" value="<?php echo htmlentities($to_name); ?>"
style="width:95%;" placeholder="Recipient's Name">
</td>
</tr>
<tr>
<td class="colleft">
<label for="To_Email"><strong>To</strong> Email Address</label>
</td>
<td class="colrite">
<input type="text" id="To_Email" name="To_Email" value="<?php echo htmlentities($to_email); ?>"
style="width:95%;" required placeholder="Recipients.Email@example.com">
</td>
</tr>
<tr>
<td class="colleft">
<label for="cc_Email"><strong>CC Recipients</strong><br>
<small>(separate with commas)</small>
</label>
</td>
<td class="colrite">
<input type="text" id="cc_Email" name="cc_Email" value="<?php echo htmlentities($cc_email); ?>"
style="width:95%;" placeholder="cc1@example.com, cc2@example.com">
</td>
</tr>
<tr>
<td class="colleft">
<label for="bcc_Email"><strong>BCC Recipients</strong><br>
<small>(separate with commas)</small>
</label>
</td>
<td class="colrite">
<input type="text" id="bcc_Email" name="bcc_Email" value="<?php echo htmlentities($bcc_email); ?>"
style="width:95%;" placeholder="bcc1@example.com, bcc2@example.com">
</td>
</tr>
<tr>
<td class="colleft">
<label for="Subject"><strong>Subject</strong></label>
</td>
<td class="colrite">
<input type="text" name="Subject" id="Subject" value="<?php echo htmlentities($subject); ?>"
style="width:95%;" placeholder="Email Subject">
</td>
</tr>
<tr>
<td class="colleft">
<label for="Message"><strong>Message</strong><br>
<small>If blank, will use content.html</small>
</label>
</td>
<td class="colrite">
<textarea name="Message" id="Message" style="width:95%;height:5em;"
placeholder="Body of your email"><?php echo htmlentities($message); ?></textarea>
</td>
</tr>
</table>
<div style="margin:1em 0;">Test will include two attachments.</div>
</fieldset>
</div>
<div class="column-right">
<fieldset class="inner"> <!-- SELECT TYPE OF MAIL -->
<legend>Mail Test Specs</legend>
<table border="1" class="column">
<tr>
<td class="colleft">Test Type</td>
<td class="colrite">
<div class="radio">
<label for="radio-mail">Mail()</label>
<input class="radio" type="radio" name="test_type" value="mail" id="radio-mail"
onclick="showHideDiv(this.value, 'smtp-options-table');"
<?php echo ($test_type == 'mail') ? 'checked' : ''; ?>
required>
</div>
<div class="radio">
<label for="radio-sendmail">Sendmail</label>
<input class="radio" type="radio" name="test_type" value="sendmail" id="radio-sendmail"
onclick="showHideDiv(this.value, 'smtp-options-table');"
<?php echo ($test_type == 'sendmail') ? 'checked' : ''; ?>
required>
</div>
<div class="radio">
<label for="radio-qmail">Qmail</label>
<input class="radio" type="radio" name="test_type" value="qmail" id="radio-qmail"
onclick="showHideDiv(this.value, 'smtp-options-table');"
<?php echo ($test_type == 'qmail') ? 'checked' : ''; ?>
required>
</div>
<div class="radio">
<label for="radio-smtp">SMTP</label>
<input class="radio" type="radio" name="test_type" value="smtp" id="radio-smtp"
onclick="showHideDiv(this.value, 'smtp-options-table');"
<?php echo ($test_type == 'smtp') ? 'checked' : ''; ?>
required>
</div>
</td>
</tr>
</table>
<div id="smtp-options-table" style="margin:1em 0 0 0;
<?php if ($test_type != 'smtp') {
echo "display: none;";
} ?>">
<span style="margin:1.25em 0; display:block;"><strong>SMTP Specific Options:</strong></span>
<table border="1" class="column">
<tr>
<td class="colleft"><label for="smtp_debug">SMTP Debug ?</label></td>
<td class="colrite">
<select size="1" id="smtp_debug" name="smtp_debug">
<option <?php echo ($smtp_debug == '0') ? 'selected' : ''; ?> value="0">
0 - Disabled
</option>
<option <?php echo ($smtp_debug == '1') ? 'selected' : ''; ?> value="1">
1 - Client messages
</option>
<option <?php echo ($smtp_debug == '2') ? 'selected' : ''; ?> value="2">
2 - Client and server messages
</option>
</select>
</td>
</tr>
<tr>
<td class="colleft"><label for="smtp_server">SMTP Server</label></td>
<td class="colrite">
<input type="text" id="smtp_server" name="smtp_server"
value="<?php echo htmlentities($smtp_server); ?>" style="width:95%;"
placeholder="smtp.server.com">
</td>
</tr>
<tr>
<td class="colleft" style="width: 5em;"><label for="smtp_port">SMTP Port</label></td>
<td class="colrite">
<input type="text" name="smtp_port" id="smtp_port" size="3"
value="<?php echo htmlentities($smtp_port); ?>" placeholder="Port">
</td>
</tr>
<tr>
<td class="colleft"><label for="smtp_secure">SMTP Security</label></td>
<td>
<select size="1" name="smtp_secure" id="smtp_secure">
<option <?php echo ($smtp_secure == 'none') ? 'selected' : '' ?>>None</option>
<option <?php echo ($smtp_secure == 'tls') ? 'selected' : '' ?>>TLS</option>
<option <?php echo ($smtp_secure == 'ssl') ? 'selected' : '' ?>>SSL</option>
</select>
</td>
</tr>
<tr>
<td class="colleft"><label for="smtp-authenticate">SMTP Authenticate?</label></td>
<td class="colrite">
<input type="checkbox" id="smtp-authenticate"
name="smtp_authenticate"
<?php if ($smtp_authenticate != '') {
echo "checked";
} ?>
value="true">
</td>
</tr>
<tr>
<td class="colleft"><label for="authenticate_username">Authenticate Username</label></td>
<td class="colrite">
<input type="text" id="authenticate_username" name="authenticate_username"
value="<?php echo htmlentities($authenticate_username); ?>" style="width:95%;"
placeholder="SMTP Server Username">
</td>
</tr>
<tr>
<td class="colleft"><label for="authenticate_password">Authenticate Password</label></td>
<td class="colrite">
<input type="password" name="authenticate_password" id="authenticate_password"
value="<?php echo htmlentities($authenticate_password); ?>" style="width:95%;"
placeholder="SMTP Server Password">
</td>
</tr>
</table>
</div>
</fieldset>
</div>
<br style="clear:both;">
<div style="margin-left:2em; margin-bottom:5em; float:left;">
<div style="margin-bottom: 1em; ">
<input type="submit" value="Submit" name="submit">
</div>
<?php echo 'Current PHP version: ' . phpversion(); ?>
</div>
</div>
</form>
</body>
</html>

View File

@ -0,0 +1,71 @@
<?php
/**
* This example shows how to handle a simple contact form.
*/
$msg = '';
//Don't run this unless we're handling a form submission
if (array_key_exists('email', $_POST)) {
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP - requires a local mail server
//Faster and safer than using mail()
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->Port = 25;
//Use a fixed address in your own domain as the from address
//**DO NOT** use the submitter's address here as it will be forgery
//and will cause your messages to fail SPF checks
$mail->setFrom('from@example.com', 'First Last');
//Send the message to yourself, or whoever should receive contact for submissions
$mail->addAddress('whoto@example.com', 'John Doe');
//Put the submitter's address in a reply-to header
//This will fail if the address provided is invalid,
//in which case we should ignore the whole request
if ($mail->addReplyTo($_POST['email'], $_POST['name'])) {
$mail->Subject = 'PHPMailer contact form';
//Keep it simple - don't use HTML
$mail->isHTML(false);
//Build a simple message body
$mail->Body = <<<EOT
Email: {$_POST['email']}
Name: {$_POST['name']}
Message: {$_POST['message']}
EOT;
//Send the message, check for errors
if (!$mail->send()) {
//The reason for failing to send will be in $mail->ErrorInfo
//but you shouldn't display errors to users - process the error, log it on your server.
$msg = 'Sorry, something went wrong. Please try again later.';
} else {
$msg = 'Message sent! Thanks for contacting us.';
}
} else {
$msg = 'Invalid email address, message ignored.';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contact form</title>
</head>
<body>
<h1>Contact us</h1>
<?php if (!empty($msg)) {
echo "<h2>$msg</h2>";
} ?>
<form method="POST">
<label for="name">Name: <input type="text" name="name" id="name"></label><br>
<label for="email">Email address: <input type="email" name="email" id="email"></label><br>
<label for="message">Message: <textarea name="message" id="message" rows="8" cols="20"></textarea></label><br>
<input type="submit" value="Send">
</form>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PHPMailer Test</title>
</head>
<body>
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<h1>This is a test of PHPMailer.</h1>
<div align="center">
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
</div>
<p>This example uses <strong>HTML</strong>.</p>
<p>ISO-8859-1 text: éèîüçÅñæß</p>
</div>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Test</title>
</head>
<body>
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<h1>This is a test of PHPMailer.</h1>
<div align="center">
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
</div>
<p>This example uses <strong>HTML</strong>.</p>
<p>Chinese text: 郵件內容為空</p>
<p>Russian text: Пустое тело сообщения</p>
<p>Armenian text: Հաղորդագրությունը դատարկ է</p>
<p>Czech text: Prázdné tělo zprávy</p>
<p>Emoji: <span style="font-size: 48px">😂 🦄 💥 📤 📧</span></p>
</div>
</body>
</html>

View File

@ -0,0 +1,35 @@
<?php
/**
* This example shows how to make use of PHPMailer's exceptions for error handling.
*/
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
//Passing true to the constructor enables the use of exceptions for error handling
$mail = new PHPMailer(true);
try {
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer Exceptions test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//and convert the HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message
//Note that we don't need check the response from this because it will throw an exception if it has trouble
$mail->send();
echo "Message sent!";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}

View File

@ -0,0 +1,99 @@
<?php
/**
* This example shows settings to use when sending via Google's Gmail servers.
* The IMAP section shows how to save this message to the 'Sent Mail' folder using IMAP commands.
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
// use
// $mail->Host = gethostbyname('smtp.gmail.com');
// if your network does not support SMTP over IPv6
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "username@gmail.com";
//Password to use for SMTP authentication
$mail->Password = "yourpassword";
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
//Section 2: IMAP
//Uncomment these to save your message in the 'Sent Mail' folder.
#if (save_mail($mail)) {
# echo "Message saved!";
#}
}
//Section 2: IMAP
//IMAP commands requires the PHP IMAP Extension, found at: https://php.net/manual/en/imap.setup.php
//Function to call which uses the PHP imap_*() functions to save messages: https://php.net/manual/en/book.imap.php
//You can use imap_getmailboxes($imapStream, '/imap/ssl') to get a list of available folders or labels, this can
//be useful if you are trying to get this working on a non-Gmail IMAP server.
function save_mail($mail) {
//You can change 'Sent Mail' to any other folder or tag
$path = "{imap.gmail.com:993/imap/ssl}[Gmail]/Sent Mail";
//Tell your server to open an IMAP connection using the same username and password as you used for SMTP
$imapStream = imap_open($path, $mail->Username, $mail->Password);
$result = imap_append($imapStream, $path, $mail->getSentMIMEMessage());
imap_close($imapStream);
return $result;
}

View File

@ -0,0 +1,85 @@
<?php
/**
* This example shows settings to use when sending via Google's Gmail servers.
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
//Load dependencies from composer
//If this causes an error, run 'composer install'
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailerOAuth;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Set AuthType
$mail->AuthType = 'XOAUTH2';
//User Email to use for SMTP authentication - user who gave consent to our app
$mail->oauthUserEmail = "from@gmail.com";
//Obtained From Google Developer Console
$mail->oauthClientId = "RANDOMCHARS-----duv1n2.apps.googleusercontent.com";
//Obtained From Google Developer Console
$mail->oauthClientSecret = "RANDOMCHARS-----lGyjPcRtvP";
//Obtained By running get_oauth_token.php after setting up APP in Google Developer Console.
//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
// eg: http://localhost/phpmail/get_oauth_token.php
$mail->oauthRefreshToken = "RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0";
//Set who the message is to be sent from
//For gmail, this generally needs to be the same as the user you logged in as
$mail->setFrom('from@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PHPMailer Examples</title>
</head>
<body>
<h1>PHPMailer code examples<a href="https://github.com/PHPMailer/PHPMailer"><img src="images/phpmailer.png" style="float:right; border:0;" alt="PHPMailer logo"></a></h1>
<p>This folder contains a collection of examples of using <a href="https://github.com/PHPMailer/PHPMailer">PHPMailer</a>.</p>
<h2>About testing email sending</h2>
<p>When working on email sending code you'll find yourself worrying about what might happen if all these test emails got sent to your mailing list. The solution is to use a fake mail server, one that acts just like the real thing, but just doesn't actually send anything out. Some offer web interfaces, feedback, logging, the ability to return specific error codes, all things that are useful for testing error handling, authentication etc. Here's a selection of mail testing tools you might like to try:</p>
<ul>
<li><a href="https://github.com/Nilhcem/FakeSMTP">FakeSMTP</a>, a Java desktop app with the ability to show an SMTP log and save messages to a folder. </li>
<li><a href="https://github.com/isotoma/FakeEmail">FakeEmail</a>, a Python-based fake mail server with a web interface.</li>
<li><a href="http://www.postfix.org/smtp-sink.1.html">smtp-sink</a>, part of the Postfix mail server, so you probably already have this installed. This is used in the Travis-CI configuration to run PHPMailer's unit tests.</li>
<li><a href="http://smtp4dev.codeplex.com">smtp4dev</a>, a dummy SMTP server for Windows.</li>
<li><a href="https://github.com/PHPMailer/PHPMailer/blob/master/test/fakesendmail.sh">fakesendmail.sh</a>, part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.</li>
<li><a href="http://tools.ietf.org/tools/msglint/">msglint</a>, not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.</li>
</ul>
<div style="padding: 8px; color: #333333; background-color: #dc8b92">
<h2>Security note</h2>
<p>Before running these examples you'll need to rename them with '.php' extensions. They are supplied as '.phps' files which will usually be displayed with syntax highlighting by PHP instead of running them. This prevents potential security issues with running potential spam-gateway code if you happen to deploy these code examples on a live site - <em>please don't do that!</em> Similarly, don't leave your passwords in these files as they will be visible to the world!</p>
</div>
<h2><a href="code_generator.phps">code_generator.phps</a></h2>
<p>This script is a simple code generator - fill in the form and hit submit, and it will use when you entered to email you a message, and will also generate PHP code using your settings that you can copy and paste to use in your own apps. If you need to get going quickly, this is probably the best place to start.</p>
<h2><a href="mail.phps">mail.phps</a></h2>
<p>This script is a basic example which creates an email message from an external HTML file, creates a plain text body, sets various addresses, adds an attachment and sends the message. It uses PHP's built-in mail() function which is the simplest to use, but relies on the presence of a local mail server, something which is not usually available on Windows. If you find yourself in that situation, either install a local mail server, or use a remote one and send using SMTP instead.</p>
<h2><a href="exceptions.phps">exceptions.phps</a></h2>
<p>The same as the mail example, but shows how to use PHPMailer's optional exceptions for error handling.</p>
<h2><a href="smtp.phps">smtp.phps</a></h2>
<p>A simple example sending using SMTP with authentication.</p>
<h2><a href="smtp_no_auth.phps">smtp_no_auth.phps</a></h2>
<p>A simple example sending using SMTP without authentication.</p>
<h2><a href="sendmail.phps">sendmail.phps</a></h2>
<p>A simple example using sendmail. Sendmail is a program (usually found on Linux/BSD, OS X and other UNIX-alikes) that can be used to submit messages to a local mail server without a lengthy SMTP conversation. It's probably the fastest sending mechanism, but lacks some error reporting features. There are sendmail emulators for most popular mail servers including postfix, qmail, exim etc.</p>
<h2><a href="gmail.phps">gmail.phps</a></h2>
<p>Submitting email via Google's Gmail service is a popular use of PHPMailer. It's much the same as normal SMTP sending, just with some specific settings, namely using TLS encryption, authentication is enabled, and it connects to the SMTP submission port 587 on the smtp.gmail.com host. This example does all that.</p>
<h2><a href="pop_before_smtp.phps">pop_before_smtp.phps</a></h2>
<p>Before effective SMTP authentication mechanisms were available, it was common for ISPs to use POP-before-SMTP authentication. As it implies, you authenticate using the POP3 protocol (an older protocol now mostly replaced by the far superior IMAP), and then the SMTP server will allow send access from your IP address for a short while, usually 5-15 minutes. PHPMailer includes a POP3 protocol client, so it can carry out this sequence - it's just like a normal SMTP conversation (without authentication), but connects via POP first.</p>
<h2><a href="mailing_list.phps">mailing_list.phps</a></h2>
<p>This is a somewhat naïve example of sending similar emails to a list of different addresses. It sets up a PHPMailer instance using SMTP, then connects to a MySQL database to retrieve a list of recipients. The code loops over this list, sending email to each person using their info and marks them as sent in the database. It makes use of SMTP keepalive which saves reconnecting and re-authenticating between each message.</p>
<hr>
<h2><a href="smtp_check.phps">smtp_check.phps</a></h2>
<p>This is an example showing how to use the SMTP class by itself (without PHPMailer) to check an SMTP connection.</p>
<hr>
<p>Most of these examples use the 'example.com' domain. This domain is reserved by IANA for illustrative purposes, as documented in <a href="http://tools.ietf.org/html/rfc2606">RFC 2606</a>. Don't use made-up domains like 'mydomain.com' or 'somedomain.com' in examples as someone, somewhere, probably owns them!</p>
</body>
</html>

31
lib/vendor/PHPMailer/examples/mail.phps vendored Normal file
View File

@ -0,0 +1,31 @@
<?php
/**
* This example shows sending a message using PHP's mail() function.
*/
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@ -0,0 +1,59 @@
<?php
error_reporting(E_STRICT | E_ALL);
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
$mail = new PHPMailer;
$body = file_get_contents('contents.html');
$mail->isSMTP();
$mail->Host = 'smtp.example.com';
$mail->SMTPAuth = true;
$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead
$mail->Port = 25;
$mail->Username = 'yourname@example.com';
$mail->Password = 'yourpassword';
$mail->setFrom('list@example.com', 'List manager');
$mail->addReplyTo('list@example.com', 'List manager');
$mail->Subject = "PHPMailer Simple database mailing list test";
//Same body for all messages, so set this before the sending loop
//If you generate a different body for each recipient (e.g. you're using a templating system),
//set it inside the loop
$mail->msgHTML($body);
//msgHTML also sets AltBody, but if you want a custom one, set it afterwards
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
//Connect to the database and select the recipients from your mailing list that have not yet been sent to
//You'll need to alter this to match your database
$mysql = mysqli_connect('localhost', 'username', 'password');
mysqli_select_db($mysql, 'mydb');
$result = mysqli_query($mysql, 'SELECT full_name, email, photo FROM mailinglist WHERE sent = false');
foreach ($result as $row) { //This iterator syntax only works in PHP 5.4+
$mail->addAddress($row['email'], $row['full_name']);
if (!empty($row['photo'])) {
$mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); //Assumes the image data is stored in the DB
}
if (!$mail->send()) {
echo "Mailer Error (" . str_replace("@", "&#64;", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />';
break; //Abandon sending
} else {
echo "Message sent to :" . $row['full_name'] . ' (' . str_replace("@", "&#64;", $row['email']) . ')<br />';
//Mark it as sent in the DB
mysqli_query(
$mysql,
"UPDATE mailinglist SET sent = true WHERE email = '" .
mysqli_real_escape_string($mysql, $row['email']) . "'"
);
}
// Clear all addresses and attachments for next loop
$mail->clearAddresses();
$mail->clearAttachments();
}

View File

@ -0,0 +1,54 @@
<?php
/**
* This example shows how to use POP-before-SMTP for authentication.
*/
require '../PHPMailerAutoload.php';
//Authenticate via POP3.
//After this you should be allowed to submit messages over SMTP for a while.
//Only applies if your host supports POP-before-SMTP.
$pop = POP3::popBeforeSmtp('pop3.example.com', 110, 30, 'username', 'password', 1);
//Create a new PHPMailer instance
//Passing true to the constructor enables the use of exceptions for error handling
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "mail.example.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = false;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer POP-before-SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//and convert the HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message
//Note that we don't need check the response from this because it will throw an exception if it has trouble
$mail->send();
echo "Message sent!";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}

View File

@ -0,0 +1,664 @@
// XRegExp 1.5.1
// (c) 2007-2012 Steven Levithan
// MIT License
// <http://xregexp.com>
// Provides an augmented, extensible, cross-browser implementation of regular expressions,
// including support for additional syntax, flags, and methods
var XRegExp;
if (XRegExp) {
// Avoid running twice, since that would break references to native globals
throw Error("can't load XRegExp twice in the same frame");
}
// Run within an anonymous function to protect variables and avoid new globals
(function (undefined) {
//---------------------------------
// Constructor
//---------------------------------
// Accepts a pattern and flags; returns a new, extended `RegExp` object. Differs from a native
// regular expression in that additional syntax and flags are supported and cross-browser
// syntax inconsistencies are ameliorated. `XRegExp(/regex/)` clones an existing regex and
// converts to type XRegExp
XRegExp = function (pattern, flags) {
var output = [],
currScope = XRegExp.OUTSIDE_CLASS,
pos = 0,
context, tokenResult, match, chr, regex;
if (XRegExp.isRegExp(pattern)) {
if (flags !== undefined)
throw TypeError("can't supply flags when constructing one RegExp from another");
return clone(pattern);
}
// Tokens become part of the regex construction process, so protect against infinite
// recursion when an XRegExp is constructed within a token handler or trigger
if (isInsideConstructor)
throw Error("can't call the XRegExp constructor within token definition functions");
flags = flags || "";
context = { // `this` object for custom tokens
hasNamedCapture: false,
captureNames: [],
hasFlag: function (flag) {return flags.indexOf(flag) > -1;},
setFlag: function (flag) {flags += flag;}
};
while (pos < pattern.length) {
// Check for custom tokens at the current position
tokenResult = runTokens(pattern, pos, currScope, context);
if (tokenResult) {
output.push(tokenResult.output);
pos += (tokenResult.match[0].length || 1);
} else {
// Check for native multicharacter metasequences (excluding character classes) at
// the current position
if (match = nativ.exec.call(nativeTokens[currScope], pattern.slice(pos))) {
output.push(match[0]);
pos += match[0].length;
} else {
chr = pattern.charAt(pos);
if (chr === "[")
currScope = XRegExp.INSIDE_CLASS;
else if (chr === "]")
currScope = XRegExp.OUTSIDE_CLASS;
// Advance position one character
output.push(chr);
pos++;
}
}
}
regex = RegExp(output.join(""), nativ.replace.call(flags, flagClip, ""));
regex._xregexp = {
source: pattern,
captureNames: context.hasNamedCapture ? context.captureNames : null
};
return regex;
};
//---------------------------------
// Public properties
//---------------------------------
XRegExp.version = "1.5.1";
// Token scope bitflags
XRegExp.INSIDE_CLASS = 1;
XRegExp.OUTSIDE_CLASS = 2;
//---------------------------------
// Private variables
//---------------------------------
var replacementToken = /\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g,
flagClip = /[^gimy]+|([\s\S])(?=[\s\S]*\1)/g, // Nonnative and duplicate flags
quantifier = /^(?:[?*+]|{\d+(?:,\d*)?})\??/,
isInsideConstructor = false,
tokens = [],
// Copy native globals for reference ("native" is an ES3 reserved keyword)
nativ = {
exec: RegExp.prototype.exec,
test: RegExp.prototype.test,
match: String.prototype.match,
replace: String.prototype.replace,
split: String.prototype.split
},
compliantExecNpcg = nativ.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
compliantLastIndexIncrement = function () {
var x = /^/g;
nativ.test.call(x, "");
return !x.lastIndex;
}(),
hasNativeY = RegExp.prototype.sticky !== undefined,
nativeTokens = {};
// `nativeTokens` match native multicharacter metasequences only (including deprecated octals,
// excluding character classes)
nativeTokens[XRegExp.INSIDE_CLASS] = /^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/;
nativeTokens[XRegExp.OUTSIDE_CLASS] = /^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/;
//---------------------------------
// Public methods
//---------------------------------
// Lets you extend or change XRegExp syntax and create custom flags. This is used internally by
// the XRegExp library and can be used to create XRegExp plugins. This function is intended for
// users with advanced knowledge of JavaScript's regular expression syntax and behavior. It can
// be disabled by `XRegExp.freezeTokens`
XRegExp.addToken = function (regex, handler, scope, trigger) {
tokens.push({
pattern: clone(regex, "g" + (hasNativeY ? "y" : "")),
handler: handler,
scope: scope || XRegExp.OUTSIDE_CLASS,
trigger: trigger || null
});
};
// Accepts a pattern and flags; returns an extended `RegExp` object. If the pattern and flag
// combination has previously been cached, the cached copy is returned; otherwise the newly
// created regex is cached
XRegExp.cache = function (pattern, flags) {
var key = pattern + "/" + (flags || "");
return XRegExp.cache[key] || (XRegExp.cache[key] = XRegExp(pattern, flags));
};
// Accepts a `RegExp` instance; returns a copy with the `/g` flag set. The copy has a fresh
// `lastIndex` (set to zero). If you want to copy a regex without forcing the `global`
// property, use `XRegExp(regex)`. Do not use `RegExp(regex)` because it will not preserve
// special properties required for named capture
XRegExp.copyAsGlobal = function (regex) {
return clone(regex, "g");
};
// Accepts a string; returns the string with regex metacharacters escaped. The returned string
// can safely be used at any point within a regex to match the provided literal string. Escaped
// characters are [ ] { } ( ) * + ? - . , \ ^ $ | # and whitespace
XRegExp.escape = function (str) {
return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
};
// Accepts a string to search, regex to search with, position to start the search within the
// string (default: 0), and an optional Boolean indicating whether matches must start at-or-
// after the position or at the specified position only. This function ignores the `lastIndex`
// of the provided regex in its own handling, but updates the property for compatibility
XRegExp.execAt = function (str, regex, pos, anchored) {
var r2 = clone(regex, "g" + ((anchored && hasNativeY) ? "y" : "")),
match;
r2.lastIndex = pos = pos || 0;
match = r2.exec(str); // Run the altered `exec` (required for `lastIndex` fix, etc.)
if (anchored && match && match.index !== pos)
match = null;
if (regex.global)
regex.lastIndex = match ? r2.lastIndex : 0;
return match;
};
// Breaks the unrestorable link to XRegExp's private list of tokens, thereby preventing
// syntax and flag changes. Should be run after XRegExp and any plugins are loaded
XRegExp.freezeTokens = function () {
XRegExp.addToken = function () {
throw Error("can't run addToken after freezeTokens");
};
};
// Accepts any value; returns a Boolean indicating whether the argument is a `RegExp` object.
// Note that this is also `true` for regex literals and regexes created by the `XRegExp`
// constructor. This works correctly for variables created in another frame, when `instanceof`
// and `constructor` checks would fail to work as intended
XRegExp.isRegExp = function (o) {
return Object.prototype.toString.call(o) === "[object RegExp]";
};
// Executes `callback` once per match within `str`. Provides a simpler and cleaner way to
// iterate over regex matches compared to the traditional approaches of subverting
// `String.prototype.replace` or repeatedly calling `exec` within a `while` loop
XRegExp.iterate = function (str, regex, callback, context) {
var r2 = clone(regex, "g"),
i = -1, match;
while (match = r2.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.)
if (regex.global)
regex.lastIndex = r2.lastIndex; // Doing this to follow expectations if `lastIndex` is checked within `callback`
callback.call(context, match, ++i, str, regex);
if (r2.lastIndex === match.index)
r2.lastIndex++;
}
if (regex.global)
regex.lastIndex = 0;
};
// Accepts a string and an array of regexes; returns the result of using each successive regex
// to search within the matches of the previous regex. The array of regexes can also contain
// objects with `regex` and `backref` properties, in which case the named or numbered back-
// references specified are passed forward to the next regex or returned. E.g.:
// var xregexpImgFileNames = XRegExp.matchChain(html, [
// {regex: /<img\b([^>]+)>/i, backref: 1}, // <img> tag attributes
// {regex: XRegExp('(?ix) \\s src=" (?<src> [^"]+ )'), backref: "src"}, // src attribute values
// {regex: XRegExp("^http://xregexp\\.com(/[^#?]+)", "i"), backref: 1}, // xregexp.com paths
// /[^\/]+$/ // filenames (strip directory paths)
// ]);
XRegExp.matchChain = function (str, chain) {
return function recurseChain (values, level) {
var item = chain[level].regex ? chain[level] : {regex: chain[level]},
regex = clone(item.regex, "g"),
matches = [], i;
for (i = 0; i < values.length; i++) {
XRegExp.iterate(values[i], regex, function (match) {
matches.push(item.backref ? (match[item.backref] || "") : match[0]);
});
}
return ((level === chain.length - 1) || !matches.length) ?
matches : recurseChain(matches, level + 1);
}([str], 0);
};
//---------------------------------
// New RegExp prototype methods
//---------------------------------
// Accepts a context object and arguments array; returns the result of calling `exec` with the
// first value in the arguments array. the context is ignored but is accepted for congruity
// with `Function.prototype.apply`
RegExp.prototype.apply = function (context, args) {
return this.exec(args[0]);
};
// Accepts a context object and string; returns the result of calling `exec` with the provided
// string. the context is ignored but is accepted for congruity with `Function.prototype.call`
RegExp.prototype.call = function (context, str) {
return this.exec(str);
};
//---------------------------------
// Overridden native methods
//---------------------------------
// Adds named capture support (with backreferences returned as `result.name`), and fixes two
// cross-browser issues per ES3:
// - Captured values for nonparticipating capturing groups should be returned as `undefined`,
// rather than the empty string.
// - `lastIndex` should not be incremented after zero-length matches.
RegExp.prototype.exec = function (str) {
var match, name, r2, origLastIndex;
if (!this.global)
origLastIndex = this.lastIndex;
match = nativ.exec.apply(this, arguments);
if (match) {
// Fix browsers whose `exec` methods don't consistently return `undefined` for
// nonparticipating capturing groups
if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
r2 = RegExp(this.source, nativ.replace.call(getNativeFlags(this), "g", ""));
// Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
// matching due to characters outside the match
nativ.replace.call((str + "").slice(match.index), r2, function () {
for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undefined)
match[i] = undefined;
}
});
}
// Attach named capture properties
if (this._xregexp && this._xregexp.captureNames) {
for (var i = 1; i < match.length; i++) {
name = this._xregexp.captureNames[i - 1];
if (name)
match[name] = match[i];
}
}
// Fix browsers that increment `lastIndex` after zero-length matches
if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
this.lastIndex--;
}
if (!this.global)
this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
return match;
};
// Fix browser bugs in native method
RegExp.prototype.test = function (str) {
// Use the native `exec` to skip some processing overhead, even though the altered
// `exec` would take care of the `lastIndex` fixes
var match, origLastIndex;
if (!this.global)
origLastIndex = this.lastIndex;
match = nativ.exec.call(this, str);
// Fix browsers that increment `lastIndex` after zero-length matches
if (match && !compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
this.lastIndex--;
if (!this.global)
this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
return !!match;
};
// Adds named capture support and fixes browser bugs in native method
String.prototype.match = function (regex) {
if (!XRegExp.isRegExp(regex))
regex = RegExp(regex); // Native `RegExp`
if (regex.global) {
var result = nativ.match.apply(this, arguments);
regex.lastIndex = 0; // Fix IE bug
return result;
}
return regex.exec(this); // Run the altered `exec`
};
// Adds support for `${n}` tokens for named and numbered backreferences in replacement text,
// and provides named backreferences to replacement functions as `arguments[0].name`. Also
// fixes cross-browser differences in replacement text syntax when performing a replacement
// using a nonregex search value, and the value of replacement regexes' `lastIndex` property
// during replacement iterations. Note that this doesn't support SpiderMonkey's proprietary
// third (`flags`) parameter
String.prototype.replace = function (search, replacement) {
var isRegex = XRegExp.isRegExp(search),
captureNames, result, str, origLastIndex;
// There are too many combinations of search/replacement types/values and browser bugs that
// preclude passing to native `replace`, so don't try
//if (...)
// return nativ.replace.apply(this, arguments);
if (isRegex) {
if (search._xregexp)
captureNames = search._xregexp.captureNames; // Array or `null`
if (!search.global)
origLastIndex = search.lastIndex;
} else {
search = search + ""; // Type conversion
}
if (Object.prototype.toString.call(replacement) === "[object Function]") {
result = nativ.replace.call(this + "", search, function () {
if (captureNames) {
// Change the `arguments[0]` string primitive to a String object which can store properties
arguments[0] = new String(arguments[0]);
// Store named backreferences on `arguments[0]`
for (var i = 0; i < captureNames.length; i++) {
if (captureNames[i])
arguments[0][captureNames[i]] = arguments[i + 1];
}
}
// Update `lastIndex` before calling `replacement` (fix browsers)
if (isRegex && search.global)
search.lastIndex = arguments[arguments.length - 2] + arguments[0].length;
return replacement.apply(null, arguments);
});
} else {
str = this + ""; // Type conversion, so `args[args.length - 1]` will be a string (given nonstring `this`)
result = nativ.replace.call(str, search, function () {
var args = arguments; // Keep this function's `arguments` available through closure
return nativ.replace.call(replacement + "", replacementToken, function ($0, $1, $2) {
// Numbered backreference (without delimiters) or special variable
if ($1) {
switch ($1) {
case "$": return "$";
case "&": return args[0];
case "`": return args[args.length - 1].slice(0, args[args.length - 2]);
case "'": return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
// Numbered backreference
default:
// What does "$10" mean?
// - Backreference 10, if 10 or more capturing groups exist
// - Backreference 1 followed by "0", if 1-9 capturing groups exist
// - Otherwise, it's the string "$10"
// Also note:
// - Backreferences cannot be more than two digits (enforced by `replacementToken`)
// - "$01" is equivalent to "$1" if a capturing group exists, otherwise it's the string "$01"
// - There is no "$0" token ("$&" is the entire match)
var literalNumbers = "";
$1 = +$1; // Type conversion; drop leading zero
if (!$1) // `$1` was "0" or "00"
return $0;
while ($1 > args.length - 3) {
literalNumbers = String.prototype.slice.call($1, -1) + literalNumbers;
$1 = Math.floor($1 / 10); // Drop the last digit
}
return ($1 ? args[$1] || "" : "$") + literalNumbers;
}
// Named backreference or delimited numbered backreference
} else {
// What does "${n}" mean?
// - Backreference to numbered capture n. Two differences from "$n":
// - n can be more than two digits
// - Backreference 0 is allowed, and is the entire match
// - Backreference to named capture n, if it exists and is not a number overridden by numbered capture
// - Otherwise, it's the string "${n}"
var n = +$2; // Type conversion; drop leading zeros
if (n <= args.length - 3)
return args[n];
n = captureNames ? indexOf(captureNames, $2) : -1;
return n > -1 ? args[n + 1] : $0;
}
});
});
}
if (isRegex) {
if (search.global)
search.lastIndex = 0; // Fix IE, Safari bug (last tested IE 9.0.5, Safari 5.1.2 on Windows)
else
search.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
}
return result;
};
// A consistent cross-browser, ES3 compliant `split`
String.prototype.split = function (s /* separator */, limit) {
// If separator `s` is not a regex, use the native `split`
if (!XRegExp.isRegExp(s))
return nativ.split.apply(this, arguments);
var str = this + "", // Type conversion
output = [],
lastLastIndex = 0,
match, lastLength;
// Behavior for `limit`: if it's...
// - `undefined`: No limit
// - `NaN` or zero: Return an empty array
// - A positive number: Use `Math.floor(limit)`
// - A negative number: No limit
// - Other: Type-convert, then use the above rules
if (limit === undefined || +limit < 0) {
limit = Infinity;
} else {
limit = Math.floor(+limit);
if (!limit)
return [];
}
// This is required if not `s.global`, and it avoids needing to set `s.lastIndex` to zero
// and restore it to its original value when we're done using the regex
s = XRegExp.copyAsGlobal(s);
while (match = s.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.)
if (s.lastIndex > lastLastIndex) {
output.push(str.slice(lastLastIndex, match.index));
if (match.length > 1 && match.index < str.length)
Array.prototype.push.apply(output, match.slice(1));
lastLength = match[0].length;
lastLastIndex = s.lastIndex;
if (output.length >= limit)
break;
}
if (s.lastIndex === match.index)
s.lastIndex++;
}
if (lastLastIndex === str.length) {
if (!nativ.test.call(s, "") || lastLength)
output.push("");
} else {
output.push(str.slice(lastLastIndex));
}
return output.length > limit ? output.slice(0, limit) : output;
};
//---------------------------------
// Private helper functions
//---------------------------------
// Supporting function for `XRegExp`, `XRegExp.copyAsGlobal`, etc. Returns a copy of a `RegExp`
// instance with a fresh `lastIndex` (set to zero), preserving properties required for named
// capture. Also allows adding new flags in the process of copying the regex
function clone (regex, additionalFlags) {
if (!XRegExp.isRegExp(regex))
throw TypeError("type RegExp expected");
var x = regex._xregexp;
regex = XRegExp(regex.source, getNativeFlags(regex) + (additionalFlags || ""));
if (x) {
regex._xregexp = {
source: x.source,
captureNames: x.captureNames ? x.captureNames.slice(0) : null
};
}
return regex;
}
function getNativeFlags (regex) {
return (regex.global ? "g" : "") +
(regex.ignoreCase ? "i" : "") +
(regex.multiline ? "m" : "") +
(regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
(regex.sticky ? "y" : "");
}
function runTokens (pattern, index, scope, context) {
var i = tokens.length,
result, match, t;
// Protect against constructing XRegExps within token handler and trigger functions
isInsideConstructor = true;
// Must reset `isInsideConstructor`, even if a `trigger` or `handler` throws
try {
while (i--) { // Run in reverse order
t = tokens[i];
if ((scope & t.scope) && (!t.trigger || t.trigger.call(context))) {
t.pattern.lastIndex = index;
match = t.pattern.exec(pattern); // Running the altered `exec` here allows use of named backreferences, etc.
if (match && match.index === index) {
result = {
output: t.handler.call(context, match, scope),
match: match
};
break;
}
}
}
} catch (err) {
throw err;
} finally {
isInsideConstructor = false;
}
return result;
}
function indexOf (array, item, from) {
if (Array.prototype.indexOf) // Use the native array method if available
return array.indexOf(item, from);
for (var i = from || 0; i < array.length; i++) {
if (array[i] === item)
return i;
}
return -1;
}
//---------------------------------
// Built-in tokens
//---------------------------------
// Augment XRegExp's regular expression syntax and flags. Note that when adding tokens, the
// third (`scope`) argument defaults to `XRegExp.OUTSIDE_CLASS`
// Comment pattern: (?# )
XRegExp.addToken(
/\(\?#[^)]*\)/,
function (match) {
// Keep tokens separated unless the following token is a quantifier
return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
}
);
// Capturing group (match the opening parenthesis only).
// Required for support of named capturing groups
XRegExp.addToken(
/\((?!\?)/,
function () {
this.captureNames.push(null);
return "(";
}
);
// Named capturing group (match the opening delimiter only): (?<name>
XRegExp.addToken(
/\(\?<([$\w]+)>/,
function (match) {
this.captureNames.push(match[1]);
this.hasNamedCapture = true;
return "(";
}
);
// Named backreference: \k<name>
XRegExp.addToken(
/\\k<([\w$]+)>/,
function (match) {
var index = indexOf(this.captureNames, match[1]);
// Keep backreferences separate from subsequent literal numbers. Preserve back-
// references to named groups that are undefined at this point as literal strings
return index > -1 ?
"\\" + (index + 1) + (isNaN(match.input.charAt(match.index + match[0].length)) ? "" : "(?:)") :
match[0];
}
);
// Empty character class: [] or [^]
XRegExp.addToken(
/\[\^?]/,
function (match) {
// For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S].
// (?!) should work like \b\B, but is unreliable in Firefox
return match[0] === "[]" ? "\\b\\B" : "[\\s\\S]";
}
);
// Mode modifier at the start of the pattern only, with any combination of flags imsx: (?imsx)
// Does not support x(?i), (?-i), (?i-m), (?i: ), (?i)(?m), etc.
XRegExp.addToken(
/^\(\?([imsx]+)\)/,
function (match) {
this.setFlag(match[1]);
return "";
}
);
// Whitespace and comments, in free-spacing (aka extended) mode only
XRegExp.addToken(
/(?:\s+|#.*)+/,
function (match) {
// Keep tokens separated unless the following token is a quantifier
return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
},
XRegExp.OUTSIDE_CLASS,
function () {return this.hasFlag("x");}
);
// Dot, in dotall (aka singleline) mode only
XRegExp.addToken(
/\./,
function () {return "[\\s\\S]";},
XRegExp.OUTSIDE_CLASS,
function () {return this.hasFlag("s");}
);
//---------------------------------
// Backward compatibility
//---------------------------------
// Uncomment the following block for compatibility with XRegExp 1.0-1.2:
/*
XRegExp.matchWithinChain = XRegExp.matchChain;
RegExp.prototype.addFlags = function (s) {return clone(this, s);};
RegExp.prototype.execAll = function (s) {var r = []; XRegExp.iterate(s, this, function (m) {r.push(m);}); return r;};
RegExp.prototype.forEachExec = function (s, f, c) {return XRegExp.iterate(s, this, f, c);};
RegExp.prototype.validate = function (s) {var r = RegExp("^(?:" + this.source + ")$(?!\\s)", getNativeFlags(this)); if (this.global) this.lastIndex = 0; return s.search(r) === 0;};
*/
})();

View File

@ -0,0 +1,122 @@
(function() {
var sh = SyntaxHighlighter;
/**
* Provides functionality to dynamically load only the brushes that a needed to render the current page.
*
* There are two syntaxes that autoload understands. For example:
*
* SyntaxHighlighter.autoloader(
* [ 'applescript', 'Scripts/shBrushAppleScript.js' ],
* [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ]
* );
*
* or a more easily comprehendable one:
*
* SyntaxHighlighter.autoloader(
* 'applescript Scripts/shBrushAppleScript.js',
* 'actionscript3 as3 Scripts/shBrushAS3.js'
* );
*/
sh.autoloader = function()
{
var list = arguments,
elements = sh.findElements(),
brushes = {},
scripts = {},
all = SyntaxHighlighter.all,
allCalled = false,
allParams = null,
i
;
SyntaxHighlighter.all = function(params)
{
allParams = params;
allCalled = true;
};
function addBrush(aliases, url)
{
for (var i = 0; i < aliases.length; i++)
brushes[aliases[i]] = url;
};
function getAliases(item)
{
return item.pop
? item
: item.split(/\s+/)
;
}
// create table of aliases and script urls
for (i = 0; i < list.length; i++)
{
var aliases = getAliases(list[i]),
url = aliases.pop()
;
addBrush(aliases, url);
}
// dynamically add <script /> tags to the document body
for (i = 0; i < elements.length; i++)
{
var url = brushes[elements[i].params.brush];
if(url && scripts[url] === undefined)
{
if(elements[i].params['html-script'] === 'true')
{
if(scripts[brushes['xml']] === undefined) {
loadScript(brushes['xml']);
scripts[url] = false;
}
}
scripts[url] = false;
loadScript(url);
}
}
function loadScript(url)
{
var script = document.createElement('script'),
done = false
;
script.src = url;
script.type = 'text/javascript';
script.language = 'javascript';
script.onload = script.onreadystatechange = function()
{
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete'))
{
done = true;
scripts[url] = true;
checkAll();
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
script.parentNode.removeChild(script);
}
};
// sync way of adding script tags to the page
document.body.appendChild(script);
};
function checkAll()
{
for(var url in scripts)
if (scripts[url] == false)
return;
if (allCalled)
SyntaxHighlighter.highlight(allParams);
};
};
})();

View File

@ -0,0 +1,72 @@
;(function()
{
// CommonJS
SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
function Brush()
{
var funcs = 'abs acos acosh addcslashes addslashes ' +
'array_change_key_case array_chunk array_combine array_count_values array_diff '+
'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
'array_push array_rand array_reduce array_reverse array_search array_shift '+
'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+
'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
'strtoupper strtr strval substr substr_compare';
var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' +
'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' +
'function global goto if implements include include_once interface instanceof insteadof namespace new ' +
'old_function or private protected public return require require_once static switch ' +
'trait throw try use var while xor ';
var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
{ regex: /\$\w+/g, css: 'variable' }, // variables
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions
{ regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword
];
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['php'];
SyntaxHighlighter.brushes.Php = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,140 @@
var dp = {
SyntaxHighlighter : {}
};
dp.SyntaxHighlighter = {
parseParams: function(
input,
showGutter,
showControls,
collapseAll,
firstLine,
showColumns
)
{
function getValue(list, name)
{
var regex = new XRegExp('^' + name + '\\[(?<value>\\w+)\\]$', 'gi'),
match = null
;
for (var i = 0; i < list.length; i++)
if ((match = regex.exec(list[i])) != null)
return match.value;
return null;
}
function defaultValue(value, def)
{
return value != null ? value : def;
}
function asString(value)
{
return value != null ? value.toString() : null;
}
var parts = input.split(':'),
brushName = parts[0],
options = {},
straight = { 'true' : true },
reverse = { 'true' : false },
defaults = SyntaxHighlighter.defaults
;
for (var i in parts)
options[parts[i]] = 'true';
showGutter = asString(defaultValue(showGutter, defaults.gutter));
showControls = asString(defaultValue(showControls, defaults.toolbar));
collapseAll = asString(defaultValue(collapseAll, defaults.collapse));
showColumns = asString(defaultValue(showColumns, defaults.ruler));
firstLine = asString(defaultValue(firstLine, defaults['first-line']));
return {
brush : brushName,
gutter : defaultValue(reverse[options.nogutter], showGutter),
toolbar : defaultValue(reverse[options.nocontrols], showControls),
collapse : defaultValue(straight[options.collapse], collapseAll),
// ruler : defaultValue(straight[options.showcolumns], showColumns),
'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine)
};
},
HighlightAll: function(
name,
showGutter /* optional */,
showControls /* optional */,
collapseAll /* optional */,
firstLine /* optional */,
showColumns /* optional */
)
{
function findValue()
{
var a = arguments;
for (var i = 0; i < a.length; i++)
{
if (a[i] === null)
continue;
if (typeof(a[i]) == 'string' && a[i] != '')
return a[i] + '';
if (typeof(a[i]) == 'object' && a[i].value != '')
return a[i].value + '';
}
return null;
}
function findTagsByName(list, name, tagName)
{
var tags = document.getElementsByTagName(tagName);
for (var i = 0; i < tags.length; i++)
if (tags[i].getAttribute('name') == name)
list.push(tags[i]);
}
var elements = [],
highlighter = null,
registered = {},
propertyName = 'innerHTML'
;
// for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name...
findTagsByName(elements, name, 'pre');
findTagsByName(elements, name, 'textarea');
if (elements.length === 0)
return;
for (var i = 0; i < elements.length; i++)
{
var element = elements[i],
params = findValue(
element.attributes['class'], element.className,
element.attributes['language'], element.language
),
language = ''
;
if (params === null)
continue;
params = dp.SyntaxHighlighter.parseParams(
params,
showGutter,
showControls,
collapseAll,
firstLine,
showColumns
);
SyntaxHighlighter.highlight(params, element);
}
}
};

View File

@ -0,0 +1,49 @@
<?php
/**
* PHPMailer simple file upload and send example
*/
$msg = '';
if (array_key_exists('userfile', $_FILES)) {
// First handle the upload
// Don't trust provided filename - same goes for MIME types
// See http://php.net/manual/en/features.file-upload.php#114004 for more thorough upload validation
$uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name']));
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
// Upload handled successfully
// Now create a message
// This should be somewhere in your include_path
require '../PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
$mail->Subject = 'PHPMailer file sender';
$mail->Body = 'My message body';
// Attach the uploaded file
$mail->addAttachment($uploadfile, 'My uploaded file');
if (!$mail->send()) {
$msg .= "Mailer Error: " . $mail->ErrorInfo;
} else {
$msg .= "Message sent!";
}
} else {
$msg .= 'Failed to move file to ' . $uploadfile;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Upload</title>
</head>
<body>
<?php if (empty($msg)) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
<?php } else {
echo $msg;
} ?>
</body>
</html>

View File

@ -0,0 +1,51 @@
<?php
/**
* PHPMailer multiple files upload and send example
*/
$msg = '';
if (array_key_exists('userfile', $_FILES)) {
// Create a message
// This should be somewhere in your include_path
require '../PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
$mail->Subject = 'PHPMailer file sender';
$mail->Body = 'My message body';
//Attach multiple files one by one
for ($ct = 0; $ct < count($_FILES['userfile']['tmp_name']); $ct++) {
$uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name'][$ct]));
$filename = $_FILES['userfile']['name'][$ct];
if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) {
$mail->addAttachment($uploadfile, $filename);
} else {
$msg .= 'Failed to move file to ' . $uploadfile;
}
}
if (!$mail->send()) {
$msg .= "Mailer Error: " . $mail->ErrorInfo;
} else {
$msg .= "Message sent!";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Upload</title>
</head>
<body>
<?php if (empty($msg)) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Select one or more files:
<input name="userfile[]" type="file" multiple="multiple">
<input type="submit" value="Send Files">
</form>
<?php } else {
echo $msg;
} ?>
</body>
</html>

View File

@ -0,0 +1,33 @@
<?php
/**
* This example shows sending a message using a local sendmail binary.
*/
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
// Set PHPMailer to use the sendmail transport
$mail->isSendmail();
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer sendmail test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@ -0,0 +1,89 @@
<?php
/**
* This example shows signing a message and then sending it via the mail() function of PHP.
*
* Before you can sign the mail certificates are needed.
*
*
* STEP 1 - Creating a certificate:
* You can either use a self signed certificate, pay for a signed one or use free alternatives such as StartSSL/Comodo etc.
* Check out this link for more providers: http://kb.mozillazine.org/Getting_an_SMIME_certificate
* In this example I am using Comodo.
* The form is directly available via https://secure.comodo.com/products/frontpage?area=SecureEmailCertificate
* Fill it out and you'll get an email with a link to download your certificate.
* Usually the certificate will be directly installed into your browser (FireFox/Chrome).
*
*
* STEP 2 - Exporting the certificate
* This is specific to your browser, however, most browsers will give you the option to export your recently added certificate in PKCS12 (.pfx)
* Include your private key if you are asked for it.
* Set up a password to protect your exported file.
*
* STEP 3 - Splitting the .pfx into a private key and the certificate.
* I use openssl for this. You only need two commands. In my case the certificate file is called 'exported-cert.pfx'
* To create the private key do the following:
*
* openssl pkcs12 -in exported-cert.pfx -nocerts -out cert.key
*
* Of course the way you name your file (-out) is up to you.
* You will be asked for a password for the Import password. This is the password you just set while exporting the certificate into the pfx file.
* Afterwards, you can password protect your private key (recommended)
* Also make sure to set the permissions to a minimum level and suitable for your application.
* To create the certificate file use the following command:
*
* openssl pkcs12 -in exported-cert.pfx -clcerts -nokeys -out cert.crt
*
* Again, the way you name your certificate is up to you. You will be also asked for the Import Password.
* To create the certificate-chain file use the following command:
*
* openssl pkcs12 -in exported-cert.pfx -cacerts -out certchain.pem
*
* Again, the way you name your chain file is up to you. You will be also asked for the Import Password.
*
*
* STEP 3 - Code
*/
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Set who the message is to be sent from
//IMPORTANT: This must match the email address of your certificate.
//Although the certificate will be valid, an error will be thrown since it cannot be verified that the sender and the signer are the same person.
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//Convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//Configure message signing (the actual signing does not occur until sending)
$mail->sign(
'/path/to/cert.crt', //The location of your certificate file
'/path/to/cert.key', //The location of your private key file
'yourSecretPrivateKeyPassword', //The password you protected your private key with (not the Import Password! may be empty but parameter must not be omitted!)
'/path/to/certchain.pem' //The location of your chain file
);
//Send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
/**
* REMARKS:
* If your email client does not support S/MIME it will most likely just show an attachment smime.p7s which is the signature contained in the email.
* Other clients, such as Thunderbird support S/MIME natively and will validate the signature automatically and report the result in some way.
*/
?>

54
lib/vendor/PHPMailer/examples/smtp.phps vendored Normal file
View File

@ -0,0 +1,54 @@
<?php
/**
* This example shows making an SMTP connection with authentication.
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "mail.example.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "yourname@example.com";
//Password to use for SMTP authentication
$mail->Password = "yourpassword";
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@ -0,0 +1,55 @@
<?php
/**
* This uses the SMTP class alone to check that a connection can be made to an SMTP server,
* authenticate, then disconnect
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
//Create a new SMTP instance
$smtp = new SMTP;
//Enable connection-level debug output
$smtp->do_debug = SMTP::DEBUG_CONNECTION;
try {
//Connect to an SMTP server
if (!$smtp->connect('mail.example.com', 25)) {
throw new Exception('Connect failed');
}
//Say hello
if (!$smtp->hello(gethostname())) {
throw new Exception('EHLO failed: ' . $smtp->getError()['error']);
}
//Get the list of ESMTP services the server offers
$e = $smtp->getServerExtList();
//If server can do TLS encryption, use it
if (is_array($e) && array_key_exists('STARTTLS', $e)) {
$tlsok = $smtp->startTLS();
if (!$tlsok) {
throw new Exception('Failed to start encryption: ' . $smtp->getError()['error']);
}
//Repeat EHLO after STARTTLS
if (!$smtp->hello(gethostname())) {
throw new Exception('EHLO (2) failed: ' . $smtp->getError()['error']);
}
//Get new capabilities list, which will usually now include AUTH if it didn't before
$e = $smtp->getServerExtList();
}
//If server supports authentication, do it (even if no encryption)
if (is_array($e) && array_key_exists('AUTH', $e)) {
if ($smtp->authenticate('username', 'password')) {
echo "Connected ok!";
} else {
throw new Exception('Authentication failed: ' . $smtp->getError()['error']);
}
}
} catch (Exception $e) {
echo 'SMTP error: ' . $e->getMessage(), "\n";
}
//Whatever happened, close the connection.
$smtp->quit(true);

View File

@ -0,0 +1,50 @@
<?php
/**
* This example shows making an SMTP connection without using authentication.
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require_once '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "mail.example.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = false;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP without auth test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@ -0,0 +1,74 @@
<?php
/**
* This example shows settings to use when sending over SMTP with TLS and custom connection options.
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'smtp.example.com';
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Custom connection options
$mail->SMTPOptions = array (
'ssl' => array(
'verify_peer' => true,
'verify_depth' => 3,
'allow_self_signed' => true,
'peer_name' => 'smtp.example.com',
'cafile' => '/etc/ssl/ca_cert.pem',
)
);
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "username@example.com";
//Password to use for SMTP authentication
$mail->Password = "yourpassword";
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP options test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@ -0,0 +1,46 @@
.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
.syntaxhighlighter.source{overflow:hidden !important;}
.syntaxhighlighter .bold{font-weight:bold !important;}
.syntaxhighlighter .italic{font-style:italic !important;}
.syntaxhighlighter .line{white-space:pre !important;}
.syntaxhighlighter table{width:100% !important;}
.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
.syntaxhighlighter table td.code{width:100% !important;}
.syntaxhighlighter table td.code .container{position:relative !important;}
.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
.syntaxhighlighter table td.code .line{padding:0 1em !important;}
.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
.syntaxhighlighter.show{display:block !important;}
.syntaxhighlighter.collapsed table{display:none !important;}
.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
.syntaxhighlighter .toolbar span.title{display:inline !important;}
.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
.syntaxhighlighter.printing .line .content{color:black !important;}
.syntaxhighlighter.printing .toolbar{display:none !important;}
.syntaxhighlighter.printing a{text-decoration:none !important;}
.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
.syntaxhighlighter.printing .preprocessor{color:gray !important;}
.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
.syntaxhighlighter.printing .value{color:#009900 !important;}
.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
.syntaxhighlighter.printing .constants{color:#0066cc !important;}
.syntaxhighlighter.printing .script{font-weight:bold !important;}
.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}

View File

@ -0,0 +1,77 @@
.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
.syntaxhighlighter.source{overflow:hidden !important;}
.syntaxhighlighter .bold{font-weight:bold !important;}
.syntaxhighlighter .italic{font-style:italic !important;}
.syntaxhighlighter .line{white-space:pre !important;}
.syntaxhighlighter table{width:100% !important;}
.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
.syntaxhighlighter table td.code{width:100% !important;}
.syntaxhighlighter table td.code .container{position:relative !important;}
.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
.syntaxhighlighter table td.code .line{padding:0 1em !important;}
.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
.syntaxhighlighter.show{display:block !important;}
.syntaxhighlighter.collapsed table{display:none !important;}
.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
.syntaxhighlighter .toolbar span.title{display:inline !important;}
.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
.syntaxhighlighter.printing .line .content{color:black !important;}
.syntaxhighlighter.printing .toolbar{display:none !important;}
.syntaxhighlighter.printing a{text-decoration:none !important;}
.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
.syntaxhighlighter.printing .preprocessor{color:gray !important;}
.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
.syntaxhighlighter.printing .value{color:#009900 !important;}
.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
.syntaxhighlighter.printing .constants{color:#0066cc !important;}
.syntaxhighlighter.printing .script{font-weight:bold !important;}
.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
.syntaxhighlighter{background-color:white !important;}
.syntaxhighlighter .line.alt1{background-color:white !important;}
.syntaxhighlighter .line.alt2{background-color:white !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;}
.syntaxhighlighter .line.highlighted.number{color:black !important;}
.syntaxhighlighter table caption{color:black !important;}
.syntaxhighlighter .gutter{color:#afafaf !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;}
.syntaxhighlighter.collapsed .toolbar a{color:blue !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:black !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:blue !important;}
.syntaxhighlighter .keyword{color:#006699 !important;}
.syntaxhighlighter .preprocessor{color:gray !important;}
.syntaxhighlighter .variable{color:#aa7700 !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#ff1493 !important;}
.syntaxhighlighter .constants{color:#0066cc !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
.syntaxhighlighter .keyword{font-weight:bold !important;}

View File

@ -0,0 +1,78 @@
.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
.syntaxhighlighter.source{overflow:hidden !important;}
.syntaxhighlighter .bold{font-weight:bold !important;}
.syntaxhighlighter .italic{font-style:italic !important;}
.syntaxhighlighter .line{white-space:pre !important;}
.syntaxhighlighter table{width:100% !important;}
.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
.syntaxhighlighter table td.code{width:100% !important;}
.syntaxhighlighter table td.code .container{position:relative !important;}
.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
.syntaxhighlighter table td.code .line{padding:0 1em !important;}
.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
.syntaxhighlighter.show{display:block !important;}
.syntaxhighlighter.collapsed table{display:none !important;}
.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
.syntaxhighlighter .toolbar span.title{display:inline !important;}
.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
.syntaxhighlighter.printing .line .content{color:black !important;}
.syntaxhighlighter.printing .toolbar{display:none !important;}
.syntaxhighlighter.printing a{text-decoration:none !important;}
.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
.syntaxhighlighter.printing .preprocessor{color:gray !important;}
.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
.syntaxhighlighter.printing .value{color:#009900 !important;}
.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
.syntaxhighlighter.printing .constants{color:#0066cc !important;}
.syntaxhighlighter.printing .script{font-weight:bold !important;}
.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
.syntaxhighlighter{background-color:#0a2b1d !important;}
.syntaxhighlighter .line.alt1{background-color:#0a2b1d !important;}
.syntaxhighlighter .line.alt2{background-color:#0a2b1d !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#233729 !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:#f8f8f8 !important;}
.syntaxhighlighter .gutter{color:#497958 !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #41a83e !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#41a83e !important;color:#0a2b1d !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#96dd3b !important;background:black !important;border:1px solid #41a83e !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#96dd3b !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:white !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#41a83e !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:#ffe862 !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#f8f8f8 !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#336442 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#9df39f !important;}
.syntaxhighlighter .keyword{color:#96dd3b !important;}
.syntaxhighlighter .preprocessor{color:#91bb9e !important;}
.syntaxhighlighter .variable{color:#ffaa3e !important;}
.syntaxhighlighter .value{color:#f7e741 !important;}
.syntaxhighlighter .functions{color:#ffaa3e !important;}
.syntaxhighlighter .constants{color:#e0e8ff !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#96dd3b !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#eb939a !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#91bb9e !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#edef7d !important;}
.syntaxhighlighter .comments{font-style:italic !important;}
.syntaxhighlighter .keyword{font-weight:bold !important;}

View File

@ -0,0 +1,80 @@
.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
.syntaxhighlighter.source{overflow:hidden !important;}
.syntaxhighlighter .bold{font-weight:bold !important;}
.syntaxhighlighter .italic{font-style:italic !important;}
.syntaxhighlighter .line{white-space:pre !important;}
.syntaxhighlighter table{width:100% !important;}
.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
.syntaxhighlighter table td.code{width:100% !important;}
.syntaxhighlighter table td.code .container{position:relative !important;}
.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
.syntaxhighlighter table td.code .line{padding:0 1em !important;}
.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
.syntaxhighlighter.show{display:block !important;}
.syntaxhighlighter.collapsed table{display:none !important;}
.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
.syntaxhighlighter .toolbar span.title{display:inline !important;}
.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
.syntaxhighlighter.printing .line .content{color:black !important;}
.syntaxhighlighter.printing .toolbar{display:none !important;}
.syntaxhighlighter.printing a{text-decoration:none !important;}
.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
.syntaxhighlighter.printing .preprocessor{color:gray !important;}
.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
.syntaxhighlighter.printing .value{color:#009900 !important;}
.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
.syntaxhighlighter.printing .constants{color:#0066cc !important;}
.syntaxhighlighter.printing .script{font-weight:bold !important;}
.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
.syntaxhighlighter{background-color:white !important;}
.syntaxhighlighter .line.alt1{background-color:white !important;}
.syntaxhighlighter .line.alt2{background-color:white !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#c3defe !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:black !important;}
.syntaxhighlighter .gutter{color:#787878 !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #d4d0c8 !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#d4d0c8 !important;color:white !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#3f5fbf !important;background:white !important;border:1px solid #d4d0c8 !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#3f5fbf !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#aa7700 !important;}
.syntaxhighlighter .toolbar{color:#a0a0a0 !important;background:#d4d0c8 !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:#a0a0a0 !important;}
.syntaxhighlighter .toolbar a:hover{color:red !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#3f5fbf !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#2a00ff !important;}
.syntaxhighlighter .keyword{color:#7f0055 !important;}
.syntaxhighlighter .preprocessor{color:#646464 !important;}
.syntaxhighlighter .variable{color:#aa7700 !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#ff1493 !important;}
.syntaxhighlighter .constants{color:#0066cc !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#7f0055 !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
.syntaxhighlighter .keyword{font-weight:bold !important;}
.syntaxhighlighter .xml .keyword{color:#3f7f7f !important;font-weight:normal !important;}
.syntaxhighlighter .xml .color1,.syntaxhighlighter .xml .color1 a{color:#7f007f !important;}
.syntaxhighlighter .xml .string{font-style:italic !important;color:#2a00ff !important;}

View File

@ -0,0 +1,76 @@
.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
.syntaxhighlighter.source{overflow:hidden !important;}
.syntaxhighlighter .bold{font-weight:bold !important;}
.syntaxhighlighter .italic{font-style:italic !important;}
.syntaxhighlighter .line{white-space:pre !important;}
.syntaxhighlighter table{width:100% !important;}
.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
.syntaxhighlighter table td.code{width:100% !important;}
.syntaxhighlighter table td.code .container{position:relative !important;}
.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
.syntaxhighlighter table td.code .line{padding:0 1em !important;}
.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
.syntaxhighlighter.show{display:block !important;}
.syntaxhighlighter.collapsed table{display:none !important;}
.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
.syntaxhighlighter .toolbar span.title{display:inline !important;}
.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
.syntaxhighlighter.printing .line .content{color:black !important;}
.syntaxhighlighter.printing .toolbar{display:none !important;}
.syntaxhighlighter.printing a{text-decoration:none !important;}
.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
.syntaxhighlighter.printing .preprocessor{color:gray !important;}
.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
.syntaxhighlighter.printing .value{color:#009900 !important;}
.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
.syntaxhighlighter.printing .constants{color:#0066cc !important;}
.syntaxhighlighter.printing .script{font-weight:bold !important;}
.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
.syntaxhighlighter{background-color:black !important;}
.syntaxhighlighter .line.alt1{background-color:black !important;}
.syntaxhighlighter .line.alt2{background-color:black !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2a3133 !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:#d3d3d3 !important;}
.syntaxhighlighter .gutter{color:#d3d3d3 !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #990000 !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#990000 !important;color:black !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#ebdb8d !important;background:black !important;border:1px solid #990000 !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#ebdb8d !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#ff7d27 !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#990000 !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d3d3d3 !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#ff7d27 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#ff9e7b !important;}
.syntaxhighlighter .keyword{color:aqua !important;}
.syntaxhighlighter .preprocessor{color:#aec4de !important;}
.syntaxhighlighter .variable{color:#ffaa3e !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#81cef9 !important;}
.syntaxhighlighter .constants{color:#ff9e7b !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:aqua !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ebdb8d !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff7d27 !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#aec4de !important;}

View File

@ -0,0 +1,77 @@
.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
.syntaxhighlighter.source{overflow:hidden !important;}
.syntaxhighlighter .bold{font-weight:bold !important;}
.syntaxhighlighter .italic{font-style:italic !important;}
.syntaxhighlighter .line{white-space:pre !important;}
.syntaxhighlighter table{width:100% !important;}
.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
.syntaxhighlighter table td.code{width:100% !important;}
.syntaxhighlighter table td.code .container{position:relative !important;}
.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
.syntaxhighlighter table td.code .line{padding:0 1em !important;}
.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
.syntaxhighlighter.show{display:block !important;}
.syntaxhighlighter.collapsed table{display:none !important;}
.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
.syntaxhighlighter .toolbar span.title{display:inline !important;}
.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
.syntaxhighlighter.printing .line .content{color:black !important;}
.syntaxhighlighter.printing .toolbar{display:none !important;}
.syntaxhighlighter.printing a{text-decoration:none !important;}
.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
.syntaxhighlighter.printing .preprocessor{color:gray !important;}
.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
.syntaxhighlighter.printing .value{color:#009900 !important;}
.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
.syntaxhighlighter.printing .constants{color:#0066cc !important;}
.syntaxhighlighter.printing .script{font-weight:bold !important;}
.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
.syntaxhighlighter{background-color:#121212 !important;}
.syntaxhighlighter .line.alt1{background-color:#121212 !important;}
.syntaxhighlighter .line.alt2{background-color:#121212 !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2c2c29 !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:white !important;}
.syntaxhighlighter .gutter{color:#afafaf !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #3185b9 !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#3185b9 !important;color:#121212 !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#3185b9 !important;background:black !important;border:1px solid #3185b9 !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#3185b9 !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#d01d33 !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#3185b9 !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:#96daff !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:white !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#696854 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#e3e658 !important;}
.syntaxhighlighter .keyword{color:#d01d33 !important;}
.syntaxhighlighter .preprocessor{color:#435a5f !important;}
.syntaxhighlighter .variable{color:#898989 !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#aaaaaa !important;}
.syntaxhighlighter .constants{color:#96daff !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#d01d33 !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ffc074 !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#4a8cdb !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#96daff !important;}
.syntaxhighlighter .functions{font-weight:bold !important;}

View File

@ -0,0 +1,76 @@
.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
.syntaxhighlighter.source{overflow:hidden !important;}
.syntaxhighlighter .bold{font-weight:bold !important;}
.syntaxhighlighter .italic{font-style:italic !important;}
.syntaxhighlighter .line{white-space:pre !important;}
.syntaxhighlighter table{width:100% !important;}
.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
.syntaxhighlighter table td.code{width:100% !important;}
.syntaxhighlighter table td.code .container{position:relative !important;}
.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
.syntaxhighlighter table td.code .line{padding:0 1em !important;}
.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
.syntaxhighlighter.show{display:block !important;}
.syntaxhighlighter.collapsed table{display:none !important;}
.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
.syntaxhighlighter .toolbar span.title{display:inline !important;}
.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
.syntaxhighlighter.printing .line .content{color:black !important;}
.syntaxhighlighter.printing .toolbar{display:none !important;}
.syntaxhighlighter.printing a{text-decoration:none !important;}
.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
.syntaxhighlighter.printing .preprocessor{color:gray !important;}
.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
.syntaxhighlighter.printing .value{color:#009900 !important;}
.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
.syntaxhighlighter.printing .constants{color:#0066cc !important;}
.syntaxhighlighter.printing .script{font-weight:bold !important;}
.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
.syntaxhighlighter{background-color:#222222 !important;}
.syntaxhighlighter .line.alt1{background-color:#222222 !important;}
.syntaxhighlighter .line.alt2{background-color:#222222 !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:lime !important;}
.syntaxhighlighter .gutter{color:#38566f !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#222222 !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:lime !important;}
.syntaxhighlighter .toolbar{color:#aaaaff !important;background:#435a5f !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:#aaaaff !important;}
.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:lime !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:lime !important;}
.syntaxhighlighter .keyword{color:#aaaaff !important;}
.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
.syntaxhighlighter .variable{color:aqua !important;}
.syntaxhighlighter .value{color:#f7e741 !important;}
.syntaxhighlighter .functions{color:#ff8000 !important;}
.syntaxhighlighter .constants{color:yellow !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#aaaaff !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:red !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:yellow !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}

View File

@ -0,0 +1,76 @@
.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
.syntaxhighlighter.source{overflow:hidden !important;}
.syntaxhighlighter .bold{font-weight:bold !important;}
.syntaxhighlighter .italic{font-style:italic !important;}
.syntaxhighlighter .line{white-space:pre !important;}
.syntaxhighlighter table{width:100% !important;}
.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
.syntaxhighlighter table td.code{width:100% !important;}
.syntaxhighlighter table td.code .container{position:relative !important;}
.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
.syntaxhighlighter table td.code .line{padding:0 1em !important;}
.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
.syntaxhighlighter.show{display:block !important;}
.syntaxhighlighter.collapsed table{display:none !important;}
.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
.syntaxhighlighter .toolbar span.title{display:inline !important;}
.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
.syntaxhighlighter.printing .line .content{color:black !important;}
.syntaxhighlighter.printing .toolbar{display:none !important;}
.syntaxhighlighter.printing a{text-decoration:none !important;}
.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
.syntaxhighlighter.printing .preprocessor{color:gray !important;}
.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
.syntaxhighlighter.printing .value{color:#009900 !important;}
.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
.syntaxhighlighter.printing .constants{color:#0066cc !important;}
.syntaxhighlighter.printing .script{font-weight:bold !important;}
.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
.syntaxhighlighter{background-color:#0f192a !important;}
.syntaxhighlighter .line.alt1{background-color:#0f192a !important;}
.syntaxhighlighter .line.alt2{background-color:#0f192a !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
.syntaxhighlighter .line.highlighted.number{color:#38566f !important;}
.syntaxhighlighter table caption{color:#d1edff !important;}
.syntaxhighlighter .gutter{color:#afafaf !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#0f192a !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#1dc116 !important;}
.syntaxhighlighter .toolbar{color:#d1edff !important;background:#435a5f !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:#d1edff !important;}
.syntaxhighlighter .toolbar a:hover{color:#8aa6c1 !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d1edff !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#1dc116 !important;}
.syntaxhighlighter .keyword{color:#b43d3d !important;}
.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
.syntaxhighlighter .variable{color:#ffaa3e !important;}
.syntaxhighlighter .value{color:#f7e741 !important;}
.syntaxhighlighter .functions{color:#ffaa3e !important;}
.syntaxhighlighter .constants{color:#e0e8ff !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#b43d3d !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#f8bb00 !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}

View File

@ -0,0 +1,76 @@
.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
.syntaxhighlighter.source{overflow:hidden !important;}
.syntaxhighlighter .bold{font-weight:bold !important;}
.syntaxhighlighter .italic{font-style:italic !important;}
.syntaxhighlighter .line{white-space:pre !important;}
.syntaxhighlighter table{width:100% !important;}
.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
.syntaxhighlighter table td.code{width:100% !important;}
.syntaxhighlighter table td.code .container{position:relative !important;}
.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
.syntaxhighlighter table td.code .line{padding:0 1em !important;}
.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
.syntaxhighlighter.show{display:block !important;}
.syntaxhighlighter.collapsed table{display:none !important;}
.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
.syntaxhighlighter .toolbar span.title{display:inline !important;}
.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
.syntaxhighlighter.printing .line .content{color:black !important;}
.syntaxhighlighter.printing .toolbar{display:none !important;}
.syntaxhighlighter.printing a{text-decoration:none !important;}
.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
.syntaxhighlighter.printing .preprocessor{color:gray !important;}
.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
.syntaxhighlighter.printing .value{color:#009900 !important;}
.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
.syntaxhighlighter.printing .constants{color:#0066cc !important;}
.syntaxhighlighter.printing .script{font-weight:bold !important;}
.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
.syntaxhighlighter{background-color:#1b2426 !important;}
.syntaxhighlighter .line.alt1{background-color:#1b2426 !important;}
.syntaxhighlighter .line.alt2{background-color:#1b2426 !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#323e41 !important;}
.syntaxhighlighter .line.highlighted.number{color:#b9bdb6 !important;}
.syntaxhighlighter table caption{color:#b9bdb6 !important;}
.syntaxhighlighter .gutter{color:#afafaf !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#1b2426 !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#5ba1cf !important;background:black !important;border:1px solid #435a5f !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#5ba1cf !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#5ce638 !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#435a5f !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:#e0e8ff !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#b9bdb6 !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#878a85 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#5ce638 !important;}
.syntaxhighlighter .keyword{color:#5ba1cf !important;}
.syntaxhighlighter .preprocessor{color:#435a5f !important;}
.syntaxhighlighter .variable{color:#ffaa3e !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#ffaa3e !important;}
.syntaxhighlighter .constants{color:#e0e8ff !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#5ba1cf !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#e0e8ff !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}

View File

@ -0,0 +1,21 @@
.syntaxhighlighter.applescript{background:white;font-size:1em;color:black;}
.syntaxhighlighter.applescript div,.syntaxhighlighter.applescript code{font:1em/1.25 Verdana,sans-serif !important;}
.syntaxhighlighter.applescript .code .line{overflow:hidden !important;}
.syntaxhighlighter.applescript .code .line.highlighted{background:#b5d5ff !important;}
.syntaxhighlighter.applescript .color1{color:#000000 !important;}
.syntaxhighlighter.applescript .color2{color:#000000 !important;}
.syntaxhighlighter.applescript .color3{color:#000000 !important;font-weight:bold !important;}
.syntaxhighlighter.applescript .keyword{color:#000000 !important;font-weight:bold !important;}
.syntaxhighlighter.applescript .color4{color:#0000ff !important;font-style:italic !important;}
.syntaxhighlighter.applescript .comments{color:#4c4d4d !important;}
.syntaxhighlighter.applescript .plain{color:#408000 !important;}
.syntaxhighlighter.applescript .string{color:#000000 !important;}
.syntaxhighlighter.applescript .commandNames{color:#0000ff !important;font-weight:bold !important;}
.syntaxhighlighter.applescript .parameterNames{color:#0000ff !important;}
.syntaxhighlighter.applescript .classes{color:#0000ff !important;font-style:italic !important;}
.syntaxhighlighter.applescript .properties{color:#6c04d4 !important;}
.syntaxhighlighter.applescript .enumeratedValues{color:#4a1e7f !important;}
.syntaxhighlighter.applescript .additionCommandNames{color:#0016b0 !important;font-weight:bold !important;}
.syntaxhighlighter.applescript .additionParameterNames{color:#0016b0 !important;}
.syntaxhighlighter.applescript .additionClasses{color:#0016b0 !important;font-style:italic !important;}
.syntaxhighlighter.applescript .spaces{display:inline-block;height:0 !important;font-size:1.75em !important;line-height:0 !important;}

View File

@ -0,0 +1,31 @@
.syntaxhighlighter{background-color:white !important;}
.syntaxhighlighter .line.alt1{background-color:white !important;}
.syntaxhighlighter .line.alt2{background-color:white !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;}
.syntaxhighlighter .line.highlighted.number{color:black !important;}
.syntaxhighlighter table caption{color:black !important;}
.syntaxhighlighter .gutter{color:#afafaf !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;}
.syntaxhighlighter.collapsed .toolbar a{color:blue !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:black !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:blue !important;}
.syntaxhighlighter .keyword{color:#006699 !important;}
.syntaxhighlighter .preprocessor{color:gray !important;}
.syntaxhighlighter .variable{color:#aa7700 !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#ff1493 !important;}
.syntaxhighlighter .constants{color:#0066cc !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
.syntaxhighlighter .keyword{font-weight:bold !important;}

View File

@ -0,0 +1,32 @@
.syntaxhighlighter{background-color:#0a2b1d !important;}
.syntaxhighlighter .line.alt1{background-color:#0a2b1d !important;}
.syntaxhighlighter .line.alt2{background-color:#0a2b1d !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#233729 !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:#f8f8f8 !important;}
.syntaxhighlighter .gutter{color:#497958 !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #41a83e !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#41a83e !important;color:#0a2b1d !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#96dd3b !important;background:black !important;border:1px solid #41a83e !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#96dd3b !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:white !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#41a83e !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:#ffe862 !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#f8f8f8 !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#336442 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#9df39f !important;}
.syntaxhighlighter .keyword{color:#96dd3b !important;}
.syntaxhighlighter .preprocessor{color:#91bb9e !important;}
.syntaxhighlighter .variable{color:#ffaa3e !important;}
.syntaxhighlighter .value{color:#f7e741 !important;}
.syntaxhighlighter .functions{color:#ffaa3e !important;}
.syntaxhighlighter .constants{color:#e0e8ff !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#96dd3b !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#eb939a !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#91bb9e !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#edef7d !important;}
.syntaxhighlighter .comments{font-style:italic !important;}
.syntaxhighlighter .keyword{font-weight:bold !important;}

View File

@ -0,0 +1,34 @@
.syntaxhighlighter{background-color:white !important;}
.syntaxhighlighter .line.alt1{background-color:white !important;}
.syntaxhighlighter .line.alt2{background-color:white !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#c3defe !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:black !important;}
.syntaxhighlighter .gutter{color:#787878 !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #d4d0c8 !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#d4d0c8 !important;color:white !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#3f5fbf !important;background:white !important;border:1px solid #d4d0c8 !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#3f5fbf !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#aa7700 !important;}
.syntaxhighlighter .toolbar{color:#a0a0a0 !important;background:#d4d0c8 !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:#a0a0a0 !important;}
.syntaxhighlighter .toolbar a:hover{color:red !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#3f5fbf !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#2a00ff !important;}
.syntaxhighlighter .keyword{color:#7f0055 !important;}
.syntaxhighlighter .preprocessor{color:#646464 !important;}
.syntaxhighlighter .variable{color:#aa7700 !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#ff1493 !important;}
.syntaxhighlighter .constants{color:#0066cc !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#7f0055 !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
.syntaxhighlighter .keyword{font-weight:bold !important;}
.syntaxhighlighter .xml .keyword{color:#3f7f7f !important;font-weight:normal !important;}
.syntaxhighlighter .xml .color1,.syntaxhighlighter .xml .color1 a{color:#7f007f !important;}
.syntaxhighlighter .xml .string{font-style:italic !important;color:#2a00ff !important;}

View File

@ -0,0 +1,30 @@
.syntaxhighlighter{background-color:black !important;}
.syntaxhighlighter .line.alt1{background-color:black !important;}
.syntaxhighlighter .line.alt2{background-color:black !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2a3133 !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:#d3d3d3 !important;}
.syntaxhighlighter .gutter{color:#d3d3d3 !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #990000 !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#990000 !important;color:black !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#ebdb8d !important;background:black !important;border:1px solid #990000 !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#ebdb8d !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#ff7d27 !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#990000 !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d3d3d3 !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#ff7d27 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#ff9e7b !important;}
.syntaxhighlighter .keyword{color:aqua !important;}
.syntaxhighlighter .preprocessor{color:#aec4de !important;}
.syntaxhighlighter .variable{color:#ffaa3e !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#81cef9 !important;}
.syntaxhighlighter .constants{color:#ff9e7b !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:aqua !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ebdb8d !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff7d27 !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#aec4de !important;}

View File

@ -0,0 +1,31 @@
.syntaxhighlighter{background-color:#121212 !important;}
.syntaxhighlighter .line.alt1{background-color:#121212 !important;}
.syntaxhighlighter .line.alt2{background-color:#121212 !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2c2c29 !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:white !important;}
.syntaxhighlighter .gutter{color:#afafaf !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #3185b9 !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#3185b9 !important;color:#121212 !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#3185b9 !important;background:black !important;border:1px solid #3185b9 !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#3185b9 !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#d01d33 !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#3185b9 !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:#96daff !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:white !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#696854 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#e3e658 !important;}
.syntaxhighlighter .keyword{color:#d01d33 !important;}
.syntaxhighlighter .preprocessor{color:#435a5f !important;}
.syntaxhighlighter .variable{color:#898989 !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#aaaaaa !important;}
.syntaxhighlighter .constants{color:#96daff !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#d01d33 !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ffc074 !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#4a8cdb !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#96daff !important;}
.syntaxhighlighter .functions{font-weight:bold !important;}

View File

@ -0,0 +1,30 @@
.syntaxhighlighter{background-color:#222222 !important;}
.syntaxhighlighter .line.alt1{background-color:#222222 !important;}
.syntaxhighlighter .line.alt2{background-color:#222222 !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:lime !important;}
.syntaxhighlighter .gutter{color:#38566f !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#222222 !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:lime !important;}
.syntaxhighlighter .toolbar{color:#aaaaff !important;background:#435a5f !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:#aaaaff !important;}
.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:lime !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:lime !important;}
.syntaxhighlighter .keyword{color:#aaaaff !important;}
.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
.syntaxhighlighter .variable{color:aqua !important;}
.syntaxhighlighter .value{color:#f7e741 !important;}
.syntaxhighlighter .functions{color:#ff8000 !important;}
.syntaxhighlighter .constants{color:yellow !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#aaaaff !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:red !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:yellow !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}

View File

@ -0,0 +1,30 @@
.syntaxhighlighter{background-color:#0f192a !important;}
.syntaxhighlighter .line.alt1{background-color:#0f192a !important;}
.syntaxhighlighter .line.alt2{background-color:#0f192a !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
.syntaxhighlighter .line.highlighted.number{color:#38566f !important;}
.syntaxhighlighter table caption{color:#d1edff !important;}
.syntaxhighlighter .gutter{color:#afafaf !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#0f192a !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#1dc116 !important;}
.syntaxhighlighter .toolbar{color:#d1edff !important;background:#435a5f !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:#d1edff !important;}
.syntaxhighlighter .toolbar a:hover{color:#8aa6c1 !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d1edff !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#1dc116 !important;}
.syntaxhighlighter .keyword{color:#b43d3d !important;}
.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
.syntaxhighlighter .variable{color:#ffaa3e !important;}
.syntaxhighlighter .value{color:#f7e741 !important;}
.syntaxhighlighter .functions{color:#ffaa3e !important;}
.syntaxhighlighter .constants{color:#e0e8ff !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#b43d3d !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#f8bb00 !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}

View File

@ -0,0 +1,30 @@
.syntaxhighlighter{background-color:#1b2426 !important;}
.syntaxhighlighter .line.alt1{background-color:#1b2426 !important;}
.syntaxhighlighter .line.alt2{background-color:#1b2426 !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#323e41 !important;}
.syntaxhighlighter .line.highlighted.number{color:#b9bdb6 !important;}
.syntaxhighlighter table caption{color:#b9bdb6 !important;}
.syntaxhighlighter .gutter{color:#afafaf !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#1b2426 !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#5ba1cf !important;background:black !important;border:1px solid #435a5f !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#5ba1cf !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:#5ce638 !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#435a5f !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:#e0e8ff !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#b9bdb6 !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#878a85 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#5ce638 !important;}
.syntaxhighlighter .keyword{color:#5ba1cf !important;}
.syntaxhighlighter .preprocessor{color:#435a5f !important;}
.syntaxhighlighter .variable{color:#ffaa3e !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#ffaa3e !important;}
.syntaxhighlighter .constants{color:#e0e8ff !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#5ba1cf !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#e0e8ff !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}

View File

@ -0,0 +1,31 @@
.syntaxhighlighter{background-color:white !important;}
.syntaxhighlighter .line.alt1{background-color:white !important;}
.syntaxhighlighter .line.alt2{background-color:white !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;}
.syntaxhighlighter .line.highlighted.number{color:black !important;}
.syntaxhighlighter table caption{color:black !important;}
.syntaxhighlighter .gutter{color:#afafaf !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;}
.syntaxhighlighter.collapsed .toolbar a{color:blue !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:black !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#d11010 !important;}
.syntaxhighlighter .keyword{color:#006699 !important;}
.syntaxhighlighter .preprocessor{color:gray !important;}
.syntaxhighlighter .variable{color:#aa7700 !important;}
.syntaxhighlighter .value{color:#009900 !important;}
.syntaxhighlighter .functions{color:#ff1493 !important;}
.syntaxhighlighter .constants{color:#0066cc !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
.syntaxhighlighter .keyword{font-weight:bold !important;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

View File

@ -0,0 +1,148 @@
<?php
/**
* EasyPeasyICS Simple ICS/vCal data generator.
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
* @author Manuel Reinhard <manu@sprain.ch>
*
* Built with inspiration from
* http://stackoverflow.com/questions/1463480/how-can-i-use-php-to-dynamically-publish-an-ical-file-to-be-read-by-google-calend/1464355#1464355
* History:
* 2010/12/17 - Manuel Reinhard - when it all started
* 2014 PHPMailer project becomes maintainer
*/
/**
* Class EasyPeasyICS.
* Simple ICS data generator
* @package phpmailer
* @subpackage easypeasyics
*/
class EasyPeasyICS
{
/**
* The name of the calendar
* @var string
*/
protected $calendarName;
/**
* The array of events to add to this calendar
* @var array
*/
protected $events = array();
/**
* Constructor
* @param string $calendarName
*/
public function __construct($calendarName = "")
{
$this->calendarName = $calendarName;
}
/**
* Add an event to this calendar.
* @param string $start The start date and time as a unix timestamp
* @param string $end The end date and time as a unix timestamp
* @param string $summary A summary or title for the event
* @param string $description A description of the event
* @param string $url A URL for the event
* @param string $uid A unique identifier for the event - generated automatically if not provided
* @return array An array of event details, including any generated UID
*/
public function addEvent($start, $end, $summary = '', $description = '', $url = '', $uid = '')
{
if (empty($uid)) {
$uid = md5(uniqid(mt_rand(), true)) . '@EasyPeasyICS';
}
$event = array(
'start' => gmdate('Ymd', $start) . 'T' . gmdate('His', $start) . 'Z',
'end' => gmdate('Ymd', $end) . 'T' . gmdate('His', $end) . 'Z',
'summary' => $summary,
'description' => $description,
'url' => $url,
'uid' => $uid
);
$this->events[] = $event;
return $event;
}
/**
* @return array Get the array of events.
*/
public function getEvents()
{
return $this->events;
}
/**
* Clear all events.
*/
public function clearEvents()
{
$this->events = array();
}
/**
* Get the name of the calendar.
* @return string
*/
public function getName()
{
return $this->calendarName;
}
/**
* Set the name of the calendar.
* @param $name
*/
public function setName($name)
{
$this->calendarName = $name;
}
/**
* Render and optionally output a vcal string.
* @param bool $output Whether to output the calendar data directly (the default).
* @return string The complete rendered vlal
*/
public function render($output = true)
{
//Add header
$ics = 'BEGIN:VCALENDAR
METHOD:PUBLISH
VERSION:2.0
X-WR-CALNAME:' . $this->calendarName . '
PRODID:-//hacksw/handcal//NONSGML v1.0//EN';
//Add events
foreach ($this->events as $event) {
$ics .= '
BEGIN:VEVENT
UID:' . $event['uid'] . '
DTSTAMP:' . gmdate('Ymd') . 'T' . gmdate('His') . 'Z
DTSTART:' . $event['start'] . '
DTEND:' . $event['end'] . '
SUMMARY:' . str_replace("\n", "\\n", $event['summary']) . '
DESCRIPTION:' . str_replace("\n", "\\n", $event['description']) . '
URL;VALUE=URI:' . $event['url'] . '
END:VEVENT';
}
//Add footer
$ics .= '
END:VCALENDAR';
if ($output) {
//Output
$filename = $this->calendarName;
//Filename needs quoting if it contains spaces
if (strpos($filename, ' ') !== false) {
$filename = '"'.$filename.'"';
}
header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename=' . $filename . '.ics');
echo $ics;
}
return $ics;
}
}

17
lib/vendor/PHPMailer/extras/README.md vendored Normal file
View File

@ -0,0 +1,17 @@
# PHPMailer Extras
These classes provide optional additional functions to PHPMailer.
These are not loaded by the PHPMailer autoloader, so in some cases you may need to `require` them yourself before using them.
## EasyPeasyICS
This class was originally written by Manuel Reinhard and provides a simple means of generating ICS/vCal files that are used in sending calendar events. PHPMailer does not use it directly, but you can use it to generate content appropriate for placing in the `Ical` property of PHPMailer. The PHPMailer project is now its official home as Manuel has given permission for that and is no longer maintaining it himself.
## htmlfilter
This class by Konstantin Riabitsev and Jim Jagielski implements HTML filtering to remove potentially malicious tags, such as `<script>` or `onclick=` attributes that can result in XSS attacks. This is a simple filter and is not as comprehensive as [HTMLawed](http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/) or [HTMLPurifier](http://htmlpurifier.org), but it's easier to use and considerably better than nothing! PHPMailer does not use it directly, but you may want to apply it to user-supplied HTML before using it as a message body.
## NTLM_SASL_client
This class by Manuel Lemos (bundled with permission) adds the ability to authenticate with Microsoft Windows mail servers that use NTLM-based authentication. It is used by PHPMailer if you send via SMTP and set the `AuthType` property to `NTLM`; you will also need to use the `Realm` and `Workstation` properties. The original source is [here](http://www.phpclasses.org/browse/file/7495.html).

1159
lib/vendor/PHPMailer/extras/htmlfilter.php vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,185 @@
<?php
/*
* ntlm_sasl_client.php
*
* @(#) $Id: ntlm_sasl_client.php,v 1.3 2004/11/17 08:00:37 mlemos Exp $
*
*/
define("SASL_NTLM_STATE_START", 0);
define("SASL_NTLM_STATE_IDENTIFY_DOMAIN", 1);
define("SASL_NTLM_STATE_RESPOND_CHALLENGE", 2);
define("SASL_NTLM_STATE_DONE", 3);
define("SASL_FAIL", -1);
define("SASL_CONTINUE", 1);
class ntlm_sasl_client_class
{
public $credentials = array();
public $state = SASL_NTLM_STATE_START;
public function initialize(&$client)
{
if (!function_exists($function = "mcrypt_encrypt")
|| !function_exists($function = "mhash")
) {
$extensions = array(
"mcrypt_encrypt" => "mcrypt",
"mhash" => "mhash"
);
$client->error = "the extension " . $extensions[$function] .
" required by the NTLM SASL client class is not available in this PHP configuration";
return (0);
}
return (1);
}
public function ASCIIToUnicode($ascii)
{
for ($unicode = "", $a = 0; $a < strlen($ascii); $a++) {
$unicode .= substr($ascii, $a, 1) . chr(0);
}
return ($unicode);
}
public function typeMsg1($domain, $workstation)
{
$domain_length = strlen($domain);
$workstation_length = strlen($workstation);
$workstation_offset = 32;
$domain_offset = $workstation_offset + $workstation_length;
return (
"NTLMSSP\0" .
"\x01\x00\x00\x00" .
"\x07\x32\x00\x00" .
pack("v", $domain_length) .
pack("v", $domain_length) .
pack("V", $domain_offset) .
pack("v", $workstation_length) .
pack("v", $workstation_length) .
pack("V", $workstation_offset) .
$workstation .
$domain
);
}
public function NTLMResponse($challenge, $password)
{
$unicode = $this->ASCIIToUnicode($password);
$md4 = mhash(MHASH_MD4, $unicode);
$padded = $md4 . str_repeat(chr(0), 21 - strlen($md4));
$iv_size = mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
for ($response = "", $third = 0; $third < 21; $third += 7) {
for ($packed = "", $p = $third; $p < $third + 7; $p++) {
$packed .= str_pad(decbin(ord(substr($padded, $p, 1))), 8, "0", STR_PAD_LEFT);
}
for ($key = "", $p = 0; $p < strlen($packed); $p += 7) {
$s = substr($packed, $p, 7);
$b = $s . ((substr_count($s, "1") % 2) ? "0" : "1");
$key .= chr(bindec($b));
}
$ciphertext = mcrypt_encrypt(MCRYPT_DES, $key, $challenge, MCRYPT_MODE_ECB, $iv);
$response .= $ciphertext;
}
return $response;
}
public function typeMsg3($ntlm_response, $user, $domain, $workstation)
{
$domain_unicode = $this->ASCIIToUnicode($domain);
$domain_length = strlen($domain_unicode);
$domain_offset = 64;
$user_unicode = $this->ASCIIToUnicode($user);
$user_length = strlen($user_unicode);
$user_offset = $domain_offset + $domain_length;
$workstation_unicode = $this->ASCIIToUnicode($workstation);
$workstation_length = strlen($workstation_unicode);
$workstation_offset = $user_offset + $user_length;
$lm = "";
$lm_length = strlen($lm);
$lm_offset = $workstation_offset + $workstation_length;
$ntlm = $ntlm_response;
$ntlm_length = strlen($ntlm);
$ntlm_offset = $lm_offset + $lm_length;
$session = "";
$session_length = strlen($session);
$session_offset = $ntlm_offset + $ntlm_length;
return (
"NTLMSSP\0" .
"\x03\x00\x00\x00" .
pack("v", $lm_length) .
pack("v", $lm_length) .
pack("V", $lm_offset) .
pack("v", $ntlm_length) .
pack("v", $ntlm_length) .
pack("V", $ntlm_offset) .
pack("v", $domain_length) .
pack("v", $domain_length) .
pack("V", $domain_offset) .
pack("v", $user_length) .
pack("v", $user_length) .
pack("V", $user_offset) .
pack("v", $workstation_length) .
pack("v", $workstation_length) .
pack("V", $workstation_offset) .
pack("v", $session_length) .
pack("v", $session_length) .
pack("V", $session_offset) .
"\x01\x02\x00\x00" .
$domain_unicode .
$user_unicode .
$workstation_unicode .
$lm .
$ntlm
);
}
public function start(&$client, &$message, &$interactions)
{
if ($this->state != SASL_NTLM_STATE_START) {
$client->error = "NTLM authentication state is not at the start";
return (SASL_FAIL);
}
$this->credentials = array(
"user" => "",
"password" => "",
"realm" => "",
"workstation" => ""
);
$defaults = array();
$status = $client->GetCredentials($this->credentials, $defaults, $interactions);
if ($status == SASL_CONTINUE) {
$this->state = SASL_NTLM_STATE_IDENTIFY_DOMAIN;
}
unset($message);
return ($status);
}
public function step(&$client, $response, &$message, &$interactions)
{
switch ($this->state) {
case SASL_NTLM_STATE_IDENTIFY_DOMAIN:
$message = $this->typeMsg1($this->credentials["realm"], $this->credentials["workstation"]);
$this->state = SASL_NTLM_STATE_RESPOND_CHALLENGE;
break;
case SASL_NTLM_STATE_RESPOND_CHALLENGE:
$ntlm_response = $this->NTLMResponse(substr($response, 24, 8), $this->credentials["password"]);
$message = $this->typeMsg3(
$ntlm_response,
$this->credentials["user"],
$this->credentials["realm"],
$this->credentials["workstation"]
);
$this->state = SASL_NTLM_STATE_DONE;
break;
case SASL_NTLM_STATE_DONE:
$client->error = "NTLM authentication was finished without success";
return (SASL_FAIL);
default:
$client->error = "invalid NTLM authentication step state";
return (SASL_FAIL);
}
return (SASL_CONTINUE);
}
}

162
lib/vendor/PHPMailer/get_oauth_token.php vendored Normal file
View File

@ -0,0 +1,162 @@
<?php
/**
* Get an OAuth2 token from Google.
* * Install this script on your server so that it's accessible
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
* e.g.: http://localhost/phpmail/get_oauth_token.php
* * Ensure dependencies are installed with 'composer install'
* * Set up an app in your Google developer console
* * Set the script address as the app's redirect URL
* If no refresh token is obtained when running this file, revoke access to your app
* using link: https://accounts.google.com/b/0/IssuedAuthSubTokens and run the script again.
* This script requires PHP 5.4 or later
* PHP Version 5.4
*/
namespace League\OAuth2\Client\Provider;
require 'vendor/autoload.php';
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
use League\OAuth2\Client\Token\AccessToken;
use League\OAuth2\Client\Tool\BearerAuthorizationTrait;
use Psr\Http\Message\ResponseInterface;
session_start();
//If this automatic URL doesn't work, set it yourself manually
$redirectUri = isset($_SERVER['HTTPS']) ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
//$redirectUri = 'http://localhost/phpmailer/get_oauth_token.php';
//These details obtained are by setting up app in Google developer console.
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
class Google extends AbstractProvider
{
use BearerAuthorizationTrait;
const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'id';
/**
* @var string If set, this will be sent to google as the "access_type" parameter.
* @link https://developers.google.com/accounts/docs/OAuth2WebServer#offline
*/
protected $accessType;
/**
* @var string If set, this will be sent to google as the "hd" parameter.
* @link https://developers.google.com/accounts/docs/OAuth2Login#hd-param
*/
protected $hostedDomain;
/**
* @var string If set, this will be sent to google as the "scope" parameter.
* @link https://developers.google.com/gmail/api/auth/scopes
*/
protected $scope;
public function getBaseAuthorizationUrl()
{
return 'https://accounts.google.com/o/oauth2/auth';
}
public function getBaseAccessTokenUrl(array $params)
{
return 'https://accounts.google.com/o/oauth2/token';
}
public function getResourceOwnerDetailsUrl(AccessToken $token)
{
return ' ';
}
protected function getAuthorizationParameters(array $options)
{
if (is_array($this->scope)) {
$separator = $this->getScopeSeparator();
$this->scope = implode($separator, $this->scope);
}
$params = array_merge(
parent::getAuthorizationParameters($options),
array_filter([
'hd' => $this->hostedDomain,
'access_type' => $this->accessType,
'scope' => $this->scope,
// if the user is logged in with more than one account ask which one to use for the login!
'authuser' => '-1'
])
);
return $params;
}
protected function getDefaultScopes()
{
return [
'email',
'openid',
'profile',
];
}
protected function getScopeSeparator()
{
return ' ';
}
protected function checkResponse(ResponseInterface $response, $data)
{
if (!empty($data['error'])) {
$code = 0;
$error = $data['error'];
if (is_array($error)) {
$code = $error['code'];
$error = $error['message'];
}
throw new IdentityProviderException($error, $code, $data);
}
}
protected function createResourceOwner(array $response, AccessToken $token)
{
return new GoogleUser($response);
}
}
//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
$provider = new Google(
array(
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'redirectUri' => $redirectUri,
'scope' => array('https://mail.google.com/'),
'accessType' => 'offline'
)
);
if (!isset($_GET['code'])) {
// If we don't have an authorization code then get one
$authUrl = $provider->getAuthorizationUrl();
$_SESSION['oauth2state'] = $provider->getState();
header('Location: ' . $authUrl);
exit;
// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
unset($_SESSION['oauth2state']);
exit('Invalid state');
} else {
// Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken(
'authorization_code',
array(
'code' => $_GET['code']
)
);
// Use this to get a new access token if the old one expires
echo 'Refresh Token: ' . $token->getRefreshToken();
}

View File

@ -0,0 +1,26 @@
<?php
/**
* Armenian PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Hrayr Grigoryan <hrayr@bits.am>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP -ի սխալ: չհաջողվեց ստուգել իսկությունը.';
$PHPMAILER_LANG['connect_host'] = 'SMTP -ի սխալ: չհաջողվեց կապ հաստատել SMTP սերվերի հետ.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP -ի սխալ: տվյալները ընդունված չեն.';
$PHPMAILER_LANG['empty_message'] = 'Հաղորդագրությունը դատարկ է';
$PHPMAILER_LANG['encoding'] = 'Կոդավորման անհայտ տեսակ: ';
$PHPMAILER_LANG['execute'] = 'Չհաջողվեց իրականացնել հրամանը: ';
$PHPMAILER_LANG['file_access'] = 'Ֆայլը հասանելի չէ: ';
$PHPMAILER_LANG['file_open'] = 'Ֆայլի սխալ: ֆայլը չհաջողվեց բացել: ';
$PHPMAILER_LANG['from_failed'] = 'Ուղարկողի հետևյալ հասցեն սխալ է: ';
$PHPMAILER_LANG['instantiate'] = 'Հնարավոր չէ կանչել mail ֆունկցիան.';
$PHPMAILER_LANG['invalid_address'] = 'Հասցեն սխալ է: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' փոստային սերվերի հետ չի աշխատում.';
$PHPMAILER_LANG['provide_address'] = 'Անհրաժեշտ է տրամադրել գոնե մեկ ստացողի e-mail հասցե.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP -ի սխալ: չի հաջողվել ուղարկել հետևյալ ստացողների հասցեներին: ';
$PHPMAILER_LANG['signing'] = 'Ստորագրման սխալ: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP -ի connect() ֆունկցիան չի հաջողվել';
$PHPMAILER_LANG['smtp_error'] = 'SMTP սերվերի սխալ: ';
$PHPMAILER_LANG['variable_set'] = 'Չի հաջողվում ստեղծել կամ վերափոխել փոփոխականը: ';
$PHPMAILER_LANG['extension_missing'] = 'Հավելվածը բացակայում է: ';

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