Skip to content

Commit

Permalink
Merge pull request atutor#54 from dhruvj/ISSUE-5224
Browse files Browse the repository at this point in the history
ISSUE-5224 - Fixed Redirection while Deleting a page on the sitemap
  • Loading branch information
atutorlangs committed Mar 22, 2013
2 parents ea7fbd4 + d0a89c0 commit 4e406aa
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 21 deletions.
7 changes: 4 additions & 3 deletions include/classes/ContentManager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ function printMenu($parent_id, $depth, $path, $children, $truncate, $ignore_stat
global $cid, $_my_uri, $_base_path, $rtl, $substr, $strlen;
static $temp_path;

$redirect_to = ($from == 'sitemap') ? '1' : '0';
if (!isset($temp_path)) {
if ($cid) {
$temp_path = $this->getContentPath($cid);
Expand Down Expand Up @@ -971,7 +972,7 @@ function printMenu($parent_id, $depth, $path, $children, $truncate, $ignore_stat

// instructors have privilege to delete content
if (authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && !isset($content['test_id']) && !is_mobile_device()) {
$link .= '<a href="'.$_base_path.'mods/_core/editor/delete_content.php?cid='.$content['content_id'].'"><img src="'.AT_BASE_HREF.'images/x.gif" alt="'._AT("delete_content").'" title="'._AT("delete_content").'" class="del-content-icon" /></a>';
$link .= '<a href="'.$_base_path.'mods/_core/editor/delete_content.php?cid='.$content['content_id'].'&redirect_to='.$redirect_to.'"><img src="'.AT_BASE_HREF.'images/x.gif" alt="'._AT("delete_content").'" title="'._AT("delete_content").'" class="del-content-icon" /></a>';
}
}
else
Expand Down Expand Up @@ -1005,7 +1006,7 @@ function printMenu($parent_id, $depth, $path, $children, $truncate, $ignore_stat

// instructors have privilege to delete content
if (authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && !is_mobile_device()) {
$link .= '<a href="'.$_base_path.'mods/_core/editor/delete_content.php?cid='.$content['content_id'].'"><img src="'.AT_BASE_HREF.'images/x.gif" alt="'._AT("delete_content").'" title="'._AT("delete_content").'" class="del-content-icon" /></a>';
$link .= '<a href="'.$_base_path.'mods/_core/editor/delete_content.php?cid='.$content['content_id'].'&redirect_to='.$redirect_to.'"><img src="'.AT_BASE_HREF.'images/x.gif" alt="'._AT("delete_content").'" title="'._AT("delete_content").'" class="del-content-icon" /></a>';
}
}
else
Expand Down Expand Up @@ -1039,7 +1040,7 @@ function printMenu($parent_id, $depth, $path, $children, $truncate, $ignore_stat

// instructors have privilege to delete content
if (authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && !is_mobile_device()) {
$link .= '<a href="'.$_base_path.'mods/_core/editor/delete_content.php?cid='.$content['content_id'].'"><img src="'.AT_BASE_HREF.'images/x.gif" alt="'._AT("delete_content").'" title="'._AT("delete_content").'" class="del-content-icon" /></a>';
$link .= '<a href="'.$_base_path.'mods/_core/editor/delete_content.php?cid='.$content['content_id'].'&redirect_to='.$redirect_to.'"><img src="'.AT_BASE_HREF.'images/x.gif" alt="'._AT("delete_content").'" title="'._AT("delete_content").'" class="del-content-icon" /></a>';
}
}

Expand Down
32 changes: 18 additions & 14 deletions logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@
$sql = "DELETE FROM ".TABLE_PREFIX."users_online WHERE member_id=$_SESSION[member_id]";
@mysql_query($sql, $db);

unset($_SESSION['login']);
unset($_SESSION['valid_user']);
unset($_SESSION['member_id']);
unset($_SESSION['is_admin']);
unset($_SESSION['course_id']);
unset($_SESSION['prefs']);
unset($_SESSION['dd_question_ids']);
unset($_SESSION['flash']);
unset($_SESSION['userAgent']);
unset($_SESSION['IPaddress']);
unset($_SESSION['OBSOLETE']);
unset($_SESSION['EXPIRES']);
unset($_SESSION['token']);

// Unset these Session keys at the time of logout.
$unset_session = array('login',
'valid_user',
'member_id',
'is_admin',
'course_id',
'prefs',
'dd_question_ids',
'flash',
'userAgent',
'IPaddress',
'OBSOLETE',
'EXPIRES',
'redirect_to',
'token');
foreach ($unset_session as $session_name) {
unset($_SESSION[$session_name]);
}
$msg->addFeedback('LOGOUT');
header('Location: login.php');
exit;
Expand Down
17 changes: 13 additions & 4 deletions mods/_core/editor/delete_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
define('AT_INCLUDE_PATH', '../../../include/');
require(AT_INCLUDE_PATH.'vitals.inc.php');

if (isset($_GET['redirect_to'])) {
$_SESSION['redirect_to'] = intval($_GET['redirect_to']);
} else {
if (!isset($_POST['submit_yes']) && !isset($_POST['submit_no'])) {
$_SESSION['redirect_to'] = 0;
}
}
if (isset($_POST['submit_yes'])) {

$_POST['cid'] = intval($_POST['cid']);
Expand All @@ -25,12 +32,14 @@
unset($_SESSION['from_cid']);

$msg->addFeedback('CONTENT_DELETED');
header('Location: '.AT_BASE_HREF.'mods/_core/content/index.php');
exit;
} else if (isset($_POST['submit_no'])) {
$msg->addFeedback('CANCELLED');
header('Location: '.AT_BASE_HREF.'mods/_core/content/index.php');
exit;
}
if (isset($_POST['submit_yes']) || isset($_POST['submit_no'])) {
$location = ($_SESSION['redirect_to'] == 1) ? 'mods/_standard/sitemap/sitemap.php' : 'mods/_core/content/index.php';
header('Location: '.AT_BASE_HREF.$location);
unset($_SESSION['redirect_to']);
exit;
}

$_GET['cid'] = intval($_REQUEST['cid']);
Expand Down

0 comments on commit 4e406aa

Please sign in to comment.