Skip to content

Commit

Permalink
Fix wrong URL.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Aug 31, 2017
1 parent 6d7c73b commit bb63c0f
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions main/forum/viewforumcategory.php
Expand Up @@ -47,6 +47,8 @@ function hidecontent(content){

$_user = api_get_user_info();

$action = isset($_GET['action']) ? $_GET['action'] : '';

// Including necessary files
require 'forumconfig.inc.php';
require_once 'forumfunction.inc.php';
Expand All @@ -62,16 +64,14 @@ function hidecontent(content){
}

$sessionId = api_get_session_id();

$current_forum_category = get_forum_categories($_GET['forumcategory']);
$interbreadcrumb[] = array(
'url' => 'index.php?gradebook='.$gradebook.'&search='
. Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')),
'url' => 'index.php?'.api_get_cidreq().'&search='.Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')),
'name' => get_lang('Forum')
);

if (!empty($_GET['action']) && !empty($_GET['content'])) {
if ($_GET['action'] == 'add' && $_GET['content'] == 'forum') {
if (!empty($action) && !empty($_GET['content'])) {
if ($action == 'add' && $_GET['content'] == 'forum') {
$interbreadcrumb[] = array(
'url' => 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.$current_forum_category['cat_id'],
'name' => $current_forum_category['cat_title']
Expand Down Expand Up @@ -109,7 +109,7 @@ function hidecontent(content){

/* Action Links */
$html = '<div class="actions">';
$html .= '<a href="index.php?gradebook='.$gradebook.'&'.api_get_cidreq().'">'.
$html .= '<a href="index.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).'</a>';
if (api_is_allowed_to_edit(false, true)) {
$html .= '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&forumcategory='
Expand All @@ -122,18 +122,18 @@ function hidecontent(content){
/* ACTIONS */
echo $html;

$action_forums = isset($_GET['action']) ? $_GET['action'] : '';

if (api_is_allowed_to_edit(false, true)) {
handle_forum_and_forumcategories();
}

// Notification
if ($action_forums == 'notify' && isset($_GET['content']) && isset($_GET['id'])) {
if ($action == 'notify' && isset($_GET['content']) && isset($_GET['id'])) {
$return_message = set_notification($_GET['content'], $_GET['id']);
echo Display::return_message($return_message, 'confirm', false);
}

if ($action_forums != 'add') {
if ($action != 'add') {
/*
RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
Note: We do this here just after het handling of the actions to be sure that we already incorporate the
Expand Down Expand Up @@ -439,16 +439,15 @@ function hidecontent(content){
$html .= '</div>';
$html .= '<div class="col-md-4">';

$url = api_get_path(WEB_CODE_PATH).'forum/index.php';
$forumCategoryId = (int) $_GET['forumcategory'];

if (api_is_allowed_to_edit(false, true) &&
!($forum['session_id'] == 0 && $sessionId != 0)
) {
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
. Security::remove_XSS($_GET['forumcategory'])
. '&action=edit&content=forum&id='.$forum['forum_id'].'">'
$html .= '<a href="'.$url.'?'.api_get_cidreq().'&forumcategory='.$forumCategoryId.'&action=edit&content=forum&id='.$forum['forum_id'].'">'
. Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
. Security::remove_XSS($_GET['forumcategory'])
. '&action=delete&content=forum&id='.$forum['forum_id']
$html .= '<a href="'.$url.'?'.api_get_cidreq().'&forumcategory='.$forumCategoryId.'&action=delete&content=forum&id='.$forum['forum_id']
. "\" onclick=\"javascript:if(!confirm('"
. addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES))
. "')) return false;\">"
Expand All @@ -466,7 +465,11 @@ function hidecontent(content){
$forum['locked'],
array('forumcategory' => $_GET['forumcategory'])
);
$html .= return_up_down_icon('forum', $forum['forum_id'], $forums_in_category);
$html .= return_up_down_icon(
'forum',
$forum['forum_id'],
$forums_in_category
);
}

$iconnotify = 'notification_mail_na.png';
Expand All @@ -477,9 +480,9 @@ function hidecontent(content){
}

if (!api_is_anonymous()) {
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
. Security::remove_XSS($_GET['forumcategory']).'&action=notify&content=forum&id='
. $forum['forum_id'].'">'.Display::return_icon($iconnotify, get_lang('NotifyMe')).'</a>';
$html .= '<a href="'.$url.'?'.api_get_cidreq().'&forumcategory='.$forumCategoryId.'&action=notify&content=forum&id='.$forum['forum_id'].'">'.
Display::return_icon($iconnotify, get_lang('NotifyMe')).
'</a>';
}
$html .= '</div>';
$html .= '</div>';
Expand Down

0 comments on commit bb63c0f

Please sign in to comment.