Merge branch 'css'

This commit is contained in:
gnuboard
2013-04-22 15:08:42 +09:00
20 changed files with 186 additions and 167 deletions

View File

@ -1928,4 +1928,45 @@ if (!function_exists('file_put_contents')) {
}
}
}
// HTML 마지막 처리
function html_end()
{
global $g4;
// 현재접속자 처리
$tmp_sql = " select count(*) as cnt from {$g4['login_table']} where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";
$tmp_row = sql_fetch($tmp_sql);
//sql_query(" lock table $g4['login_table'] write ", false);
if ($tmp_row['cnt']) {
$tmp_sql = " update {$g4['login_table']} set mb_id = '{$member['mb_id']}', lo_datetime = '".G4_TIME_YMDHIS."', lo_location = '$lo_location', lo_url = '$lo_url' where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($tmp_sql, FALSE);
} else {
$tmp_sql = " insert into {$g4['login_table']} ( lo_ip, mb_id, lo_datetime, lo_location, lo_url ) values ( '{$_SERVER['REMOTE_ADDR']}', '{$member['mb_id']}', '".G4_TIME_YMDHIS."', '$lo_location', '$lo_url' ) ";
sql_query($tmp_sql, FALSE);
// 시간이 지난 접속은 삭제한다
sql_query(" delete from {$g4['login_table']} where lo_datetime < '".date("Y-m-d H:i:s", G4_SERVER_TIME - (60 * $config['cf_login_minutes']))."' ");
// 부담(overhead)이 있다면 테이블 최적화
//$row = sql_fetch(" SHOW TABLE STATUS FROM `$mysql_db` LIKE '$g4['login_table']' ");
//if ($row['Data_free'] > 0) sql_query(" OPTIMIZE TABLE $g4['login_table'] ");
}
// 버퍼의 내용에서 body 태그 중간의 외부 css 파일을 CAPTURE 하여 head 태그로 이동시켜준다.
$buffer = ob_get_contents();
ob_end_clean();
preg_match('#<body>(.*)</body>#is', $buffer, $bodys);
preg_match_all('/<link[^>]+>/i', $bodys[0], $links);
$stylesheet = '';
$links[0] = array_unique($links[0]);
foreach ($links[0] as $key=>$link) {
//$link = PHP_EOL.$links[0][$i];
$stylesheet .= PHP_EOL.$link;
$buffer = preg_replace('#'.$link.'#', '', $buffer);
}
return preg_replace('#(</title>)#', "$1$stylesheet", $buffer);
}
?>

View File

@ -13,6 +13,7 @@ function connect($skin_dir='')
if (!$skin_dir)
$skin_dir = $config['cf_connect_skin'];
$connect_skin_path = G4_SKIN_PATH.'/connect/'.$skin_dir;
$connect_skin_url = G4_SKIN_URL.'/connect/'.$skin_dir;
ob_start();
include_once ($connect_skin_path.'/connect.skin.php');

View File

@ -39,11 +39,13 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40)
include_once($cache_file);
/*
// 같은 스킨은 .css 를 한번만 호출한다.
if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) {
echo '<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">';
$css[] = $skin_dir;
}
*/
ob_start();
include $latest_skin_path.'/latest.skin.php';

View File

@ -20,8 +20,10 @@ function poll($skin_dir='basic', $po_id=false)
ob_start();
if (G4_IS_MOBILE) {
$poll_skin_path = G4_MOBILE_PATH.'/'.G4_SKIN_DIR.'/poll/'.$skin_dir;
$poll_skin_url = G4_MOBILE_URL.'/'.G4_SKIN_DIR.'/poll/'.$skin_dir;
} else {
$poll_skin_path = G4_SKIN_PATH.'/poll/'.$skin_dir;
$poll_skin_url = G4_SKIN_URL.'/poll/'.$skin_dir;
}
include_once ($poll_skin_path.'/poll.skin.php');
$content = ob_get_contents();