Adding server-side timezones.

このコミットが含まれているのは:
テクニカル諏訪子 2018-03-13 18:52:49 +09:00
コミット e6abea3f1d
3個のファイルの変更72行の追加21行の削除

ファイルの表示

@ -44,10 +44,32 @@ class BoardController extends Controller {
} }
public function getForums() { // /api/rpc/board/forum/getforums public function getForums() { // /api/rpc/board/forum/getforums
return DB::table('for_forums') $get = DB::table('for_forums')
->select('*') ->select('id', 'last_uid', 'cat_id', 'title', 'description', 'threads', 'posts', 'last_date')
->orderBy('order', 'asc') ->orderBy('order', 'asc')
->get(); ->get();
$res = array();
$key = 0;
setlocale(LC_ALL, 'ja_JP.utf8');
foreach ($get as $i) {
array_push($res, [
'key' => $key,
'id' => $i->id,
'last_uid' => $i->last_uid,
'cat_id' => $i->cat_id,
'title' => $i->title,
'description' => $i->description,
'threads' => $i->threads,
'posts' => $i->posts,
'last_date' => strftime('%Y/%m/%d(%a) %H:%M:%S %Z', $i->last_date)
]);
$key++;
}
return $res;
} }
public function getForum($id) { // /api/rpc/board/forum/getforum/id public function getForum($id) { // /api/rpc/board/forum/getforum/id
@ -101,10 +123,33 @@ class BoardController extends Controller {
} }
public function getForumsInCategory($cat_id) { // /api/rpc/board/forum/getforumsincategory/cat_id public function getForumsInCategory($cat_id) { // /api/rpc/board/forum/getforumsincategory/cat_id
return DB::table('for_forums') $get = DB::table('for_forums')
->select('*') ->select('id', 'last_uid', 'cat_id', 'title', 'description', 'threads', 'posts', 'last_date')
->where('cat_id', $cat_id) ->where('cat_id', $cat_id)
->orderBy('order', 'asc')
->get(); ->get();
$res = array();
$key = 0;
setlocale(LC_ALL, 'ja_JP.utf8');
foreach ($get as $i) {
array_push($res, [
'key' => $key,
'id' => $i->id,
'last_uid' => $i->last_uid,
'cat_id' => $i->cat_id,
'title' => $i->title,
'description' => $i->description,
'threads' => $i->threads,
'posts' => $i->posts,
'last_date' => strftime('%Y/%m/%d(%a) %H:%M:%S %Z', $i->last_date)
]);
$key++;
}
return $res;
} }
public function getTopics($for, $from, $to) { // /api/rpc/board/topic/gettopics/for/from/to public function getTopics($for, $from, $to) { // /api/rpc/board/topic/gettopics/for/from/to
@ -597,16 +642,18 @@ class BoardController extends Controller {
//$mess = preg_replace('/\<br(\s*)?\/?\>/i', '', $i->message); //$mess = preg_replace('/\<br(\s*)?\/?\>/i', '', $i->message);
$mess = $this->packageMessage($i->message); $mess = $this->packageMessage($i->message);
setlocale(LC_ALL, 'ja_JP.utf8');
array_push($udat, [ array_push($udat, [
'key' => $key, 'key' => $key,
'id' => $i->id, 'id' => $i->id,
'tid' => $i->top_id, 'tid' => $i->top_id,
'uid' => $i->user_id, 'uid' => $i->user_id,
'post_date' => date('Y/m/d, G:i:s T', $i->post_date), 'post_date' => strftime('%Y/%m/%d(%a) %H:%M:%S %Z', date($i->post_date)),
'message' => $mess, 'message' => $mess,
'delete' => $i->delete, 'delete' => $i->delete,
'delreason' => $i->delreason, 'delreason' => $i->delreason,
'lastedit' => date('Y/m/d, G:i:s T', $i->lastedit), 'lastedit' => strftime('%Y/%m/%d(%a) %H:%M:%S %Z', date($i->lastedit)),
'lasteditUnix' => $i->lastedit, 'lasteditUnix' => $i->lastedit,
'ipaddress' => $i->ipaddress, 'ipaddress' => $i->ipaddress,
'nolayout' => $i->nolayout, 'nolayout' => $i->nolayout,

ファイルの表示

@ -20,7 +20,6 @@ class StoreController extends Controller {
// Game // Game
public function getGames() { // /api/rpc/store/game/getgames public function getGames() { // /api/rpc/store/game/getgames
return DB::table('str_games_loc') return DB::table('str_games_loc')
->join('str_locale', 'str_locale.id', '=', 'str_games_loc.loc_id')
->join('str_games', 'str_games.id', '=', 'str_games_loc.ref_id') ->join('str_games', 'str_games.id', '=', 'str_games_loc.ref_id')
->get(array( ->get(array(
'str_games.id', 'str_games.id',
@ -31,7 +30,6 @@ class StoreController extends Controller {
public function getGame($id) { // /api/rpc/store/game/getgame/id public function getGame($id) { // /api/rpc/store/game/getgame/id
return DB::table('str_games_loc') return DB::table('str_games_loc')
->join('str_locale', 'str_locale.id', '=', 'str_games_loc.loc_id')
->join('str_games', 'str_games.id', '=', 'str_games_loc.ref_id') ->join('str_games', 'str_games.id', '=', 'str_games_loc.ref_id')
->where('str_games.id', $id) ->where('str_games.id', $id)
->get(array( ->get(array(
@ -61,7 +59,6 @@ class StoreController extends Controller {
// Category // Category
public function getCategories() { // /api/rpc/store/category/getcategories public function getCategories() { // /api/rpc/store/category/getcategories
return DB::table('str_category_loc') return DB::table('str_category_loc')
->join('str_locale', 'str_locale.id', '=', 'str_category_loc.loc_id')
->join('str_category', 'str_category.id', '=', 'str_category_loc.ref_id') ->join('str_category', 'str_category.id', '=', 'str_category_loc.ref_id')
->get(array( ->get(array(
'str_category.id', 'str_category.id',
@ -74,7 +71,6 @@ class StoreController extends Controller {
public function getCategory($id) { // /api/rpc/store/category/getcategory/id public function getCategory($id) { // /api/rpc/store/category/getcategory/id
return DB::table('str_category_loc') return DB::table('str_category_loc')
->join('str_locale', 'str_locale.id', '=', 'str_category_loc.loc_id')
->join('str_category', 'str_category.id', '=', 'str_category_loc.ref_id') ->join('str_category', 'str_category.id', '=', 'str_category_loc.ref_id')
->where('str_category.id', $id) ->where('str_category.id', $id)
->get(array( ->get(array(
@ -88,7 +84,6 @@ class StoreController extends Controller {
public function getCategoriesOfGame($id) { // /api/rpc/store/category/getcategoriesofgame/id public function getCategoriesOfGame($id) { // /api/rpc/store/category/getcategoriesofgame/id
return DB::table('str_category_loc') return DB::table('str_category_loc')
->join('str_locale', 'str_locale.id', '=', 'str_category_loc.loc_id')
->join('str_category', 'str_category.id', '=', 'str_category_loc.ref_id') ->join('str_category', 'str_category.id', '=', 'str_category_loc.ref_id')
->join('str_games', 'str_category.game_id', '=', 'str_games.id') ->join('str_games', 'str_category.game_id', '=', 'str_games.id')
->where('str_games.id', $id) ->where('str_games.id', $id)
@ -100,12 +95,14 @@ class StoreController extends Controller {
} }
public function getGameOfCategory($id) { // /api/rpc/store/category/getgameofcategory/id public function getGameOfCategory($id) { // /api/rpc/store/category/getgameofcategory/id
return DB::table('str_category') return DB::table('str_games_loc')
->join('str_games', 'str_category.game_id', '=', 'str_games.id') ->join('str_games', 'str_games.id', '=', 'str_games_loc.ref_id')
->join('str_category', 'str_category.game_id', '=', 'str_games.id')
->where('str_category.id', $id) ->where('str_category.id', $id)
->get(array( ->get(array(
'str_games.id', 'str_games.id',
'str_games.name' 'str_games.name',
'str_games_loc.name as altname'
)); ));
} }
@ -124,17 +121,24 @@ class StoreController extends Controller {
} }
public function getCategoryName($id) { // /api/rpc/store/category/getcategoryname/id public function getCategoryName($id) { // /api/rpc/store/category/getcategoryname/id
return DB::table('str_category') return DB::table('str_category_loc')
->select('name') ->join('str_category', 'str_category.id', '=', 'str_category_loc.ref_id')
->where('id', $id) ->where('str_category.id', $id)
->get(); ->get(array(
'str_category.name',
'str_category_loc.name as altname'
));
} }
public function getCategoryNameOfEntry($id) { // /api/rpc/store/category/getcategorynameofentry/id public function getCategoryNameOfEntry($id) { // /api/rpc/store/category/getcategorynameofentry/id
return DB::table('str_file') return DB::table('str_file')
->join('str_category', 'str_category.id', '=', 'str_file.cat_id') ->join('str_category', 'str_category.id', '=', 'str_file.cat_id')
->join('str_category_loc', 'str_category.id', '=', 'str_category_loc.ref_id')
->where('str_file.id', $id) ->where('str_file.id', $id)
->get(array('name')); ->get(array(
'str_category.name',
'str_category_loc.name as altname'
));
} }
public function newCategory(Request $request) { // /api/rpc/store/category/newcategory public function newCategory(Request $request) { // /api/rpc/store/category/newcategory

ファイルの表示

@ -79,7 +79,7 @@ return [
| |
*/ */
'locale' => 'en', 'locale' => 'ja',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -92,7 +92,7 @@ return [
| |
*/ */
'fallback_locale' => 'en', 'fallback_locale' => 'ja',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------