[ticket/382] More code clean up
B3P-382
This commit is contained in:
@@ -213,6 +213,10 @@ class leaders extends module_base
|
|||||||
{
|
{
|
||||||
$which_row = 'b3p_moderators';
|
$which_row = 'b3p_moderators';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($row['group_type'] == GROUP_HIDDEN && !$this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $this->user->data['user_id'])
|
if ($row['group_type'] == GROUP_HIDDEN && !$this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $this->user->data['user_id'])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ class links extends module_base
|
|||||||
*/
|
*/
|
||||||
public function get_template_side($module_id)
|
public function get_template_side($module_id)
|
||||||
{
|
{
|
||||||
$links = array();
|
|
||||||
$portal_config = obtain_portal_config();
|
$portal_config = obtain_portal_config();
|
||||||
|
|
||||||
$links = $this->utf_unserialize($portal_config['board3_links_array_' . $module_id]);
|
$links = $this->utf_unserialize($portal_config['board3_links_array_' . $module_id]);
|
||||||
@@ -116,7 +115,7 @@ class links extends module_base
|
|||||||
|
|
||||||
for ($i = 0; $i < sizeof($links); $i++)
|
for ($i = 0; $i < sizeof($links); $i++)
|
||||||
{
|
{
|
||||||
if($links[$i]['type'] == self::LINK_INT)
|
if ($links[$i]['type'] == self::LINK_INT)
|
||||||
{
|
{
|
||||||
$links[$i]['url'] = str_replace('&', '&', $links[$i]['url']); // we need to do this in order to prevent XHTML validation errors
|
$links[$i]['url'] = str_replace('&', '&', $links[$i]['url']); // we need to do this in order to prevent XHTML validation errors
|
||||||
$cur_url = append_sid($this->phpbb_root_path . $links[$i]['url']); // the user should know what kind of file it is
|
$cur_url = append_sid($this->phpbb_root_path . $links[$i]['url']); // the user should know what kind of file it is
|
||||||
@@ -129,7 +128,7 @@ class links extends module_base
|
|||||||
$cur_permissions = explode(',', $links[$i]['permission']);
|
$cur_permissions = explode(',', $links[$i]['permission']);
|
||||||
$permission_check = array_intersect($groups_ary, $cur_permissions);
|
$permission_check = array_intersect($groups_ary, $cur_permissions);
|
||||||
|
|
||||||
if(!empty($permission_check) || $links[$i]['permission'] == '')
|
if (!empty($permission_check) || $links[$i]['permission'] == '')
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('portallinks', array(
|
$this->template->assign_block_vars('portallinks', array(
|
||||||
'LINK_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'],
|
'LINK_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'],
|
||||||
@@ -186,7 +185,7 @@ class links extends module_base
|
|||||||
'',
|
'',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($links_urls as $i => $url)
|
foreach ($links_urls as $i => $url)
|
||||||
{
|
{
|
||||||
$links[] = array(
|
$links[] = array(
|
||||||
'title' => $links_titles[$i],
|
'title' => $links_titles[$i],
|
||||||
@@ -243,8 +242,6 @@ class links extends module_base
|
|||||||
$link_id = $this->request->variable('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
$link_id = $this->request->variable('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
||||||
$portal_config = obtain_portal_config();
|
$portal_config = obtain_portal_config();
|
||||||
|
|
||||||
$links = array();
|
|
||||||
|
|
||||||
$links = $this->utf_unserialize($portal_config['board3_links_array_' . $module_id]);
|
$links = $this->utf_unserialize($portal_config['board3_links_array_' . $module_id]);
|
||||||
|
|
||||||
$u_action = append_sid('index.' . $this->php_ext, 'i=\board3\portal\acp\portal_module&mode=config&module_id=' . $module_id);
|
$u_action = append_sid('index.' . $this->php_ext, 'i=\board3\portal\acp\portal_module&mode=config&module_id=' . $module_id);
|
||||||
@@ -270,7 +267,7 @@ class links extends module_base
|
|||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . GROUPS_TABLE . '
|
||||||
ORDER BY group_id ASC';
|
ORDER BY group_id ASC';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$groups_ary[] = $row['group_id'];
|
$groups_ary[] = $row['group_id'];
|
||||||
}
|
}
|
||||||
@@ -419,7 +416,7 @@ class links extends module_base
|
|||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . GROUPS_TABLE . '
|
||||||
ORDER BY group_id ASC';
|
ORDER BY group_id ASC';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('permission_setting_link', array(
|
$this->template->assign_block_vars('permission_setting_link', array(
|
||||||
'SELECTED' => (in_array($row['group_id'], $groups_ary)) ? true : false,
|
'SELECTED' => (in_array($row['group_id'], $groups_ary)) ? true : false,
|
||||||
@@ -430,8 +427,6 @@ class links extends module_base
|
|||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < sizeof($links); $i++)
|
for ($i = 0; $i < sizeof($links); $i++)
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ class main_menu extends module_base
|
|||||||
*/
|
*/
|
||||||
public function get_template_side($module_id)
|
public function get_template_side($module_id)
|
||||||
{
|
{
|
||||||
$links = array();
|
|
||||||
$portal_config = obtain_portal_config();
|
$portal_config = obtain_portal_config();
|
||||||
|
|
||||||
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
|
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
|
||||||
@@ -117,7 +116,7 @@ class main_menu extends module_base
|
|||||||
|
|
||||||
for ($i = 0; $i < sizeof($links); $i++)
|
for ($i = 0; $i < sizeof($links); $i++)
|
||||||
{
|
{
|
||||||
if($links[$i]['type'] == self::LINK_CAT)
|
if ($links[$i]['type'] == self::LINK_CAT)
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('portalmenu', array(
|
$this->template->assign_block_vars('portalmenu', array(
|
||||||
'CAT_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'],
|
'CAT_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'],
|
||||||
@@ -126,7 +125,7 @@ class main_menu extends module_base
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($links[$i]['type'] == self::LINK_INT)
|
if ($links[$i]['type'] == self::LINK_INT)
|
||||||
{
|
{
|
||||||
$links[$i]['url'] = str_replace('&', '&', $links[$i]['url']); // we need to do this in order to prevent XHTML validation errors
|
$links[$i]['url'] = str_replace('&', '&', $links[$i]['url']); // we need to do this in order to prevent XHTML validation errors
|
||||||
$cur_url = append_sid($this->phpbb_root_path . $links[$i]['url']); // the user should know what kind of file it is
|
$cur_url = append_sid($this->phpbb_root_path . $links[$i]['url']); // the user should know what kind of file it is
|
||||||
@@ -139,7 +138,7 @@ class main_menu extends module_base
|
|||||||
$cur_permissions = explode(',', $links[$i]['permission']);
|
$cur_permissions = explode(',', $links[$i]['permission']);
|
||||||
$permission_check = array_intersect($groups_ary, $cur_permissions);
|
$permission_check = array_intersect($groups_ary, $cur_permissions);
|
||||||
|
|
||||||
if(!empty($permission_check) || $links[$i]['permission'] == '')
|
if (!empty($permission_check) || $links[$i]['permission'] == '')
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('portalmenu.links', array(
|
$this->template->assign_block_vars('portalmenu.links', array(
|
||||||
'LINK_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'],
|
'LINK_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'],
|
||||||
@@ -175,10 +174,11 @@ class main_menu extends module_base
|
|||||||
{
|
{
|
||||||
// get the correct group IDs from the database
|
// get the correct group IDs from the database
|
||||||
$in_ary = array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA');
|
$in_ary = array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA');
|
||||||
|
$groups_ary = array();
|
||||||
|
|
||||||
$sql = 'SELECT group_id, group_name FROM ' . GROUPS_TABLE . ' WHERE ' . $this->db->sql_in_set('group_name', $in_ary);
|
$sql = 'SELECT group_id, group_name FROM ' . GROUPS_TABLE . ' WHERE ' . $this->db->sql_in_set('group_name', $in_ary);
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$groups_ary[$row['group_name']] = $row['group_id'];
|
$groups_ary[$row['group_name']] = $row['group_id'];
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ class main_menu extends module_base
|
|||||||
'',
|
'',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($links_urls as $i => $url)
|
foreach ($links_urls as $i => $url)
|
||||||
{
|
{
|
||||||
$links[] = array(
|
$links[] = array(
|
||||||
'title' => $links_titles[$i],
|
'title' => $links_titles[$i],
|
||||||
@@ -298,8 +298,6 @@ class main_menu extends module_base
|
|||||||
$link_id = $this->request->variable('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
$link_id = $this->request->variable('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
||||||
$portal_config = obtain_portal_config();
|
$portal_config = obtain_portal_config();
|
||||||
|
|
||||||
$links = array();
|
|
||||||
|
|
||||||
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
|
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
|
||||||
|
|
||||||
$u_action = append_sid('index.' . $this->php_ext, 'i=%5Cboard3%5Cportal%5Cacp%5Cportal_module&mode=config&module_id=' . $module_id);
|
$u_action = append_sid('index.' . $this->php_ext, 'i=%5Cboard3%5Cportal%5Cacp%5Cportal_module&mode=config&module_id=' . $module_id);
|
||||||
@@ -326,7 +324,7 @@ class main_menu extends module_base
|
|||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . GROUPS_TABLE . '
|
||||||
ORDER BY group_id ASC';
|
ORDER BY group_id ASC';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$groups_ary[] = $row['group_id'];
|
$groups_ary[] = $row['group_id'];
|
||||||
}
|
}
|
||||||
@@ -481,7 +479,7 @@ class main_menu extends module_base
|
|||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . GROUPS_TABLE . '
|
||||||
ORDER BY group_id ASC';
|
ORDER BY group_id ASC';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('permission_setting_menu', array(
|
$this->template->assign_block_vars('permission_setting_menu', array(
|
||||||
'SELECTED' => (in_array($row['group_id'], $groups_ary)) ? true : false,
|
'SELECTED' => (in_array($row['group_id'], $groups_ary)) ? true : false,
|
||||||
@@ -492,8 +490,6 @@ class main_menu extends module_base
|
|||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < sizeof($links); $i++)
|
for ($i = 0; $i < sizeof($links); $i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user