예제 #1
0
파일: wrapper.class.php 프로젝트: cwcw/cms
 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}");
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
파일: admin.menus.php 프로젝트: cwcw/cms
/**
* 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 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_content&task=edit&id=' . $id);
 }
예제 #5
0
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&sectionid=' . $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 . '&section=' . $redirect, $msg);
}
예제 #6
0
function menuLink($option, $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_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='{$row->menutype}' AND parent='{$row->parent}'");
    $msg = sprintf(T_('%s (Link - Static Content) in menu: %s successfully created'), $link, $menu);
    mosRedirect('index2.php?option=' . $option . '&task=edit&hidemainmenu=1&id=' . $id, $msg);
}
예제 #7
0
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, $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;
     }
 }
예제 #9
0
파일: admin.sections.php 프로젝트: cwcw/cms
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);
}
예제 #10
0
파일: admin.content.php 프로젝트: cwcw/cms
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);
}
예제 #11
0
/**
* 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);
}
예제 #12
0
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&sectionid=' . $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&section=' . $redirect . '&task=editA&hidemainmenu=1&id=' . $id, $msg);
}
예제 #13
0
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);
}
예제 #14
0
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 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;
     }
 }
예제 #16
0
 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);
 }
예제 #17
0
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&sectionid=' . $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&section=' . $redirect . '&task=editA&hidemainmenu=1&id=' . $id, $msg);
}