コード例 #1
0
ファイル: admin.categories.php プロジェクト: cwcw/cms
/**
* changes the access level of a record
* @param integer The increment to reorder by
*/
function accessMenu($uid, $access, $option, $section)
{
    global $database;
    $row = new mosCategory($database);
    $row->load($uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    mosRedirect('index2.php?option=com_categories&section=' . $section);
}
コード例 #2
0
/**
* Save the item(s) to the menu selected
*/
function copySectionSave($sectionid)
{
    global $database;
    josSpoofCheck();
    $title = stripslashes(strval(mosGetParam($_REQUEST, 'title', '')));
    $categories = josGetArrayInts('category', $_REQUEST, array(0));
    $items = josGetArrayInts('content', $_REQUEST, array(0));
    // create new section
    $section = new mosSection($database);
    $section->id = null;
    $section->title = $title;
    $section->name = $title;
    $section->scope = 'content';
    $section->published = 1;
    if (!$section->check()) {
        echo "<script> alert('" . $section->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (!$section->store()) {
        echo "<script> alert('" . $section->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    $section->checkin();
    $newSectionId = $section->id;
    // new section created, now copy categories
    // old/new category lookup array
    $newOldCatLookup = array();
    foreach ($categories as $categoryId) {
        $category = new mosCategory($database);
        $category->load($categoryId);
        $category->id = null;
        $category->section = $newSectionId;
        if (!$category->check()) {
            echo "<script> alert('" . $category->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        if (!$category->store()) {
            echo "<script> alert('" . $category->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        $category->checkin();
        $newOldCatLookup[$categoryId] = $category->id;
    }
    // categories copied, now copy content items
    foreach ($items as $itemId) {
        $item = new mosContent($database);
        $item->load($itemId);
        $item->id = null;
        $item->catid = $newOldCatLookup[$item->catid];
        $item->sectionid = $newSectionId;
        if (!$item->check()) {
            echo "<script> alert('" . $item->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        if (!$item->store()) {
            echo "<script> alert('" . $item->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        $item->checkin();
    }
    $msg = 'Selected sections content copied into ' . $title . ' section.';
    mosRedirect('index2.php?option=com_sections&scope=content&mosmsg=' . $msg);
}
コード例 #3
0
/**
* changes the access level of a record
* @param integer The increment to reorder by
*/
function accessMenu($uid, $access, $section)
{
    global $database;
    $row = new mosCategory($database);
    $row->load((int) $uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    if ($section == 'content') {
        // clean any existing cache files
        mosCache::cleanCache('com_content');
    }
    mosRedirect('index2.php?option=com_categories&section=' . $section);
}
コード例 #4
0
ファイル: admin.sections.php プロジェクト: cwcw/cms
/**
* Save the item(s) to the menu selected
*/
function copySectionSave($option, $sectionid, $sectionID)
{
    global $database, $adminLanguage;
    $title = mosGetParam($_REQUEST, 'title', '');
    $contentid = mosGetParam($_REQUEST, 'content', '');
    $categoryid = mosGetParam($_REQUEST, 'category', '');
    $total = count($contentid);
    $sectionids = implode(',', $sectionid);
    $section = new mosSection($database);
    foreach ($sectionid as $id) {
        $section->load($id);
        $section->id = NULL;
        $section->title = $title;
        $section->name = $title;
        if (!$section->check()) {
            echo "<script> alert('" . $section->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        if (!$section->store()) {
            echo "<script> alert('" . $section->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        $section->checkin();
        $section->updateOrder("section='" . $section->id . "'");
        // stores original catid
        $newsectids[]["old"] = $id;
        // pulls new catid
        $newsectids[]["new"] = $section->id;
    }
    $category = new mosCategory($database);
    foreach ($categoryid as $id) {
        $category->load($id);
        $category->id = NULL;
        $category->section = $sectionMove;
        foreach ($newsectids as $newsectid) {
            if ($category->section == $newsectid["old"]) {
                $category->section = $newsectid["new"];
            }
        }
        if (!$category->check()) {
            echo "<script> alert('" . $category->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        if (!$category->store()) {
            echo "<script> alert('" . $category->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        $category->checkin();
        $category->updateOrder("section='" . $category->section . "'");
        // stores original catid
        $newcatids[]["old"] = $id;
        // pulls new catid
        $newcatids[]["new"] = $category->id;
    }
    $content = new mosContent($database);
    foreach ($contentid as $id) {
        $content->load($id);
        $content->id = NULL;
        $content->hits = 0;
        foreach ($newsectids as $newsectid) {
            if ($content->sectionid == $newsectid["old"]) {
                $content->sectionid = $newsectid["new"];
            }
        }
        foreach ($newcatids as $newcatid) {
            if ($content->catid == $newcatid["old"]) {
                $content->catid = $newcatid["new"];
            }
        }
        if (!$content->check()) {
            echo "<script> alert('" . $content->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        if (!$content->store()) {
            echo "<script> alert('" . $content->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        $content->checkin();
    }
    $sectionOld = new mosSection($database);
    $sectionOld->load($sectionMove);
    $msg = $adminLanguage->A_COMP_SECTION . " " . $sectionOld->name . " " . $adminLanguage->A_COMP_SECT_AND_ALL . " " . $title;
    mosRedirect('index2.php?option=com_sections&scope=content&mosmsg=' . $msg);
}
コード例 #5
0
ファイル: admin.sections.php プロジェクト: jwest00724/mambo
/**
* Save the item(s) to the menu selected
*/
function copySectionSave($sectionid)
{
    global $database;
    $title = mosGetParam($_REQUEST, 'title', '');
    $contentid = mosGetParam($_REQUEST, 'content', '');
    $categoryid = mosGetParam($_REQUEST, 'category', '');
    // copy section
    $section = new mosSection($database);
    foreach ($sectionid as $id) {
        $section->load($id);
        $section->id = NULL;
        $section->title = $title;
        $section->name = $title;
        if (!$section->check()) {
            echo "<script> alert('" . $section->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        if (!$section->store()) {
            echo "<script> alert('" . $section->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        $section->checkin();
        $section->updateOrder("section='" . $section->id . "'");
        // stores original catid
        $newsectids[]["old"] = $id;
        // pulls new catid
        $newsectids[]["new"] = $section->id;
    }
    $sectionMove = $section->id;
    // copy categories
    $category = new mosCategory($database);
    foreach ($categoryid as $id) {
        $category->load($id);
        $category->id = NULL;
        $category->section = $sectionMove;
        foreach ($newsectids as $newsectid) {
            if ($category->section == $newsectid["old"]) {
                $category->section = $newsectid["new"];
            }
        }
        if (!$category->check()) {
            echo "<script> alert('" . $category->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        if (!$category->store()) {
            echo "<script> alert('" . $category->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        $category->checkin();
        $category->updateOrder("section='" . $category->section . "'");
        // stores original catid
        $newcatids[]["old"] = $id;
        // pulls new catid
        $newcatids[]["new"] = $category->id;
    }
    $content = new mosContent($database);
    foreach ($contentid as $id) {
        $content->load($id);
        $content->id = NULL;
        $content->hits = 0;
        foreach ($newsectids as $newsectid) {
            if ($content->sectionid == $newsectid["old"]) {
                $content->sectionid = $newsectid["new"];
            }
        }
        foreach ($newcatids as $newcatid) {
            if ($content->catid == $newcatid["old"]) {
                $content->catid = $newcatid["new"];
            }
        }
        if (!$content->check()) {
            echo "<script> alert('" . $content->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        if (!$content->store()) {
            echo "<script> alert('" . $content->getError() . "'); window.history.go(-1); </script>\n";
            exit;
        }
        $content->checkin();
    }
    $sectionOld = new mosSection($database);
    $sectionOld->load($sectionMove);
    $msg = sprintf(T_('Section %s and all its Categories and Items have been copied as %s'), $sectionOld->name, $title);
    mosRedirect('index2.php?option=com_sections&scope=content&mosmsg=' . $msg);
}