* * @author CIBoard (develop@ciboard.co.kr) */ /** * print_r2 */ if ( ! function_exists('print_r2')) { function print_r2($var) { ob_start(); print_r($var); $str = ob_get_contents(); ob_end_clean(); $str = str_replace(" ", " ", $str); echo nl2br("$str"); } } /** * Alert 띄우기 */ if ( ! function_exists('alert')) { function alert($msg = '', $url = '') { if (empty($msg)) { $msg = '잘못된 접근입니다'; } echo ''; echo ''; exit; } } /** * Alert 후 창 닫음 */ if ( ! function_exists('alert_close')) { function alert_close($msg = '') { if (empty($msg)) { $msg = '잘못된 접근입니다'; } echo ''; echo ''; exit; } } /** * Alert 후 부모창 새로고침 후 창 닫음 */ if ( ! function_exists('alert_refresh_close')) { function alert_refresh_close($msg = '') { if (empty($msg)) { $msg = '잘못된 접근입니다'; } echo ''; echo ''; exit; } } /** * DATE 함수의 약간 변형 */ if ( ! function_exists('cdate')) { function cdate($date, $timestamp = '') { defined('TIMESTAMP') or define('TIMESTAMP', time()); return $timestamp ? date($date, $timestamp) : date($date, TIMESTAMP); } } /** * TIMESTAMP 불러오기 */ if ( ! function_exists('ctimestamp')) { function ctimestamp() { defined('TIMESTAMP') or define('TIMESTAMP', time()); return TIMESTAMP; } } /** * 초를 사람이 쉽게 읽을 수 있는 시간으로 변환하기 */ if ( ! function_exists('seconds2human')) { function seconds2human($second = 0) { $second = (int) $second; $s = $second%60; $m = floor(($second % 3600)/60); $h = floor(($second % 86400)/3600); $d = floor($second / 86400); $return = ''; if ($d) { $return .= $d . " 일 "; } if ($h) { $return .= $h . " 시간 "; } if ($m) { $return .= $m . " 분 "; } if ($s) { $return .= $s . " 초"; } $return = trim($return); return $return; } } if ( ! function_exists('array_to_keys')) { function array_to_keys($array = '') { $result = array(); if ( ! is_array($array)) { return false; } foreach ($array as $key) { $result[$key] = false; } return $result; } } /** * 검색 select option */ if ( ! function_exists('search_option')) { function search_option($options = '', $selected = '') { if (empty($options) OR ! is_array($options)) { return false; } $result = ''; foreach ($options as $key => $val) { $result .= ''; } $skin_dir = array(); $dirname = $dir . $skin_path . '/'; if (is_dir($dir . $skin_path) === false) { return; } $handle = opendir($dirname); while ($file = readdir($handle)) { if ($file === '.' OR $file === '..') { continue; } if (is_dir($dirname . $file)) { $skin_dir[] = $file; } } closedir($handle); sort($skin_dir); foreach ($skin_dir as $row) { $option = $row; if (strlen($option) > 10) { $option = substr($row, 0, 18) . '…'; } $slt = ($selected_skin === $row) ? 'selected="selected"' : ''; $result .= ''; } return $result; } } /** * 권한관리 페이지에 보이는 셀렉트박스 */ if ( ! function_exists('get_access_selectbox')) { function get_access_selectbox($config = '', $memberonly = '') { if (empty($config)) { return false; } $show_level_array = array('3', '4', '5'); $show_group_array = array('2', '4', '5'); $replace = array('[', ']'); $result = ''; $result .= ''; for ($level = 1; $level <= element('max_level', $config); $level++) { $result .= '