function menuLink($option) { global $database, $adminLanguage; $section = new mosSection($database); $section->bind($_POST); $section->checkin(); $menu = mosGetParam($_POST, 'menuselect', ''); $name = mosGetParam($_POST, 'link_name', ''); $id = mosGetParam($_POST, 'id', ''); $type = mosGetParam($_POST, 'link_type', ''); switch ($type) { case 'content_section': $link = 'index.php?option=com_content&task=section&id=' . $id; $menutype = 'Section Table'; break; case 'content_blog_section': $link = 'index.php?option=com_content&task=blogsection&id=' . $id; $menutype = 'Section Blog'; break; case 'content_archive_section': $link = 'index.php?option=com_content&task=archivesection&id=' . $id; $menutype = 'Section 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('scope="' . $row->scope . '"'); $msg = $name . " ( " . $menutype . " ) " . $adminLanguage->A_COMP_SECT_IN_MENU . ": " . $menu . " " . $adminLanguage->A_COMP_CONTENT_SUCCESS; mosRedirect('index2.php?option=com_sections&scope=content', $msg); }
function menuLink($id) { global $database; josSpoofCheck(); $section = new mosSection($database); $section->bind($_POST); $section->checkin(); $menu = strval(mosGetParam($_POST, 'menuselect', '')); $name = strval(mosGetParam($_POST, 'link_name', '')); $type = strval(mosGetParam($_POST, 'link_type', '')); $name = stripslashes(ampReplace($name)); switch ($type) { case 'content_section': $link = 'index.php?option=com_content&task=section&id=' . $id; $menutype = 'Section Table'; break; case 'content_blog_section': $link = 'index.php?option=com_content&task=blogsection&id=' . $id; $menutype = 'Section Blog'; break; case 'content_archive_section': $link = 'index.php?option=com_content&task=archivesection&id=' . $id; $menutype = 'Section 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 ($type == 'content_blog_section') { $row->params = 'sectionid=' . $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)); // clean any existing cache files mosCache::cleanCache('com_content'); $msg = $name . ' ( ' . $menutype . ' ) in menu: ' . $menu . ' successfully created'; mosRedirect('index2.php?option=com_sections&scope=content&task=editA&hidemainmenu=1&id=' . $id, $msg); }
function menuLink($id) { global $database; $section = new mosSection($database); $section->bind($_POST); $section->checkin(); $menu = mosGetParam($_POST, 'menuselect', ''); $name = mosGetParam($_POST, 'link_name', ''); $type = mosGetParam($_POST, 'link_type', ''); switch ($type) { case 'content_section': $link = 'index.php?option=com_content&task=section&id=' . $id; $menutype = T_('Section Table'); break; case 'content_blog_section': $link = 'index.php?option=com_content&task=blogsection&id=' . $id; $menutype = T_('Section Blog'); break; case 'content_archive_section': $link = 'index.php?option=com_content&task=archivesection&id=' . $id; $menutype = T_('Section 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('scope="' . $row->scope . '"'); $msg = sprintf(T_('%s ( %s ) in menu: %s successfully created'), $name, $menutype, $menu); mosRedirect('index2.php?option=com_sections&scope=content&task=editA&hidemainmenu=1&id=' . $id, $msg); }