function saveMenu($option) { global $database; $params = mosGetParam($_POST, 'params', ''); $params[url] = mosGetParam($_POST, 'url', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = implode("\n", $txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } 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='{$row->menutype}' AND parent='{$row->parent}'"); mosRedirect("index2.php?option={$option}&menutype={$row->menutype}"); }
function saveMenu($option, $task) { global $database; $params = mosGetParam($_POST, 'params', ''); $params[url] = mosGetParam($_POST, 'url', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } 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($row->menutype) . ' AND parent = ' . (int) $row->parent); $msg = 'Item de menu salvo'; switch ($task) { case 'apply': mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype . '&task=edit&id=' . $row->id, $msg); break; case 'save': default: mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype, $msg); break; } }
/** * changes the access level of a record * @param integer The increment to reorder by */ function accessMenu($uid, $access, $option, $menutype) { global $database; $menu = new mosMenu($database); $menu->load($uid); $menu->access = $access; if (!$menu->check()) { return $menu->getError(); } if (!$menu->store()) { return $menu->getError(); } mosRedirect('index2.php?option=' . $option . '&menutype=' . $menutype); }
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 saveOrder(&$cid) { global $database; $order = mosGetParam($_POST, 'order', array(0)); $row = new mosMenu($database); $categories = array(); // update ordering values foreach ($cid as $i => $ciditem) { $row->load($ciditem); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $categories[$row->catid] = $row->id; } } // execute updateOrder for each group foreach ($categories as $catid => $rowid) { $row->updateOrder("catid = {$catid} AND state >= 0"); } // foreach $msg = T_('New ordering saved'); mosRedirect('index2.php?option=com_typedcontent', $msg); }
function saveMenu($option, $task) { global $database; $params = mosGetParam($_POST, 'params', ''); $catids = mosGetParam($_POST, 'catid', array()); $catid = implode(',', $catids); $params[categoryid] = $catid; if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (count($catids) == 1 && $catids[0] != "") { $row->link = str_replace("id=0", "id=" . $catids[0], $row->link); $row->componentid = $catids[0]; } 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='{$row->menutype}' AND parent='{$row->parent}'"); $msg = 'Menu item Saved'; switch ($task) { case 'apply': mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype . '&task=edit&id=' . $row->id, $msg); break; case 'save': default: mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype, $msg); break; } }
function saveMenu($option, $task) { global $database; $params = mosGetParam($_POST, 'params', ''); $secids = josGetArrayInts('secid'); $secid = implode(',', $secids); $params['sectionid'] = $secid; if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = mosParameters::textareaHandling($txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (count($secids) == 1 && $secids[0] != '') { $row->link = str_replace('id=0', 'id=' . $secids[0], $row->link); $row->componentid = $secids[0]; } 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($row->menutype) . " AND parent = " . (int) $row->parent); $msg = 'Iten de menu salvo'; switch ($task) { case 'apply': mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype . '&task=edit&id=' . $row->id, $msg); break; case 'save': default: mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype, $msg); break; } }
function menuLink($option) { global $database, $adminLanguage; $content = new mosContent($database); $content->bind($_POST); $content->checkin(); $menu = mosGetParam($_POST, 'menuselect', ''); $link = mosGetParam($_POST, 'link_name', ''); $id = mosGetParam($_POST, 'id', ''); $row = new mosMenu($database); $row->menutype = $menu; $row->name = $link; $row->type = 'content_item_link'; $row->published = 1; $row->componentid = $id; $row->link = 'index.php?option=com_content&task=view&id=' . $id; $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='{$row->menutype}' AND parent='{$row->parent}'"); $msg = $link . " " . $adminLanguage->A_COMP_CONTENT_IN_MENU . ": " . $menu . " " . $adminLanguage->A_COMP_CONTENT_SUCCESS; mosRedirect('index2.php?option=' . $option, $msg); }
function saveOrder(&$cid, $menutype) { global $database; $order = mosGetParam($_POST, 'order', array(0)); $row = new mosMenu($database); $parents = array(); // update ordering values foreach ($cid as $i => $ciditem) { $row->load($ciditem); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $parents[$row->parent] = $row->id; } } // execute updateOrder for each group foreach ($parents as $parent => $rowid) { $row->updateOrder("menutype = '{$menutype}' AND parent = '{$parent}' AND published >= 0"); } // foreach $msg = T_('New ordering saved'); mosRedirect('index2.php?option=com_menus&menutype=' . $menutype, $msg); }
function saveOrder(&$cid) { global $database; $order = mosGetParam($_POST, 'order', array(0)); $row = new mosMenu($database); $folders = array(); // update ordering values foreach ($cid as $i => $ciditem) { $row->load($ciditem); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $folders[$row->folder][$row->client_id] = $row->id; } } // execute updateOrder for each group foreach ($folders as $folder => $clients) { foreach ($clients as $client => $rowid) { $row->updateOrder("folder = '{$folder}' AND ordering > -10000 AND ordering < 10000 AND client_id = '{$client}'"); } } // foreach $msg = T_('New ordering saved'); mosRedirect('index2.php?option=com_mambots', $msg); }
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 saveOrder(&$cid, $menutype) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); $row = new mosMenu($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $condition = "menutype = " . $database->Quote($menutype) . " AND parent = " . (int) $row->parent . " AND published >= 0"; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } if (!$found) { $conditions[] = array($row->id, $condition); } } } // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'Nova ordenação salva'; mosRedirect('index2.php?option=com_menus&menutype=' . $menutype, $msg); }
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($redirect, $id) { global $database; $menu = mosGetParam($_POST, 'menuselect', ''); $link = mosGetParam($_POST, 'link_name', ''); $row = new mosMenu($database); $row->menutype = $menu; $row->name = $link; $row->type = 'content_item_link'; $row->published = 1; $row->componentid = $id; $row->link = 'index.php?option=com_content&task=view&id=' . $id; $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='{$row->menutype}' AND parent='{$row->parent}'"); $msg = sprintf(T_('%s (Link - Static Content) in menu: %s successfully created'), $link, $menu); mosRedirect('index2.php?option=com_content§ionid=' . $redirect . '&task=edit&hidemainmenu=1&id=' . $id, $msg); }
function menuLink($option, $id) { global $database; josSpoofCheck(); $menu = strval(mosGetParam($_POST, 'menuselect', '')); $link = strval(mosGetParam($_POST, 'link_name', '')); $link = stripslashes(ampReplace($link)); $row = new mosMenu($database); $row->menutype = $menu; $row->name = $link; $row->type = 'content_typed'; $row->published = 1; $row->componentid = $id; $row->link = 'index.php?option=com_content&task=view&id=' . $id; $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=" . $database->Quote($row->menutype) . " AND parent=" . (int) $row->parent); // clean any existing cache files mosCache::cleanCache('com_content'); $msg = $link . ' (Link - Static Content) in menu: ' . $menu . ' successfully created'; mosRedirect('index2.php?option=' . $option . '&task=edit&hidemainmenu=1&id=' . $id, $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 saveMenu($option) { global $database; $params = mosGetParam($_POST, 'params', ''); $secids = mosGetParam($_POST, 'secid', array()); $secid = implode(',', $secids); $params[sectionid] = $secid; if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $_POST['params'] = implode("\n", $txt); } $row = new mosMenu($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (count($secids) == 1 && $secids[0] != "") { $row->link = str_replace("id=0", "id=" . $secids[0], $row->link); $row->componentid = $secids[0]; } 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='{$row->menutype}' AND parent='{$row->parent}'"); mosRedirect('index2.php?option=' . $option . '&menutype=' . $row->menutype); }
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); }