コード例 #1
0
function go2menuitem()
{
    global $database;
    josSpoofCheck();
    // checkin content
    $row = new mosContent($database);
    $row->bind($_POST);
    $row->checkin();
    $menu = strval(mosGetParam($_POST, 'menu', 'mainmenu'));
    $id = intval(mosGetParam($_POST, 'menuid', 0));
    mosRedirect('index2.php?option=com_menus&menutype=' . $menu . '&task=edit&hidemainmenu=1&id=' . $id);
}
コード例 #2
0
ファイル: admin.categories.php プロジェクト: cwcw/cms
/**
* Save the item(s) to the menu selected
*/
function copyCategorySave($option, $cid, $sectionOld)
{
    global $database, $my;
    global $adminLanguage;
    $sectionMove = mosGetParam($_REQUEST, 'sectionmove', '');
    $contentid = mosGetParam($_REQUEST, 'item', '');
    $total = count($contentid);
    $category = new mosCategory($database);
    foreach ($cid as $id) {
        $category->load($id);
        $category->id = NULL;
        $category->title = $adminLanguage->A_COMP_CATEG_COPY_OF . " " . $category->title;
        $category->name = $adminLanguage->A_COMP_CATEG_COPY_OF . " " . $category->name;
        $category->section = $sectionMove;
        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();
        // 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->sectionid = $sectionMove;
        $content->hits = 0;
        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();
    }
    $sectionNew = new mosSection($database);
    $sectionNew->load($sectionMove);
    $msg = $total . " " . $adminLanguage->A_COMP_CATEG_COPIED_TO . " " . $sectionNew->name;
    mosRedirect('index2.php?option=com_categories&section=' . $sectionOld . '&mosmsg=' . $msg);
}
コード例 #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);
}
コード例 #4
0
ファイル: content.php プロジェクト: cwcw/cms
/**
* Cancels an edit operation
* @param database A database connector object
*/
function cancelContent(&$access)
{
    global $database, $mainframe, $my;
    $row = new mosContent($database);
    $row->bind($_POST);
    if ($access->canEdit || $access->canEditOwn && $row->created_by == $my->id) {
        $row->checkin();
    }
    $Itemid = mosGetParam($_POST, 'Returnid', '0');
    if ($Itemid) {
        mosRedirect('index.php?option=com_content&task=view&id=' . $row->id . '&Itemid=' . $Itemid);
    } else {
        mosRedirect('index.php');
    }
}
コード例 #5
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);
}
コード例 #6
0
ファイル: content.php プロジェクト: jwest00724/Joomla-1.0
/**
* Cancels an edit operation
* @param database A database connector object
*/
function cancelContent(&$access)
{
    global $database, $my, $task;
    $row = new mosContent($database);
    $row->bind($_POST);
    if ($access->canEdit || $access->canEditOwn && $row->created_by == $my->id) {
        $row->checkin();
    }
    $Itemid = intval(mosGetParam($_POST, 'Returnid', '0'));
    $referer = strval(mosGetParam($_POST, 'referer', ''));
    $parts = parse_url($referer);
    parse_str($parts['query'], $query);
    if ($task == 'edit' || $task == 'cancel') {
        $Itemid = mosGetParam($_POST, 'Returnid', '');
        $referer = 'index.php?option=com_content&task=view&id=' . $row->id . '&Itemid=' . $Itemid;
    }
    if ($referer && $row->id) {
        mosRedirect($referer);
    } else {
        mosRedirect('index.php');
    }
}
コード例 #7
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);
}
コード例 #8
0
/**
* Function to reset Hit count of a content item
* PT
*/
function resethits($redirect, $id)
{
    global $database;
    josSpoofCheck();
    $row = new mosContent($database);
    $row->Load((int) $id);
    $row->hits = 0;
    $row->store();
    $row->checkin();
    $msg = 'Successfully Reset Hit count';
    mosRedirect('index2.php?option=com_content&sectionid=' . $redirect . '&task=edit&hidemainmenu=1&id=' . $id, $msg);
}
コード例 #9
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);
}
コード例 #10
0
/**
* Save the item(s) to the menu selected
*/
function copyCategorySave($cid, $sectionOld)
{
    global $database;
    josSpoofCheck();
    $sectionMove = intval(mosGetParam($_REQUEST, 'sectionmove', ''));
    if (!$sectionMove) {
        mosRedirect('index.php?option=com_categories&mosmsg=An error has occurred');
    }
    $contentid = josGetArrayInts('item', $_REQUEST);
    $total = count($contentid);
    $category = new mosCategory($database);
    foreach ($cid as $id) {
        $category->load((int) $id);
        $category->id = NULL;
        $category->title = 'Copy of ' . $category->title;
        $category->name = 'Copy of ' . $category->name;
        $category->section = $sectionMove;
        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();
        // stores original catid
        $newcatids[]["old"] = $id;
        // pulls new catid
        $newcatids[]["new"] = $category->id;
    }
    $content = new mosContent($database);
    foreach ($contentid as $id) {
        $content->load((int) $id);
        $content->id = NULL;
        $content->sectionid = $sectionMove;
        $content->hits = 0;
        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();
    }
    $sectionNew = new mosSection($database);
    $sectionNew->load($sectionMove);
    if ($sectionOld == 'content') {
        // clean any existing cache files
        mosCache::cleanCache('com_content');
    }
    $msg = (count($cid) - 1 ? 'Categories' : 'Category') . ' copied to ' . $sectionNew->name;
    mosRedirect('index2.php?option=com_categories&section=' . $sectionOld . '&mosmsg=' . $msg);
}
コード例 #11
0
/**
* Changes the state of one or more content pages
* @param array An array of unique category id numbers
* @param integer 0 if unpublishing, 1 if publishing
*/
function changeFrontPage($cid = null, $state = 0, $option)
{
    global $database, $my;
    josSpoofCheck();
    if (count($cid) < 1) {
        $action = $state == 1 ? 'publish' : ($state == -1 ? 'archive' : 'unpublish');
        echo "<script> alert('Select an item to {$action}'); window.history.go(-1);</script>\n";
        exit;
    }
    mosArrayToInts($cid);
    $cids = 'id=' . implode(' OR id=', $cid);
    $query = "UPDATE #__content" . "\n SET state = " . (int) $state . "\n WHERE ( {$cids} )" . "\n AND ( checked_out = 0 OR ( checked_out = " . (int) $my->id . " ) )";
    $database->setQuery($query);
    if (!$database->query()) {
        echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (count($cid) == 1) {
        $row = new mosContent($database);
        $row->checkin($cid[0]);
    }
    // clean any existing cache files
    mosCache::cleanCache('com_content');
    mosRedirect("index2.php?option={$option}");
}
コード例 #12
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);
}
コード例 #13
0
ファイル: admin.frontpage.php プロジェクト: cwcw/cms
/**
* Changes the state of one or more content pages
* @param array An array of unique category id numbers
* @param integer 0 if unpublishing, 1 if publishing
*/
function changeFrontPage($cid = null, $state = 0, $option)
{
    global $database, $my, $adminLanguage;
    if (count($cid) < 1) {
        $action = $publish == 1 ? 'publish' : ($publish == -1 ? 'archive' : 'unpublish');
        echo "<script> alert(\"" . $adminLanguage->A_COMP_SEL_ITEM . " " . $action . "\"); window.history.go(-1);</script>\n";
        exit;
    }
    $cids = implode(',', $cid);
    $database->setQuery("UPDATE #__content SET state='{$state}'" . "\nWHERE id IN ({$cids}) AND (checked_out=0 OR (checked_out='{$my->id}'))");
    if (!$database->query()) {
        echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (count($cid) == 1) {
        $row = new mosContent($database);
        $row->checkin($cid[0]);
    }
    mosRedirect("index2.php?option={$option}");
}
コード例 #14
0
ファイル: content.php プロジェクト: jwest00724/mambo
/**
* Cancels an edit operation
* @param database A database connector object
*/
function cancelContent(&$access)
{
    global $database, $mainframe, $my;
    $row = new mosContent($database);
    $row->bind($_POST);
    // sanitize
    $row->id = intval($row->id);
    if ($access->canEdit || $access->canEditOwn && $row->created_by == $my->id) {
        $row->checkin();
    }
    $Itemid = mosGetParam($_POST, 'Returnid', '0');
    mosRedirect('index.php');
}
コード例 #15
0
ファイル: admin.frontpage.php プロジェクト: jwest00724/mambo
/**
* Changes the state of one or more content pages
* @param array An array of unique category id numbers
* @param integer 0 if unpublishing, 1 if publishing
*/
function changeFrontPage($cid = null, $state = 0, $option)
{
    global $database, $my;
    if (count($cid) < 1) {
        $action = $publish == 1 ? T_('publish') : ($publish == -1 ? T_('archive') : T_('unpublish'));
        echo "<script> alert('" . sprintf(T_('Select an item to %a'), $action) . "'); window.history.go(-1);</script>\n";
        exit;
    }
    $cids = implode(',', $cid);
    $query = "UPDATE #__content SET state='{$state}'" . "\n WHERE id IN ({$cids}) AND (checked_out=0 OR (checked_out='{$my->id}'))";
    $database->setQuery($query);
    if (!$database->query()) {
        echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (count($cid) == 1) {
        $row = new mosContent($database);
        $row->checkin($cid[0]);
    }
    mosRedirect("index2.php?option={$option}");
}
コード例 #16
0
ファイル: admin.categories.php プロジェクト: jwest00724/mambo
/**
* Save the item(s) to the menu selected
*/
function copyCategorySave($cid, $sectionOld)
{
    global $database;
    $sectionMove = mosGetParam($_REQUEST, 'sectionmove', '');
    $contentid = mosGetParam($_REQUEST, 'item', '');
    $total = count($contentid);
    $category = new mosCategory($database);
    foreach ($cid as $id) {
        $category->load($id);
        $category->id = NULL;
        $category->title = "Copy of " . $category->title;
        $category->name = "Copy of " . $category->name;
        $category->section = $sectionMove;
        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();
        // 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->sectionid = $sectionMove;
        $content->hits = 0;
        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();
    }
    $sectionNew = new mosSection($database);
    $sectionNew->load($sectionMove);
    $msg = sprintf(Tn_('%d Category copied to %s', '%d Categories copied to %s', $total), $total, $sectionNew->name);
    mosRedirect('index2.php?option=com_categories&section=' . $sectionOld . '&mosmsg=' . $msg);
}