diff --git a/lib/common.lib.php b/lib/common.lib.php
index 6018674ce..257515e5a 100644
--- a/lib/common.lib.php
+++ b/lib/common.lib.php
@@ -96,6 +96,8 @@ function print_r2($var)
// header("location:URL") 을 대체
function goto_url($url)
{
+ run_event('goto_url', $url);
+
$url = str_replace("&", "&", $url);
//echo "";
@@ -1328,87 +1330,138 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
global $g5;
global $bo_table, $sca, $is_admin, $member;
- $email = get_string_encrypt($email);
- $homepage = set_http(clean_xss_tags($homepage));
+ static $cache = array();
- $name = get_text($name, 0, true);
- $email = get_text($email);
+ $name = get_text($name, 0, true);
+
+ if (isset($cache['id:' . $mb_id]) && $cache['id:' . $mb_id]) {
+ return $cache['id:' . $mb_id];
+ } else if (
+ isset($name)
+ && isset($cache['name:' . $name])
+ && $cache['name:' . $name]
+ ) {
+ return $cache['name:' . $name];
+ }
+
+ $email = get_string_encrypt($email);
+ $email = get_text($email);
+
+ $homepage = set_http(clean_xss_tags($homepage));
$homepage = get_text($homepage);
- $tmp_name = "";
$en_mb_id = $mb_id;
+ $name_tag = array();
+ $menus = array();
+
if ($mb_id) {
- //$tmp_name = "$name";
- $tmp_name = '';
+ // $tmp_name = "$name";
+ $name_tag_open = '';
if ($config['cf_use_member_icon']) {
- $mb_dir = substr($mb_id,0,2);
- $icon_file = G5_DATA_PATH.'/member/'.$mb_dir.'/'.get_mb_icon_name($mb_id).'.gif';
+ $mb_dir = substr($mb_id, 0, 2);
+ $icon_file = G5_DATA_PATH . '/member/' . $mb_dir . '/' . get_mb_icon_name($mb_id) . '.gif';
if (file_exists($icon_file)) {
- $icon_filemtile = (defined('G5_USE_MEMBER_IMAGE_FILETIME') && G5_USE_MEMBER_IMAGE_FILETIME) ? '?'.filemtime($icon_file) : '';
+ $icon_filemtile = (defined('G5_USE_MEMBER_IMAGE_FILETIME') && G5_USE_MEMBER_IMAGE_FILETIME) ? '?' . filemtime($icon_file) : '';
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
- $icon_file_url = G5_DATA_URL.'/member/'.$mb_dir.'/'.get_mb_icon_name($mb_id).'.gif'.$icon_filemtile;
- $tmp_name .= '';
+ $icon_file_url = G5_DATA_URL . '/member/' . $mb_dir . '/' . get_mb_icon_name($mb_id) . '.gif' . $icon_filemtile;
+ $name_tag['profile_image'] = '
';
- if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름
- $tmp_name = $tmp_name.' '.$name;
+ // 회원아이콘+이름
+ if ($config['cf_use_member_icon'] == 2) {
+ $name_tag['name'] = $name;
+ }
} else {
- if( defined('G5_THEME_NO_PROFILE_IMG') ){
- $tmp_name .= G5_THEME_NO_PROFILE_IMG;
- } else if( defined('G5_NO_PROFILE_IMG') ){
- $tmp_name .= G5_NO_PROFILE_IMG;
+ if (defined('G5_THEME_NO_PROFILE_IMG')) {
+ $name_tag['profile_image'] = G5_THEME_NO_PROFILE_IMG;
+ } else if (defined('G5_NO_PROFILE_IMG')) {
+ $name_tag['profile_image'] = G5_NO_PROFILE_IMG;
+ }
+
+ // 회원아이콘+이름
+ if ($config['cf_use_member_icon'] == 2) {
+ $name_tag['name'] = $name;
}
- if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름
- $tmp_name = $tmp_name.' '.$name;
}
} else {
- $tmp_name = $tmp_name.' '.$name;
+ $name_tag['name'] = $name;
}
- $tmp_name .= '';
-
- $title_mb_id = '['.$mb_id.']';
} else {
- if(!$bo_table)
+ if (!$bo_table) {
return $name;
+ }
- $tmp_name = ''.$name.'';
- $title_mb_id = '[비회원]';
+ $name_tag_open = '';
+ $name_tag['name'] = $name;
}
- $str = "\n";
- $str .= $tmp_name."\n";
+ if ($mb_id) {
+ $menus['memo'] = '쪽지보내기';
+ }
- $str2 = "\n";
- if($mb_id)
- $str2 .= "쪽지보내기\n";
- if($email)
- $str2 .= "메일보내기\n";
- if($homepage)
- $str2 .= "홈페이지\n";
- if($mb_id)
- $str2 .= "자기소개\n";
- if($bo_table) {
- if($mb_id) {
- $str2 .= "아이디로 검색\n";
+ if ($email) {
+ $menus['email'] = '메일보내기';
+ }
+
+ if ($homepage) {
+ $menus['homepage'] = '홈페이지';
+ }
+
+ if ($mb_id) {
+ $menus['profile'] = '자기소개';
+ }
+
+ if ($bo_table) {
+ if ($mb_id) {
+ $menus['search_id'] = '아이디로 검색';
} else {
- $str2 .= "이름으로 검색\n";
+ $menus['search_name'] = '이름으로 검색';
}
}
- if($mb_id)
- $str2 .= "전체게시물\n";
- if($is_admin == "super" && $mb_id) {
- $str2 .= "회원정보변경\n";
- $str2 .= "포인트내역\n";
- }
- $str2 .= "\n";
- $str .= $str2;
- $str .= "\n";
+ if ($mb_id) {
+ $menus['search_all'] = '전체게시물';
+
+ if ($is_admin == 'super') {
+ $menus['admin_member_modify'] = '회원정보변경';
+ $menus['admin_member_point'] = '포인트내역';
+ }
+ }
+
+ $name_tag_close = '';
+
+ $items = run_replace('member_sideview_items', array(
+ 'name_tag_open' => $name_tag_open,
+ 'name_tag_close' => $name_tag_close,
+ 'name_tag' => $name_tag,
+ 'menus' => $menus
+ ), array(
+ 'mb_id' => $mb_id,
+ 'name' => $name,
+ 'bo_table' => $bo_table,
+ )
+ );
+
+ $str = '';
+ $str .= $items['name_tag_open'] . implode(' ', $items['name_tag']) . $items['name_tag_close'];
+
+ $str2 = '';
+ $str2 .= implode("\n", $items['menus']);
+ $str2 .= '';
+
+ $str .= $str2;
+ $str .= '';
$str .= "";
+ if ($mb_id) {
+ $cache['id:' . $mb_id] = $str;
+ } else {
+ $cache['name:' . $name] = $str;
+ }
+
return $str;
}
@@ -1649,21 +1702,21 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
$end_time = ($is_debug || G5_COLLECT_QUERY) ? get_microtime() : 0;
$error = null;
+ $source = array();
if ($is_debug || G5_COLLECT_QUERY) {
if(function_exists('mysqli_error') && G5_MYSQLI_USE) {
$error = array(
- 'error_code' => mysqli_errno($g5['connect_db']),
- 'error_message' => mysqli_error($g5['connect_db']),
+ 'error_code' => mysqli_errno($link),
+ 'error_message' => mysqli_error($link),
);
} else {
$error = array(
- 'error_code' => mysql_errno($g5['connect_db']),
- 'error_message' => mysql_error($g5['connect_db']),
+ 'error_code' => mysql_errno($link),
+ 'error_message' => mysql_error($link),
);
}
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
- $source = array();
$found = false;
foreach ($stack as $index => $trace) {
@@ -1707,7 +1760,7 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
);
}
- run_event('sql_query_after', $result, $sql, $start_time, $end_time, $error);
+ run_event('sql_query_after', $result, $sql, $start_time, $end_time, $error, $source);
return $result;
}
@@ -2766,6 +2819,8 @@ class html_process {
$buffer = preg_replace('#(