โดย Ittichai_chupol » 13/02/2020 3:48 pm
วิธีการเขียนโคดในการตรวจสอบสิทธิ์ ที่ผมใช้ก็มีดังนี้
โค้ด: เลือกทั้งหมด
global $phpbb_container;
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$pagination = $phpbb_container->get('pagination');
global $auth;
$moderator_permissions_forum = $auth->acl_get('m_');
$sql_array = array(
'SELECT' => ' DISTINCT p.post_subject, u.user_colour, t.topic_poster,t.topic_first_poster_name, t.topic_last_post_id , t.topic_id ,p.post_text ,p.post_time ,p.post_subject ,u.username ,p.post_subject ,p.post_id,t.forum_id ,t.topic_id,u.user_id ,t.topic_views ,topic_first_post_id',
'FROM' => array(
POSTS_TABLE => 'p',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(TOPICS_TABLE => 't'),
'ON' => 'p.topic_id = t.topic_id',
),
array(
'FROM' => array(USERS_TABLE => 'u'),
'ON' => 't.topic_poster = u.user_id',
),
),
'WHERE' => $m_approve_topics_fid_sql . ' AND p.poster_id = ' . $uid . ' AND t.topic_first_post_id != p.post_id ',
'ORDER_BY' => ' p.post_time DESC',
);
if ($post_id != null) {
if ($uid != $this->user->data['user_id'] && $moderator_permissions_forum != 1 ) { //เป็นส่วนที่ใช้ในการตรวจสอบว่า เป็น admin หรือ mod
$sql_array['WHERE'] .= ' AND ' . $this->db->sql_in_set('p.post_id', $postid);
}
}
จึงอยากทราบว่าทำไม่จึงไม่สามารถตรวจสอบสิทธิ์ได้
- แนบไฟล์
-
วิธีการเขียนโคดในการตรวจสอบสิทธิ์ ที่ผมใช้ก็มีดังนี้
[code]
global $phpbb_container;
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$pagination = $phpbb_container->get('pagination');
global $auth;
$moderator_permissions_forum = $auth->acl_get('m_');
$sql_array = array(
'SELECT' => ' DISTINCT p.post_subject, u.user_colour, t.topic_poster,t.topic_first_poster_name, t.topic_last_post_id , t.topic_id ,p.post_text ,p.post_time ,p.post_subject ,u.username ,p.post_subject ,p.post_id,t.forum_id ,t.topic_id,u.user_id ,t.topic_views ,topic_first_post_id',
'FROM' => array(
POSTS_TABLE => 'p',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(TOPICS_TABLE => 't'),
'ON' => 'p.topic_id = t.topic_id',
),
array(
'FROM' => array(USERS_TABLE => 'u'),
'ON' => 't.topic_poster = u.user_id',
),
),
'WHERE' => $m_approve_topics_fid_sql . ' AND p.poster_id = ' . $uid . ' AND t.topic_first_post_id != p.post_id ',
'ORDER_BY' => ' p.post_time DESC',
);
if ($post_id != null) {
if ($uid != $this->user->data['user_id'] && $moderator_permissions_forum != 1 ) { //เป็นส่วนที่ใช้ในการตรวจสอบว่า เป็น admin หรือ mod
$sql_array['WHERE'] .= ' AND ' . $this->db->sql_in_set('p.post_id', $postid);
}
}
[/code]
จึงอยากทราบว่าทำไม่จึงไม่สามารถตรวจสอบสิทธิ์ได้