/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editCategory($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_archive_category'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for category $lists['componentid'] = mosAdminMenus::Category($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_archive_category_menu_html::editCategory($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ public static function editSection($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator"); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_section'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for section $lists['componentid'] = mosAdminMenus::Section($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_section_menu_html::editSection($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editSection($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_section'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for section $lists['componentid'] = mosAdminMenus::Section($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_section_menu_html::editSection($menu, $lists, $params, $option); }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('The module {$menu->title} is currently being edited by another administrator'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'content_typed'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('id=', $menu->link); $query = "SELECT a.title, a.title_alias" . "\n FROM #__content AS a" . "\n WHERE a.id = '" . $temp[1] . "'"; $database->setQuery($query); $content = $database->loadObjectlist(); // outputs item name, category & section instead of the select list if ($content[0]->title_alias) { $alias = ' (<i>' . $content[0]->title_alias . '</i>)'; } else { $alias = ''; } $lists['content'] = '<input type="hidden" name="content_typed" value="' . $temp[1] . '" />' . $content[0]->title . $alias; $contents = ''; } else { $query = "SELECT a.id AS value, CONCAT( a.title, '(', a.title_alias, ')' ) AS text" . "\n FROM #__content AS a" . "\n WHERE a.state = '1'" . "\n AND a.sectionid = '0'" . "\n AND a.catid = '0'" . "\n ORDER BY a.id, a.title"; $database->setQuery($query); $contents = $database->loadObjectList(); // Create a list of links $lists['content'] = mosHTML::selectList($contents, 'content_typed', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'component'); content_menu_html::edit($menu, $lists, $params, $option, $contents); }
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 edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module %s is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'component_item_link'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('&Itemid=', $menu->link); $query = "SELECT a.name" . "\n FROM #__menu AS a" . "\n WHERE a.link = '" . $temp[0] . "'"; $database->setQuery($query); $components = $database->loadResult(); $lists['components'] = $components; $lists['components'] .= '<input type="hidden" name="link" value="' . $menu->link . '" />'; } else { $query = "SELECT CONCAT( a.link, '&Itemid=', a.id ) AS value, a.name AS text" . "\n FROM #__menu AS a" . "\n WHERE a.published = '1'" . "\n AND a.type = 'components'" . "\n ORDER BY a.menutype, a.name"; $database->setQuery($query); $components = $database->loadObjectList(); // Create a list of links $lists['components'] = mosHTML::selectList($components, 'link', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid, 1); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); component_item_link_menu_html::edit($menu, $lists, $params, $option); }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'component_item_link'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('&Itemid=', $menu->link); $query = "SELECT a.name" . "\n FROM #__menu AS a" . "\n WHERE a.link = " . $database->Quote($temp[0]); $database->setQuery($query); $components = $database->loadResult(); $lists['components'] = $components; $lists['components'] .= '<input type="hidden" name="link" value="' . $menu->link . '" />'; } else { $query = "SELECT CONCAT( a.link, '&Itemid=', a.id ) AS value, a.name AS text" . "\n FROM #__menu AS a" . "\n WHERE a.published = 1" . "\n AND a.type = 'components'" . "\n ORDER BY a.menutype, a.name"; $database->setQuery($query); $components = $database->loadObjectList(); // Create a list of links $lists['components'] = mosHTML::selectList($components, 'link', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid, 1); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); component_item_link_menu_html::edit($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function edit($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); $row = new mosComponent($database); // load the row from the db table $row->load($menu->componentid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('"The module %s is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { // do stuff for existing item $menu->checkout($my->id); } else { // do stuff for new item $menu->type = 'components'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } $query = "SELECT c.id AS value, c.name AS text, c.link" . "\n FROM #__components AS c" . "\n WHERE c.link <> ''" . "\n ORDER BY c.name"; $database->setQuery($query); $components = $database->loadObjectList(); // build the html select list for section $lists['componentid'] = mosAdminMenus::Component($menu, $uid); // componentname $lists['componentname'] = mosAdminMenus::ComponentName($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('com_xml', $row->option), 'component'); components_menu_html::edit($menu, $components, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function edit($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); $row = new mosComponent($database); // load the row from the db table $row->load((int) $menu->componentid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { // do stuff for existing item $menu->checkout($my->id); } else { // do stuff for new item $menu->type = 'components'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } $query = "SELECT c.id AS value, c.name AS text, c.link" . "\n FROM #__components AS c" . "\n WHERE c.link != ''" . "\n ORDER BY c.name"; $database->setQuery($query); $components = $database->loadObjectList(); // build the html select list for section $lists['componentid'] = mosAdminMenus::Component($menu, $uid); // componentname $lists['componentname'] = mosAdminMenus::ComponentName($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('com_xml', $row->option), 'component'); components_menu_html::edit($menu, $components, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editCategory($uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'weblink_category_table'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build list of categories $lists['componentid'] = mosAdminMenus::ComponentCategory('componentid', 'com_weblinks', intval($menu->componentid), NULL, 'ordering', 5, 0); if ($uid) { $query = "SELECT name" . "\n FROM #__categories" . "\n WHERE section = 'com_weblinks'" . "\n AND published = '1'" . "\n AND id = " . $menu->componentid; $database->setQuery($query); $category = $database->loadResult(); $lists['componentid'] = '<input type="hidden" name="componentid" value="' . $menu->componentid . '" />' . $category; } // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); weblink_category_table_menu_html::editCategory($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editCategory($uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'newsfeed_category_table'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build list of categories $lists['componentid'] = mosAdminMenus::ComponentCategory('componentid', 'com_newsfeeds', intval($menu->componentid), NULL, 'name', 10, 0); if ($uid) { $query = "SELECT name" . "\n FROM #__categories" . "\n WHERE section = 'com_newsfeeds'" . "\n AND published = 1" . "\n AND id = " . (int) $menu->componentid; $database->setQuery($query); $category = $database->loadResult(); $lists['componentid'] = '<input type="hidden" name="componentid" value="' . $menu->componentid . '" />' . $category; } // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); newsfeed_category_table_menu_html::editCategory($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function edit($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('The module {$menu->title} is currently being edited by another administrator'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { // do stuff for existing item $menu->checkout($my->id); } else { // do stuff for new item $menu->type = 'separator'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if (empty($menu->name)) { $menu->name = '- - - - - - -'; } // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // get params definitions $params =& new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'component'); separator_menu_html::edit($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function edit($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { // do stuff for existing item $menu->checkout($my->id); } else { // do stuff for new item $menu->type = 'separator'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if (empty($menu->name)) { $menu->name = '- - - - - - -'; } // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); separator_menu_html::edit($menu, $lists, $params, $option); }
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 showArchiveCategory($id = 0, $gid, &$access, $pop, $option, $now) { global $database, $mainframe, $mosConfig_offset; global $Itemid; // Parameters $noauth = !$mainframe->getCfg('shownoauth'); $year = mosGetParam($_REQUEST, 'year', date('Y')); $month = mosGetParam($_REQUEST, 'month', date('m')); $module = trim(mosGetParam($_REQUEST, 'module', '')); // used by archive module if ($module) { $check = ''; } else { $check = 'AND a.catid = ' . $id; } if ($Itemid) { $menu = new mosMenu($database); $menu->load($Itemid); $params =& new mosParameters($menu->params); } else { $menu = ""; $params =& new mosParameters(''); } $params->set('year', $year); $params->set('month', $month); // Ordering control $orderby_sec = $params->def('orderby', 'rdate'); $order_sec = _orderby_sec($orderby_sec); // used in query $where = _where(-2, $access, $noauth, $gid, $id, NULL, $year, $month); // query to determine if there are any archived entries for the category $query = "SELECT a.id" . "\n FROM #__content as a" . "\n WHERE a.state = '-1'" . "\n " . $check; $database->setQuery($query); $items = $database->loadObjectList(); $archives = count($items); $query = "SELECT a.*, ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count, u.name AS author, u.usertype, s.name AS section, g.name AS groups" . "\n FROM #__content AS a" . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n LEFT JOIN #__groups AS g ON a.access = g.id" . (count($where) ? "\n WHERE " . implode("\n AND ", $where) : '') . "\n AND s.access <= " . $gid . "\n ORDER BY " . $order_sec; $database->setQuery($query); $rows = $database->loadObjectList(); // initiate form echo '<form action="' . sefRelToAbs('index.php?option=' . $option . '&task=archivecategory&id=' . $id . '&Itemid=' . $Itemid) . '" method="post">'; // Page Title $mainframe->SetPageTitle($menu->name); if (!$archives) { // if no archives for category, hides search and outputs empty message echo '<br /><div align="center">' . _CATEGORY_ARCHIVE_EMPTY . '</div>'; } else { BlogOutput($rows, $params, $gid, $access, $pop, $menu, 1); } echo '</form>'; }
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); }
/** * Save the item(s) to the menu selected */ function copyMenuSave($option, $cid, $menu, $menutype) { global $database, $my; $total = count($cid); $copy = new mosMenu($database); $original = new mosMenu($database); foreach ($cid as $id) { $original->load($id); $copy = $original; $copy->id = NULL; $copy->ordering = '9999'; $copy->menutype = $menu; if (!$copy->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $copy->updateOrder("menutype='" . $copy->menutype . "' AND parent='" . $copy->parent . "'"); } $msg = $total . $adminLanguage->A_COMP_MENUS_COPIED_TO . $menu; mosRedirect('index2.php?option=' . $option . '&menutype=' . $menutype . '&mosmsg=' . $msg); }
require_once $LangPath . $mosConfig_lang . '.php'; } else { require_once $LangPath . 'english.php'; } require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapConfig.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapSitemap.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapPlugins.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapCache.php'; global $xSitemap, $xConfig; $xConfig = new XmapConfig(); $xConfig->load(); $Itemid = intval(mosGetParam($_REQUEST, 'Itemid', '')); $sitemapid = ''; // Firts lets try to get the sitemap's id from the menu's params if ($Itemid) { $menu = new mosMenu($database); $menu->load($Itemid); $params = new mosParameters($menu->params); $sitemapid = intval($params->get('sitemap', '')); } if (!$sitemapid) { //If the is no sitemap id specificated $sitemapid = intval(mosGetParam($_REQUEST, 'sitemap', '')); } if (!$sitemapid && $xConfig->sitemap_default) { $sitemapid = $xConfig->sitemap_default; } $xSitemap = new XmapSitemap(); $xSitemap->load($sitemapid); if (!$xSitemap->id) { echo _XMAP_MSG_NO_SITEMAP;
/** * Permanently deletes the selected list of trash items */ function deleteTrash($cid, $option) { global $database, $mainframe, $adminLanguage; $type = mosGetParam($_POST, 'type', array(0)); $total = count($cid); if ($type == "content") { $obj = new mosContent($database); $fp = new mosFrontPage($database); foreach ($cid as $id) { $id = intval($id); $obj->delete($id); $fp->delete($id); } } else { if ($type == "menu") { $obj = new mosMenu($database); foreach ($cid as $id) { $id = intval($id); $obj->delete($id); } } } $msg = $total . " " . $adminLanguage->A_COMP_TRASH_SUCCESS_DEL; mosRedirect("index2.php?option={$option}&mosmsg=" . $msg . ""); }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'newsfeed_link'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('feedid=', $menu->link); $query = "SELECT *, c.title AS category" . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n WHERE a.id = " . (int) $temp[1]; $database->setQuery($query); $newsfeed = $database->loadObjectlist(); // outputs item name, category & section instead of the select list $lists['newsfeed'] = ' <table width="100%"> <tr> <td width="10%"> Item: </td> <td> ' . $newsfeed[0]->name . ' </td> </tr> <tr> <td width="10%"> Position: </td> <td> ' . $newsfeed[0]->category . ' </td> </tr> </table>'; $lists['newsfeed'] .= '<input type="hidden" name="newsfeed_link" value="' . $temp[1] . '" />'; $newsfeeds = ''; } else { $query = "SELECT a.id AS value, CONCAT( c.title, ' - ', a.name ) AS text, a.catid " . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n WHERE a.published = 1" . "\n ORDER BY a.catid, a.name"; $database->setQuery($query); $newsfeeds = $database->loadObjectList(); // Create a list of links $lists['newsfeed'] = mosHTML::selectList($newsfeeds, 'newsfeed_link', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); newsfeed_link_menu_html::edit($menu, $lists, $params, $option, $newsfeeds); }
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($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); }
/** * Copies a complete menu, all its items and creates a new module, using the name speified */ function copyMenu($option, $cid, $menu_name, $type) { global $database, $adminLanguage; $mids = mosGetParam($_POST, 'mids', ''); // create the module copy foreach ($cid as $id) { $row = new mosModule($database); $row->load($id); $row->title = $menu_name; $row->iscore = 0; $row->published = 0; $row->position = "left"; $row->module = "mod_mainmenu"; $row->params = "menutype=" . $menu_name . ""; 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("position='" . $row->position . "'"); } $total = count($mids); $copy = new mosMenu($database); $original = new mosMenu($database); foreach ($mids as $mid) { $original->load($mid); $copy = $original; $copy->id = NULL; $copy->menutype = $menu_name; if (!$copy->check()) { echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$copy->store()) { echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n"; exit; } } $msg = $adminLanguage->A_COMP_MENU_COPY_OF . " `" . $type . "` " . $adminLanguage->A_COMP_MENU_CONSIST . " " . $total . " " . $adminLanguage->A_COMP_ITEMS; mosRedirect("index2.php?option=com_menumanager&mosmsg=" . $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); }
/** Print component heading, etc. Then call getHtmlList() to print list */ function startOutput(&$menus, &$config) { global $database, $Itemid; $sitemap =& $this->sitemap; $menu = new mosMenu($database); $menu->load($Itemid); // Load params for the Xmap menu-item $title = $menu->name; $exlink[0] = $sitemap->exlinks; // image to mark popup links $exlink[1] = $sitemap->ext_image; if ($sitemap->columns > 1) { // calculate column widths $total = count($menus); $columns = $total < $sitemap->columns ? $total : $sitemap->columns; $this->_width = 100 / $columns - 1; } echo '<div class="' . $sitemap->classname . '">'; echo '<div class="componentheading">' . $title . '</div>'; echo '<div class="contentpaneopen"' . ($sitemap->columns > 1 ? ' style="float:left;width:100%;"' : '') . '>'; }
/** * Restores items selected to normal - restores to an unpublished state */ function restoreTrash($cid, $option) { global $database; josSpoofCheck(); $type = mosGetParam($_POST, 'type', array(0)); $total = count($cid); // restores to an unpublished state $state = 0; $ordering = 9999; if ($type == 'content') { // query to restore content items mosArrayToInts($cid); $cids = 'id=' . implode(' OR id=', $cid); $query = "UPDATE #__content" . "\n SET state = " . (int) $state . ", ordering = " . (int) $ordering . "\n WHERE ( {$cids} )"; $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } } else { if ($type == 'menu') { sort($cid); foreach ($cid as $id) { $check = 1; $row = new mosMenu($database); $row->load($id); // check if menu item is a child item if ($row->parent != 0) { $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE id = " . (int) $row->parent . "\n AND ( published = 0 OR published = 1 )"; $database->setQuery($query); $check = $database->loadResult(); if (!$check) { // if menu items parent is not found that are published/unpublished make it a root menu item $query = "UPDATE #__menu" . "\n SET parent = 0, published = " . (int) $state . ", ordering = 9999" . "\n WHERE id = " . (int) $id; } } if ($check) { // query to restore menu items $query = "UPDATE #__menu" . "\n SET published = " . (int) $state . ", ordering = 9999" . "\n WHERE id = " . (int) $id; } $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } } } } $msg = $total . " Iten(s) restaurados com sucesso!"; mosRedirect("index2.php?option={$option}&mosmsg=" . $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 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 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; } }