Merge branch 'master' of github.com:gnuboard/g4s

This commit is contained in:
whitedot
2013-04-15 13:14:56 +09:00
2 changed files with 67 additions and 1 deletions

View File

@ -80,6 +80,22 @@ var g4_cookie_domain = "<?=G4_COOKIE_DOMAIN?>";
<script src="<?=G4_JS_URL?>/jquery-1.8.3.min.js"></script>
<script src="<?=G4_JS_URL?>/common.js"></script>
<script src="<?=G4_JS_URL?>/wrest.js"></script>
<? // 스킨의 javascript 불러옴
if (!defined('G4_IS_ADMIN')) {
if(isset($board_skin_path))
echo get_skin_javascript($board_skin_path, 'js');
if(isset($member_skin_path))
echo get_skin_javascript($member_skin_path, 'js');
if(isset($new_skin_path))
echo get_skin_javascript($new_skin_path, 'js');
if(isset($search_skin_path))
echo get_skin_javascript($search_skin_path, 'js');
if(isset($connect_skin_path))
echo get_skin_javascript($connect_skin_path, 'js');
if(isset($poll_skin_path))
echo get_skin_javascript($poll_skin_path, 'js');
}
?>
<? if(G4_IS_MOBILE) { ?>
<script>
set_cookie("device_width", screen.width, 6, g4_cookie_domain);

View File

@ -1798,13 +1798,16 @@ function delete_editor_thumbnail($contents)
}
// 스킨 style sheet 파일 얻기
function get_skin_stylesheet($skin_path)
function get_skin_stylesheet($skin_path, $dir='')
{
if(!$skin_path)
return "";
$str = "";
if($dir)
$skin_path .= '/'.$dir;
$skin_url = G4_URL.str_replace("\\", "/", str_replace(G4_PATH, "", $skin_path));
if(is_dir($skin_path)) {
@ -1825,4 +1828,51 @@ function get_skin_stylesheet($skin_path)
return $str;
}
// 스킨 javascript 파일 얻기
function get_skin_javascript($skin_path, $dir='')
{
if(!$skin_path)
return "";
$str = "";
if($dir)
$skin_path .= '/'.$dir;
$skin_url = G4_URL.str_replace("\\", "/", str_replace(G4_PATH, "", $skin_path));
if(is_dir($skin_path)) {
if($dh = opendir($skin_path)) {
while(($file = readdir($dh)) !== false) {
if($file == "." || $file == "..")
continue;
if(is_dir($skin_path.'/'.$file))
continue;
if(preg_match("/\.(js)$/i", $file))
$str .= '<script src="'.$skin_url.'/'.$file.'"></script>'."\n";
}
closedir($dh);
}
}
return $str;
}
// file_put_contents 는 PHP5 전용 함수이므로 PHP4 하위버전에서 사용하기 위함
// http://www.phpied.com/file_get_contents-for-php4/
if (!function_exists('file_put_contents')) {
function file_put_contents($filename, $data) {
$f = @fopen($filename, 'w');
if (!$f) {
return false;
} else {
$bytes = fwrite($f, $data);
fclose($f);
return $bytes;
}
}
}
?>