header('Location: ' . AT_BASE_HREF . 'mods/_standard/links/index.php'); exit; } if (isset($_POST['submit'])) { $cat_parent_id = intval($_POST['cat_parent_id']); $cat_name = trim($_POST['cat_name']); if ($cat_name == '') { $msg->addError(array('EMPTY_FIELDS', _AT('title'))); } if (!$msg->containsErrors()) { if (!empty($cat_parent_id)) { $cat_parent_id = explode('-', $_POST['cat_parent_id']); $parent_id = intval($cat_parent_id[0]); $owner_type = intval($cat_parent_id[1]); $owner_id = intval($cat_parent_id[2]); if (!links_authenticate($owner_type, $owner_id)) { $msg->addError('ACCESS_DENIED'); header('Location: ' . AT_BASE_HREF . 'index.php'); exit; } } else { $owner_type = LINK_CAT_COURSE; $owner_id = $_SESSION['course_id']; $parent_id = 0; } //Check length of the post, if it's exceeded 100 as defined in the db. if ($strlen($cat_name) > 100) { $cat_name = $substr($cat_name, 0, 100); } queryDB('INSERT INTO %slinks_categories VALUES (DEFAULT, %s, %d, "%s", %d)', array(TABLE_PREFIX, $owner_type, $owner_id, $cat_name, $parent_id)); $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
$linkIndexHeader = sprintf('Location: %smods/_standard/links/tools/index.php', AT_BASE_HREF); if (!manage_links()) { $msg->addError('ACCESS_DENIED'); header('Location: ' . AT_BASE_HREF . 'mods/_standard/links/index.php'); exit; } $lid = explode('-', $_REQUEST['lid']); $link_id = intval($lid[0]); if (isset($_POST['submit_no'])) { $msg->addFeedback('CANCELLED'); header($linkIndexHeader); exit; } else { if (isset($_POST['submit_yes'])) { $row = get_cat_info(intval($_POST['cat_id'])); if (!links_authenticate($row['owner_type'], $row['owner_id'])) { $msg->addError('ACCESS_DENIED'); header($linkIndexHeader); exit; } queryDB('DELETE FROM %slinks WHERE link_id=%d', array(TABLE_PREFIX, $_POST[link_id])); $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header($linkIndexHeader); exit; } } $_section[0][0] = _AT('delete_link'); require_once AT_INCLUDE_PATH . 'header.inc.php'; $row = queryDB('SELECT LinkName, cat_id FROM %slinks WHERE link_id=%d', array(TABLE_PREFIX, $link_id), true); if (empty($row)) { $msg->printErrors('LINK_NOT_FOUND');