function menuLink($id) { global $database; josSpoofCheck(); $category = new mosCategory($database); $category->bind($_POST); $category->checkin(); $redirect = strval(mosGetParam($_POST, 'redirect', '')); $menu = stripslashes(strval(mosGetParam($_POST, 'menuselect', ''))); $name = strval(mosGetParam($_POST, 'link_name', '')); $sectionid = mosGetParam($_POST, 'sectionid', ''); $type = strval(mosGetParam($_POST, 'link_type', '')); $name = stripslashes(ampReplace($name)); switch ($type) { case 'content_category': $link = 'index.php?option=com_content&task=category§ionid=' . $sectionid . '&id=' . $id; $menutype = 'Content Category Table'; break; case 'content_blog_category': $link = 'index.php?option=com_content&task=blogcategory&id=' . $id; $menutype = 'Content Category Blog'; break; case 'content_archive_category': $link = 'index.php?option=com_content&task=archivecategory&id=' . $id; $menutype = 'Content Category Blog Archive'; break; case 'contact_category_table': $link = 'index.php?option=com_contact&catid=' . $id; $menutype = 'Contact Category Table'; break; case 'newsfeed_category_table': $link = 'index.php?option=com_newsfeeds&catid=' . $id; $menutype = 'Newsfeed Category Table'; break; case 'weblink_category_table': $link = 'index.php?option=com_weblinks&catid=' . $id; $menutype = 'Weblink Category Table'; break; } $row = new mosMenu($database); $row->menutype = $menu; $row->name = $name; $row->type = $type; $row->published = 1; $row->componentid = $id; $row->link = $link; $row->ordering = 9999; if ($type == 'content_blog_category') { $row->params = 'categoryid=' . $id; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("menutype = " . $database->Quote($menu)); if ($redirect == 'content') { // clean any existing cache files mosCache::cleanCache('com_content'); } $msg = $name . ' ( ' . $menutype . ' ) in menu: ' . $menu . ' successfully created'; mosRedirect('index2.php?option=com_categories§ion=' . $redirect . '&task=editA&hidemainmenu=1&id=' . $id, $msg); }
function menuLink($option) { global $database; global $adminLanguage; $category = new mosCategory($database); $category->bind($_POST); $category->checkin(); $redirect = mosGetParam($_POST, 'redirect', ''); $menu = mosGetParam($_POST, 'menuselect', ''); $name = mosGetParam($_POST, 'link_name', ''); $id = mosGetParam($_POST, 'id', ''); $sectionid = mosGetParam($_POST, 'sectionid', ''); $type = mosGetParam($_POST, 'link_type', ''); switch ($type) { case 'content_category': $link = 'index.php?option=com_content&task=category§ionid=' . $sectionid . '&id=' . $id; $menutype = 'Category Table'; break; case 'content_blog_category': $link = 'index.php?option=com_content&task=blogcategory&id=' . $id; $menutype = 'Category Blog'; break; case 'content_archive_category': $link = 'index.php?option=com_content&task=archivecategory&id=' . $id; $menutype = 'Category Blog Archive'; break; } $row = new mosMenu($database); $row->menutype = $menu; $row->name = $name; $row->type = $type; $row->published = 1; $row->componentid = $id; $row->link = $link; $row->ordering = 9999; if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("section='" . $sectionid . "'"); $msg = $name . ' ( ' . $menutype . ' ) in menu: ' . $menu . ' successfully created'; mosRedirect('index2.php?option=' . $option . '§ion=' . $redirect, $msg); }
function menuLink($id) { global $database; $category = new mosCategory($database); $category->bind($_POST); $category->checkin(); $redirect = mosGetParam($_POST, 'redirect', ''); $menu = mosGetParam($_POST, 'menuselect', ''); $name = mosGetParam($_POST, 'link_name', ''); $sectionid = mosGetParam($_POST, 'sectionid', ''); $type = mosGetParam($_POST, 'link_type', ''); switch ($type) { case 'content_category': $link = 'index.php?option=com_content&task=category§ionid=' . $sectionid . '&id=' . $id; $menutype = T_('Content Category Table'); break; case 'content_blog_category': $link = 'index.php?option=com_content&task=blogcategory&id=' . $id; $menutype = T_('Content Category Blog'); break; case 'content_archive_category': $link = 'index.php?option=com_content&task=archivecategory&id=' . $id; $menutype = T_('Content Category Blog Archive'); break; case 'contact_category_table': $link = 'index.php?option=com_contact&catid=' . $id; $menutype = T_('Contact Category Table'); break; case 'newsfeed_category_table': $link = 'index.php?option=com_newsfeeds&catid=' . $id; $menutype = T_('News Feed Category Table'); break; case 'weblink_category_table': $link = 'index.php?option=com_weblinks&catid=' . $id; $menutype = T_('Web Link Category Table'); break; default: } $row = new mosMenu($database); $row->menutype = $menu; $row->name = $name; $row->type = $type; $row->published = 1; $row->componentid = $id; $row->link = $link; $row->ordering = 9999; if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("menutype='" . $menu . "'"); $msg = sprintf(T_('%s ( %s ) in menu: %s successfully created'), $name, $menutype, $menu); mosRedirect('index2.php?option=com_categories§ion=' . $redirect . '&task=editA&hidemainmenu=1&id=' . $id, $msg); }