コンテンツ追加・編集・削除機能性
このコミットが含まれているのは:
コミット
ddb2f1be18
|
@ -15,35 +15,32 @@ class SiteController extends Controller {
|
|||
private $objAuth;
|
||||
private $objUser;
|
||||
private $objPermission;
|
||||
private $valid;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct () {
|
||||
$this->objAuth = new AuthController();
|
||||
$this->objUser = new UserController();
|
||||
$this->objPermission = new PermissionController();
|
||||
$this->valid = $this->objAuth->getPermissions((isset($_COOKIE['kero_token']) ? $_COOKIE['kero_token'] : ''));
|
||||
}
|
||||
|
||||
public function getPosts ($ispost=1) {
|
||||
$kero_token = (isset($_COOKIE['kero_token']) ? $_COOKIE['kero_token'] : '');
|
||||
$check = $this->objAuth->checkLegit($kero_token);
|
||||
|
||||
$ucol = $this->objUser->getGroupColours();
|
||||
$valid = $this->objAuth->getPermissions($kero_token);
|
||||
|
||||
$get = DB::table('blg_content')->where('isPost', $ispost)->orderBy('publish_date', 'desc')->get();
|
||||
setlocale(LC_ALL, 'ja_JP.utf8');
|
||||
|
||||
foreach ($get as $g) { if ($valid['blg_addpost'] == 0 && $valid['blg_editpost'] == 0 && $g->public_status != 0) unset($g); }
|
||||
foreach ($get as $g) {
|
||||
if ($this->valid['blg_addpost'] == 0 && $this->valid['blg_editpost'] == 0 && $g->public_status != 0) unset($g);
|
||||
}
|
||||
|
||||
return $get;
|
||||
}
|
||||
|
||||
public function getPost ($slug, $kero) {
|
||||
$check = $this->objAuth->checkLegit($kero);
|
||||
$valid = $this->objAuth->getPermissions($kero);
|
||||
|
||||
$ucol = $this->objUser->getGroupColours();
|
||||
|
||||
if ($valid['blg_editpost']) {
|
||||
if ($this->valid['blg_editpost']) {
|
||||
$get = DB::table('blg_content')
|
||||
->join('users', 'blg_content.user_id', '=', 'users.id')
|
||||
->join('usr_details', 'usr_details.user_id', '=', 'blg_content.user_id')
|
||||
|
@ -207,9 +204,7 @@ class SiteController extends Controller {
|
|||
}
|
||||
|
||||
public function getPage ($slug, $kero) {
|
||||
$valid = $this->objAuth->getPermissions($kero);
|
||||
|
||||
if ($valid['blg_editpage'] == 1) {
|
||||
if ($this->valid['blg_editpage'] == 1) {
|
||||
return DB::table('blg_content')
|
||||
->select('id', 'title', 'slug', 'isMenu', 'public_status', 'message')
|
||||
->where('isPost', 0)
|
||||
|
@ -227,4 +222,25 @@ class SiteController extends Controller {
|
|||
->first();
|
||||
}
|
||||
}
|
||||
|
||||
public function addContent ($bdl) {
|
||||
if (($this->valid['blg_addpost'] && $bdl['isPost'] == 1) || ($this->valid['blg_addpage'] && $bdl['isPost'] == 0)) {
|
||||
return DB::table('blg_content')->insert($bdl);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function editContent ($bdl) {
|
||||
if (($this->valid['blg_editpost'] && $bdl['isPost'] == 1) || ($this->valid['blg_editpage'] && $bdl['isPost'] == 0)) {
|
||||
return DB::table('blg_content')->where('slug', $bdl['slug'])->update($bdl);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function delContent ($bdl) {
|
||||
if (($this->valid['blg_delpost'] && $bdl['isPost'] == 1) || ($this->valid['blg_delpage'] && $bdl['isPost'] == 0)) {
|
||||
return DB::table('blg_content')->where('slug', $bdl['slug'])->delete();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
新しいイシューから参照