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 redirect($id) { global $database; $menu = new mosMenu($database); $menu->bind($_POST); $menuid = intval(mosGetParam($_POST, 'menuid', 0)); if ($menuid) { $menu->id = $menuid; } $menu->checkin(); mosRedirect('index2.php?option=com_typedcontent&task=edit&id=' . $id); }
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; } }
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); }
/** * Cancels an edit operation */ function cancelMenu($option) { global $database; $menu = new mosMenu($database); $menu->bind($_POST); $menuid = mosGetParam($_POST, 'menuid', 0); if ($menuid) { $menu->id = $menuid; } $menu->checkin(); if ($menu->type == 'content_typed') { $contentid = mosGetParam($_POST, 'id', 0); $content = new mosContent($database); $content->load($contentid); $content->checkin(); } mosRedirect('index2.php?option=' . $option . '&menutype=' . $menu->menutype); }
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; } }
/** * Cancels an edit operation */ function cancelMenu($option) { global $database; josSpoofCheck(); $menu = new mosMenu($database); $menu->bind($_POST); $menuid = intval(mosGetParam($_POST, 'menuid', 0)); if ($menuid) { $menu->id = $menuid; } $menu->checkin(); mosRedirect('index2.php?option=' . $option . '&menutype=' . $menu->menutype); }
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; } }