Update activitypub.extend.php
This commit is contained in:
parent
4c980beb90
commit
86b3fc8029
|
@ -1207,55 +1207,72 @@ class _GNUBOARD_ActivityPub {
|
||||||
|
|
||||||
public static function shares() {
|
public static function shares() {
|
||||||
global $g5;
|
global $g5;
|
||||||
|
|
||||||
|
// 게시판인 경우
|
||||||
|
if (array_key_exists("bo_table", $_GET)) {
|
||||||
|
$bo = get_board_db($_GET['bo_table'], true);
|
||||||
|
|
||||||
$bo = get_board_db($_GET['bo_table'], true);
|
if (!empty($bo['bo_table'])) {
|
||||||
|
switch($bo['bo_table']) {
|
||||||
|
case ACTIVITYPUB_G5_BOARDNAME:
|
||||||
|
return self::inbox(); // 액티비티를 저장하는 테이블인 경우 inbox와 동일하게 취급
|
||||||
|
|
||||||
if (!empty($bo['bo_table'])) {
|
default:
|
||||||
switch($bo['bo_table']) {
|
$items = array(); // 항목을 담을 배열
|
||||||
case ACTIVITYPUB_G5_BOARDNAME:
|
|
||||||
return self::inbox(); // 액티비티를 저장하는 테이블인 경우 inbox와 동일하게 취급
|
|
||||||
|
|
||||||
default:
|
// 조회할 페이지 수 불러오기
|
||||||
$items = array(); // 항목을 담을 배열
|
$page = intval($_GET['page']);
|
||||||
|
if ($page < 1) {
|
||||||
|
$page = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// 조회할 페이지 수 불러오기
|
// 페이지 당 표시할 게시물 수 불러오기
|
||||||
$page = intval($_GET['page']);
|
$page_rows = 0;
|
||||||
if ($page < 1) {
|
if (!empty($bo['bo_mobile_page_rows'])) {
|
||||||
$page = 1;
|
$page_rows = intval($bo['bo_mobile_page_rows']);
|
||||||
}
|
} else if (!empty($bo['bo_page_rows'])) {
|
||||||
|
$page_rows = intval($bo['bo_page_rows']);
|
||||||
|
}
|
||||||
|
|
||||||
// 페이지 당 표시할 게시물 수 불러오기
|
// 페이지 당 표시할 게시물 수가 1보다 작으면 기본값(15)로 설정
|
||||||
$page_rows = 0;
|
if ($pages_rows < 1) {
|
||||||
if (!empty($bo['bo_mobile_page_rows'])) {
|
$page_rows = 15;
|
||||||
$page_rows = intval($bo['bo_mobile_page_rows']);
|
}
|
||||||
} else if (!empty($bo['bo_page_rows'])) {
|
|
||||||
$page_rows = intval($bo['bo_page_rows']);
|
// SQL 작성
|
||||||
}
|
$write_table = $g5['write_prefix'] . $bo['bo_table'];
|
||||||
|
$offset = ($page - 1) * $page_rows;
|
||||||
|
$sql = "select wr_id, mb_id, wr_content, wr_datetime from {$write_table} where FIND_IN_SET('secret', wr_option) = 0 order by wr_datetime desc limit {$offset}, {$page_rows} ";
|
||||||
|
|
||||||
// 페이지 당 표시할 게시물 수가 1보다 작으면 기본값(15)로 설정
|
// SQL 실행
|
||||||
if ($pages_rows < 1) {
|
$result = sql_query($sql);
|
||||||
$page_rows = 15;
|
while ($row = sql_fetch_array($result)) {
|
||||||
}
|
$object_id = G5_BBS_URL . "/board.php?bo_table={$bo['bo_table']}&wr_id={$row['wr_id']}";
|
||||||
|
$mb = get_member($row['mb_id']);
|
||||||
// SQL 작성
|
$content = $row['wr_content'];
|
||||||
$write_table = $g5['write_prefix'] . $bo['bo_table'];
|
array_push($items, activitypub_build_note($content, $object_id, $mb));
|
||||||
$offset = ($page - 1) * $page_rows;
|
}
|
||||||
$sql = "select wr_id, mb_id, wr_content, wr_datetime from {$write_table}
|
}
|
||||||
where FIND_IN_SET('secret', wr_option) = 0 order by wr_datetime desc limit {$offset}, {$page_rows}";
|
}
|
||||||
|
} else { // 게시판이 아닌 경우
|
||||||
// SQL 실행
|
// 최근 활동에서 추출
|
||||||
$result = sql_query($sql);
|
$sql = "select * from " . $g5['board_new_table'];
|
||||||
while ($row = sql_fetch_array($result)) {
|
$result = sql_query($sql);
|
||||||
$object_id = G5_BBS_URL . "/board.php?bo_table={$bo['bo_table']}&wr_id={$row['wr_id']}";
|
while ($row = sql_fetch_array($result)) {
|
||||||
$mb = get_member($row['mb_id']);
|
$write_table = $g5['write_prefix'] . $row['bo_table'];
|
||||||
$content = $row['wr_content'];
|
$sql2 = "select wr_id, mb_id, wr_content, wr_datetime from {$write_table} where wr_id = '{$row['wr_id']}' and FIND_IN_SET('secret', wr_option) = 0 ";
|
||||||
array_push($items, activitypub_build_note($content, $object_id, $mb));
|
$row2 = sql_fetch($sql2);
|
||||||
}
|
if ($row2['wr_id']) {
|
||||||
|
$object_id = G5_BBS_URL . "/board.php?bo_table={$row['bo_table']}&wr_id={$row2['wr_id']}";
|
||||||
// 결과 반환
|
$mb = get_member($row2['mb_id']);
|
||||||
return activitypub_json_encode(activitypub_build_collection($items, "Latest shares"));
|
$content = $row2['wr_content'];
|
||||||
|
array_push($items, activitypub_build_note($content, $object_id, $mb));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 결과 반환
|
||||||
|
return activitypub_json_encode(activitypub_build_collection($items, "Latest shares"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function close() {
|
public static function close() {
|
||||||
|
@ -1423,3 +1440,4 @@ switch ($route) {
|
||||||
_GNUBOARD_ActivityPub::close();
|
_GNUBOARD_ActivityPub::close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user