특정 게시글 권한관련 질문입니다~ 정보
특정 게시글 권한관련 질문입니다~본문
몇시간째 풀지 못하고 있네여..ㅠㅠ
예를들어
게시판1은 관리권한 4
게시판2는 관리권한 3
입니다.
게시판 1은 글쓰기,읽기, 댓글등 모두~ 권한4
게시판 2는 글쓰기,읽기, 댓글등 모두~ 권한3
이고 각각 게시판 위에 최신댓글이 출력됩니다.
여기서 질문할게
권한3인 사람이 접속해서 게시판 2가 보여지는데
최신댓글이 상단에 출력될대 2에 등록된 댓글만 보여지게 하고싶습니다.
현재는 게시판1에 남긴 댓글도 모두 출력됩니다. 클릭하면
물론 읽지 못하게 되어있지만
제가 적용하고 싶은건~ 권한이 안되는 댓글은 목록조차 볼수 없게 하고 싶습니다.
이럴경우 어느부분을 수정해야 하나요?
혹시몰라서 최신댓글 추출부분 소스 올립니다.
<?
if (!defined('_GNUBOARD_')) exit;
// 최신댓글 추출
function latestAnswer($skin_dir="", $bo_table="", $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' ";
if ($gr_id)
$sql_common .= " and b.gr_id = '$gr_id' ";
$sql_common .= " and a.wr_id <> a.wr_parent ";
if ($mb_id)
$sql_common .= " and a.mb_id = '$mb_id' ";
$sql_order = " order by a.bn_id desc ";
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
$comment = "";
$comment_link = "";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
// 당일인 경우 시간으로 표시함
$datetime = substr($row2[wr_datetime],0,10);
$datetime2 = $row2[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
$list[$i][gr_id] = $row[gr_id];
$list[$i][bo_table] = $row[bo_table];
$list[$i][name] = $name;
$list[$i][comment] = $comment;
$list[$i][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]{$comment_link}";
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i][gr_subject] = $row[gr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][subject] = conv_subject($row2[wr_content], $subject_len, "…");
$list[$i][subject2] = $row[subject];
$list[$i][subject3] = $row2[subject];
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
-------------
출력되는 부분에는
<?
include_once("$g4[path]/lib/latestLast2.lib.php");
echo latestAnswer("basic", "order2", 10, 100);
?>
도와주세요 ㅠㅠ
예를들어
게시판1은 관리권한 4
게시판2는 관리권한 3
입니다.
게시판 1은 글쓰기,읽기, 댓글등 모두~ 권한4
게시판 2는 글쓰기,읽기, 댓글등 모두~ 권한3
이고 각각 게시판 위에 최신댓글이 출력됩니다.
여기서 질문할게
권한3인 사람이 접속해서 게시판 2가 보여지는데
최신댓글이 상단에 출력될대 2에 등록된 댓글만 보여지게 하고싶습니다.
현재는 게시판1에 남긴 댓글도 모두 출력됩니다. 클릭하면
물론 읽지 못하게 되어있지만
제가 적용하고 싶은건~ 권한이 안되는 댓글은 목록조차 볼수 없게 하고 싶습니다.
이럴경우 어느부분을 수정해야 하나요?
혹시몰라서 최신댓글 추출부분 소스 올립니다.
<?
if (!defined('_GNUBOARD_')) exit;
// 최신댓글 추출
function latestAnswer($skin_dir="", $bo_table="", $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' ";
if ($gr_id)
$sql_common .= " and b.gr_id = '$gr_id' ";
$sql_common .= " and a.wr_id <> a.wr_parent ";
if ($mb_id)
$sql_common .= " and a.mb_id = '$mb_id' ";
$sql_order = " order by a.bn_id desc ";
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
$comment = "";
$comment_link = "";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
// 당일인 경우 시간으로 표시함
$datetime = substr($row2[wr_datetime],0,10);
$datetime2 = $row2[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
$list[$i][gr_id] = $row[gr_id];
$list[$i][bo_table] = $row[bo_table];
$list[$i][name] = $name;
$list[$i][comment] = $comment;
$list[$i][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]{$comment_link}";
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i][gr_subject] = $row[gr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][subject] = conv_subject($row2[wr_content], $subject_len, "…");
$list[$i][subject2] = $row[subject];
$list[$i][subject3] = $row2[subject];
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
-------------
출력되는 부분에는
<?
include_once("$g4[path]/lib/latestLast2.lib.php");
echo latestAnswer("basic", "order2", 10, 100);
?>
도와주세요 ㅠㅠ
댓글 전체
앞서 같은 질문을 했는데 질문 내용이 왔다리 갔다리 하네요
order2만 보이게 하는 것이 간단한데요
$sql_common .= " and a.wr_id <> a.wr_parent and bo_table='$bo_table' "; //마지막 부분 추가
질문 내용대로 하려면 아래 처럼 두곳을 수정
global $g4, $member;
$sql_common .= " and a.wr_id <> a.wr_parent and bo_list_level <='$member[mb_level]' ";
order2만 보이게 하는 것이 간단한데요
$sql_common .= " and a.wr_id <> a.wr_parent and bo_table='$bo_table' "; //마지막 부분 추가
질문 내용대로 하려면 아래 처럼 두곳을 수정
global $g4, $member;
$sql_common .= " and a.wr_id <> a.wr_parent and bo_list_level <='$member[mb_level]' ";
하두 안되서 방법을 바꿨거든요ㅜㅡ 오우+__+방법대로 하니까 해결됬습니다!
ㄳㄳ //
ㄳㄳ //