API calls for topic pins and locks.
このコミットが含まれているのは:
コミット
bdf9e61bfe
|
@ -259,6 +259,13 @@ class BoardController extends Controller {
|
|||
->get();
|
||||
}
|
||||
|
||||
public function getTopicPin($id) { // /api/rpc/board/topic/gettopicpin/id
|
||||
return DB::table('for_threads')
|
||||
->select('sticky')
|
||||
->where('id', $id)
|
||||
->get();
|
||||
}
|
||||
|
||||
public function getTopicName($id) { // /api/rpc/board/topic/gettopicname/id
|
||||
return DB::table('for_threads')
|
||||
->select('for_id', 'title')
|
||||
|
@ -495,6 +502,122 @@ class BoardController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
public function lockTopic(Request $request) { // /api/rpc/board/topic/lock
|
||||
$check = $this->objAuth->checkLegit($request->username, $request->password);
|
||||
|
||||
if ($check == 0) {
|
||||
return 'Err!';
|
||||
}
|
||||
else {
|
||||
$valid = $this->objAuth->getPermissions($request->username, $request->password);
|
||||
|
||||
if ($valid['for_locky'] == 1) {
|
||||
return DB::table('for_threads')
|
||||
->where('id', $request->id)
|
||||
->update([
|
||||
'lock' => 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function unlockTopic(Request $request) { // /api/rpc/board/topic/unlock
|
||||
$check = $this->objAuth->checkLegit($request->username, $request->password);
|
||||
|
||||
if ($check == 0) {
|
||||
return 'Err!';
|
||||
}
|
||||
else {
|
||||
$valid = $this->objAuth->getPermissions($request->username, $request->password);
|
||||
|
||||
if ($valid['for_locky'] == 1) {
|
||||
return DB::table('for_threads')
|
||||
->where('id', $request->id)
|
||||
->update([
|
||||
'lock' => 0
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function moveTopic(Request $request) { // /api/rpc/board/topic/move
|
||||
/* $check = $this->objAuth->checkLegit($request->username, $request->password);
|
||||
|
||||
if ($check == 0) {
|
||||
return 'Err!';
|
||||
}
|
||||
else {
|
||||
$valid = $this->objAuth->getPermissions($request->username, $request->password);
|
||||
|
||||
if ($valid['for_move'] == 1) {
|
||||
return DB::table('for_threads')
|
||||
->where('id', $request->id)
|
||||
->update([
|
||||
'delete' => 0,
|
||||
'delreason' => ''
|
||||
]);
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
public function mergeTopic(Request $request) { // /api/rpc/board/topic/merge
|
||||
/* $check = $this->objAuth->checkLegit($request->username, $request->password);
|
||||
|
||||
if ($check == 0) {
|
||||
return 'Err!';
|
||||
}
|
||||
else {
|
||||
$valid = $this->objAuth->getPermissions($request->username, $request->password);
|
||||
|
||||
if ($valid['for_mergepost'] == 1) {
|
||||
return DB::table('for_threads')
|
||||
->where('id', $request->id)
|
||||
->update([
|
||||
'delete' => 0,
|
||||
'delreason' => ''
|
||||
]);
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
public function pinTopic(Request $request) { // /api/rpc/board/topic/pin
|
||||
$check = $this->objAuth->checkLegit($request->username, $request->password);
|
||||
|
||||
if ($check == 0) {
|
||||
return 'Err!';
|
||||
}
|
||||
else {
|
||||
$valid = $this->objAuth->getPermissions($request->username, $request->password);
|
||||
|
||||
if ($valid['for_sticky'] == 1) {
|
||||
return DB::table('for_threads')
|
||||
->where('id', $request->id)
|
||||
->update([
|
||||
'sticky' => 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function unpinTopic(Request $request) { // /api/rpc/board/topic/unpin
|
||||
$check = $this->objAuth->checkLegit($request->username, $request->password);
|
||||
|
||||
if ($check == 0) {
|
||||
return 'Err!';
|
||||
}
|
||||
else {
|
||||
$valid = $this->objAuth->getPermissions($request->username, $request->password);
|
||||
|
||||
if ($valid['for_sticky'] == 1) {
|
||||
return DB::table('for_threads')
|
||||
->where('id', $request->id)
|
||||
->update([
|
||||
'sticky' => 0
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function undeletePost(Request $request) { // /api/rpc/board/post/undeletepost
|
||||
$check = $this->objAuth->checkLegit($request->username, $request->password);
|
||||
|
||||
|
@ -772,6 +895,14 @@ class BoardController extends Controller {
|
|||
if ($tlock[0]->lock == 0) $glock = false;
|
||||
else $glock = true;
|
||||
|
||||
// Is this topic pinned?
|
||||
if ($tp == 't') $tpin = $this->getTopicPin($id);
|
||||
else $tpin = $this->getTopicPin($tid);
|
||||
$gpin = false;
|
||||
|
||||
if ($tpin[0]->sticky == 0) $gpin = false;
|
||||
else $gpin = true;
|
||||
|
||||
if ($tp == 'p') {
|
||||
// Compile.
|
||||
return array(
|
||||
|
@ -782,6 +913,7 @@ class BoardController extends Controller {
|
|||
'forName' => $finfo[0]->title,
|
||||
'catName' => $cinfo[0]->title,
|
||||
'lock' => $glock,
|
||||
'pin' => $gpin
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -795,6 +927,7 @@ class BoardController extends Controller {
|
|||
'maxPage' => ceil($pcount / $to),
|
||||
'posts' => $pcount,
|
||||
'lock' => $glock,
|
||||
'pin' => $gpin
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,9 +29,16 @@ Route::get('/api/rpc/board/topic/gettopicspinned/{for}/{from}/{to}', 'BoardContr
|
|||
Route::get('/api/rpc/board/topic/gettopicsuser/{user}/{from}/{to}', 'BoardController@getTopicsUser');
|
||||
Route::get('/api/rpc/board/topic/countunpinnedtopicsinforum/{for}', 'BoardController@countUnpinnedTopicsInForum');
|
||||
Route::get('/api/rpc/board/topic/gettopic/{for}/{from}/{to}', 'BoardController@getTopic');
|
||||
Route::get('/api/rpc/board/topic/gettopicpin/{id}', 'BoardController@getTopicPin');
|
||||
Route::get('/api/rpc/board/topic/gettopiclock/{id}', 'BoardController@getTopicLock');
|
||||
Route::get('/api/rpc/board/topic/getforumidfromtopic/{top_id}', 'BoardController@getForumIdFromTopic');
|
||||
Route::get('/api/rpc/board/topic/gettopicname/{id}', 'BoardController@getTopicName');
|
||||
Route::post('/api/rpc/board/topic/lock', 'BoardController@lockTopic');
|
||||
Route::post('/api/rpc/board/topic/unlock', 'BoardController@unlockTopic');
|
||||
Route::post('/api/rpc/board/topic/merge', 'BoardController@mergeTopic');
|
||||
Route::post('/api/rpc/board/topic/move', 'BoardController@moveTopic');
|
||||
Route::post('/api/rpc/board/topic/pin', 'BoardController@pinTopic');
|
||||
Route::post('/api/rpc/board/topic/unpin', 'BoardController@unpinTopic');
|
||||
|
||||
// Post
|
||||
Route::get('/api/rpc/board/post/getpostsintopic/{top}/{from}/{to}', 'BoardController@getPostsInTopic');
|
||||
|
|
新しいイシューから参照