コード例 #1
0
ファイル: admin.content.php プロジェクト: cwcw/cms
/**
* changes the access level of a record
* @param integer The increment to reorder by
*/
function accessMenu($uid, $access, $option)
{
    global $database;
    $row = new mosContent($database);
    $row->load($uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    $redirect = mosGetParam($_POST, 'redirect', $row->sectionid);
    mosRedirect('index2.php?option=' . $option . '&sectionid=' . $redirect);
}
コード例 #2
0
ファイル: content.php プロジェクト: cwcw/cms
/**
* Shows the email form for a given content item.
*/
function emailContentForm($uid)
{
    global $database, $mainframe, $my;
    $row = new mosContent($database);
    $row->load($uid);
    if ($row->id === null || $row->access > $my->gid) {
        mosNotAuth();
        return;
    } else {
        $template = '';
        $database->setQuery("SELECT template FROM #__templates_menu WHERE client_id = '0' AND menuid = '0'");
        $template = $database->loadResult();
        HTML_content::emailForm($row->id, $row->title, $template);
    }
}
コード例 #3
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);
}
コード例 #4
0
ファイル: content.php プロジェクト: jwest00724/Joomla-1.0
function editItem($uid, $gid, &$access, $sectionid = 0, $task, $Itemid)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_offset;
    $nullDate = $database->getNullDate();
    $row = new mosContent($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        mosErrorAlert("The module [ " . $row->title . " ] is currently being edited by another person.");
    }
    if ($uid) {
        // existing record
        if (!($access->canEdit || $access->canEditOwn && $row->created_by == $my->id)) {
            mosNotAuth();
            return;
        }
    } else {
        // new record
        if (!($access->canEdit || $access->canEditOwn)) {
            mosNotAuth();
            return;
        }
        if ($Itemid == 0 || $Itemid == 99999999) {
            // security check to see if link exists in a menu
            $link = 'index.php?option=com_content&task=new&sectionid=' . (int) $sectionid;
            $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE (link LIKE '%{$link}' OR link LIKE '%{$link}&%')" . "\n AND published = 1";
            $database->setQuery($query);
            $exists = $database->loadResult();
            if (!$exists) {
                mosNotAuth();
                return;
            }
        }
    }
    if ($uid) {
        $sectionid = $row->sectionid;
    }
    $lists = array();
    // get the type name - which is a special category
    $query = "SELECT name FROM #__sections" . "\n WHERE id = " . (int) $sectionid;
    $database->setQuery($query);
    $section = $database->loadResult();
    if ($uid == 0) {
        $row->catid = 0;
    }
    if ($uid) {
        $row->checkout($my->id);
        if (trim($row->images)) {
            $row->images = explode("\n", $row->images);
        } else {
            $row->images = array();
        }
        $row->created = mosFormatDate($row->created, _CURRENT_SERVER_TIME_FORMAT);
        $row->modified = $row->modified == $nullDate ? '' : mosFormatDate($row->modified, _CURRENT_SERVER_TIME_FORMAT);
        $row->publish_up = mosFormatDate($row->publish_up, _CURRENT_SERVER_TIME_FORMAT);
        if (trim($row->publish_down) == $nullDate || trim($row->publish_down) == '' || trim($row->publish_down) == '-') {
            $row->publish_down = 'Never';
        }
        $row->publish_down = mosFormatDate($row->publish_down, _CURRENT_SERVER_TIME_FORMAT);
        $query = "SELECT name" . "\n FROM #__users" . "\n WHERE id = " . (int) $row->created_by;
        $database->setQuery($query);
        $row->creator = $database->loadResult();
        // test to reduce unneeded query
        if ($row->created_by == $row->modified_by) {
            $row->modifier = $row->creator;
        } else {
            $query = "SELECT name" . "\n FROM #__users" . "\n WHERE id = " . (int) $row->modified_by;
            $database->setQuery($query);
            $row->modifier = $database->loadResult();
        }
        $query = "SELECT content_id" . "\n FROM #__content_frontpage" . "\n WHERE content_id = " . (int) $row->id;
        $database->setQuery($query);
        $row->frontpage = $database->loadResult();
    } else {
        $row->sectionid = $sectionid;
        $row->version = 0;
        $row->state = 0;
        $row->ordering = 0;
        $row->images = array();
        $row->publish_up = date('Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60);
        $row->publish_down = 'Never';
        $row->creator = 0;
        $row->modifier = 0;
        $row->frontpage = 0;
    }
    // pull param column from category info
    $query = "SELECT params" . "\n FROM #__categories" . "\n WHERE id = " . (int) $row->catid;
    $database->setQuery($query);
    $categoryParam = $database->loadResult();
    $paramsCat = new mosParameters($categoryParam, $mainframe->getPath('com_xml', 'com_categories'), 'component');
    $selected_folders = $paramsCat->get('imagefolders', '');
    if (!$selected_folders) {
        $selected_folders = '*2*';
    }
    // check if images utilizes settings from section
    if (strpos($selected_folders, '*2*') !== false) {
        unset($selected_folders);
        // load param column from section info
        $query = "SELECT params" . "\n FROM #__sections" . "\n WHERE id = " . (int) $row->sectionid;
        $database->setQuery($query);
        $sectionParam = $database->loadResult();
        $paramsSec = new mosParameters($sectionParam, $mainframe->getPath('com_xml', 'com_sections'), 'component');
        $selected_folders = $paramsSec->get('imagefolders', '');
    }
    if (trim($selected_folders)) {
        $temps = explode(',', $selected_folders);
        foreach ($temps as $temp) {
            $folders[] = mosHTML::makeOption($temp, $temp);
        }
    } else {
        $folders[] = mosHTML::makeOption('*1*');
    }
    // calls function to read image from directory
    $pathA = $mosConfig_absolute_path . '/images/stories';
    $pathL = $mosConfig_live_site . '/images/stories';
    $images = array();
    if ($folders[0]->value == '*1*') {
        $folders = array();
        $folders[] = mosHTML::makeOption('/');
        mosAdminMenus::ReadImages($pathA, '/', $folders, $images);
    } else {
        mosAdminMenus::ReadImagesX($folders, $images);
    }
    // list of folders in images/stories/
    $lists['folders'] = mosAdminMenus::GetImageFolders($folders, $pathL);
    // list of images in specfic folder in images/stories/
    $lists['imagefiles'] = mosAdminMenus::GetImages($images, $pathL, $folders);
    // list of saved images
    $lists['imagelist'] = mosAdminMenus::GetSavedImages($row, $pathL);
    // make the select list for the states
    $states[] = mosHTML::makeOption(0, _CMN_UNPUBLISHED);
    $states[] = mosHTML::makeOption(1, _CMN_PUBLISHED);
    $lists['state'] = mosHTML::selectList($states, 'state', 'class="inputbox" size="1"', 'value', 'text', intval($row->state));
    // build the html select list for ordering
    $query = "SELECT ordering AS value, title AS text" . "\n FROM #__content" . "\n WHERE catid = " . (int) $row->catid . "\n ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $uid, $query, 1);
    // build list of categories
    $lists['catid'] = mosAdminMenus::ComponentCategory('catid', $sectionid, intval($row->catid));
    // build the select list for the image positions
    $lists['_align'] = mosAdminMenus::Positions('_align');
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the select list for the image caption alignment
    $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align');
    // build the html select list for the group access
    // build the select list for the image caption position
    $pos[] = mosHTML::makeOption('bottom', _CMN_BOTTOM);
    $pos[] = mosHTML::makeOption('top', _CMN_TOP);
    $lists['_caption_position'] = mosHTML::selectList($pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
    HTML_content::editContent($row, $section, $lists, $images, $access, $my->id, $sectionid, $task, $Itemid);
}
コード例 #5
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);
}
コード例 #6
0
ファイル: admin.frontpage.php プロジェクト: jwest00724/mambo
/**
* @param integer The id of the content item
* @param integer The new access level
* @param string The URL option
*/
function accessMenu($uid, $access)
{
    global $database;
    $row = new mosContent($database);
    $row->load($uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    mosRedirect('index2.php?option=com_frontpage');
}
コード例 #7
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);
}
コード例 #8
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);
}
コード例 #9
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);
}
コード例 #10
0
                 $database->setQuery($query);
                 $Itemid = $database->loadResult();
                 break;
         }
         // Blank itemid checker for SEF
         /*
         if ($Itemid == NULL) {
         	$Itemid = '';
         } else {
         	$Itemid = '&amp;Itemid='. $Itemid;
         }
         */
         $link = sefRelToAbs('index.php?option=com_content&amp;task=view&amp;id=' . $row->id . $Itemid);
         echo "<tr>\n<td valign=top>\n";
         //echo '<a href="'.$link.'">'.$row->title.'</a>'."\n";
         $newrow->load($row->id);
         $newrow->text = $newrow->introtext;
         $newrow->groups = '';
         $ItemidCount = array('bc' => $bc, 'bs' => $bs, 'gbs' => $gbs);
         HTML_content::show($newrow, $params, $access, 0, 'com_content', $ItemidCount);
         //print_r($ItemidCount);
         //echo '<a href="'.$link.'">Read More..</a>'."\n";
         echo "<td>\n<tr>\n";
     }
     echo "</table>\n";
     break;
 case 'horiz':
 default:
     echo "\n<table class=\"moduletable" . $class_sfx . "\">\n";
     echo "<tr>\n";
     foreach ($rows as $row) {
コード例 #11
0
ファイル: admin.frontpage.php プロジェクト: cwcw/cms
function removeFrontPage(&$cid, $option)
{
    global $database, $adminLanguage;
    if (!is_array($cid) || count($cid) < 1) {
        echo "<script> alert(\"" . $adminLanguage->A_COMP_CONTENT_SEL_DEL . "\"); window.history.go(-1);</script>\n";
        exit;
    }
    $fp = new mosFrontPage($database);
    foreach ($cid as $id) {
        if (!$fp->delete($id)) {
            echo "<script> alert('" . $fp->getError() . "'); </script>\n";
            exit;
        }
        $obj = new mosContent($database);
        $obj->load($id);
        $obj->mask = 0;
        if (!$obj->store()) {
            echo "<script> alert('" . $fp->getError() . "'); </script>\n";
            exit;
        }
    }
    $fp->updateOrder();
    mosRedirect("index2.php?option={$option}");
}
コード例 #12
0
ファイル: admin.content.php プロジェクト: jwest00724/mambo
function saveOrder(&$cid)
{
    global $database;
    $order = mosGetParam($_POST, 'order', array(0));
    $redirect = mosGetParam($_POST, 'redirect', 0);
    $rettask = mosGetParam($_POST, 'returntask', '');
    $row = new mosContent($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');
    switch ($rettask) {
        case 'showarchive':
            mosRedirect('index2.php?option=com_content&task=showarchive&sectionid=' . $redirect, $msg);
            break;
        default:
            mosRedirect('index2.php?option=com_content&sectionid=' . $redirect, $msg);
            break;
    }
    // switch
}
コード例 #13
0
function saveOrder(&$cid)
{
    global $database;
    josSpoofCheck();
    $total = count($cid);
    $redirect = mosGetParam($_POST, 'redirect', 0);
    $rettask = strval(mosGetParam($_POST, 'returntask', ''));
    $order = josGetArrayInts('order');
    $row = new mosContent($database);
    $conditions = array();
    // update ordering values
    for ($i = 0; $i < $total; $i++) {
        $row->load((int) $cid[$i]);
        if ($row->ordering != $order[$i]) {
            $row->ordering = $order[$i];
            if (!$row->store()) {
                echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
                exit;
            }
            // if
            // remember to updateOrder this group
            $condition = "catid = " . (int) $row->catid . " AND state >= 0";
            $found = false;
            foreach ($conditions as $cond) {
                if ($cond[1] == $condition) {
                    $found = true;
                    break;
                }
            }
            // if
            if (!$found) {
                $conditions[] = array($row->id, $condition);
            }
        }
        // if
    }
    // for
    // execute updateOrder for each group
    foreach ($conditions as $cond) {
        $row->load($cond[0]);
        $row->updateOrder($cond[1]);
    }
    // foreach
    // clean any existing cache files
    mosCache::cleanCache('com_content');
    $msg = 'Nova ordenação salva';
    switch ($rettask) {
        case 'showarchive':
            mosRedirect('index2.php?option=com_content&task=showarchive&sectionid=' . $redirect, $msg);
            break;
        default:
            mosRedirect('index2.php?option=com_content&sectionid=' . $redirect, $msg);
            break;
    }
    // switch
}
コード例 #14
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);
}
コード例 #15
0
ファイル: pdf.php プロジェクト: jwest00724/mambo
function dofreePDF($database)
{
    global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_offset, $mosConfig_hideCreateDate, $mosConfig_hideAuthor, $mosConfig_hideModifyDate;
    $id = intval(mosGetParam($_REQUEST, 'id', 1));
    // Access check
    global $gid;
    $now = date('Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60);
    $query = "SELECT COUNT(a.id)" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope='content'" . "\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 #__groups AS g ON a.access = g.id" . "\n WHERE a.id='" . $id . "' " . "\n AND (a.state = '1' OR a.state = '-1')" . "\n AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= '{$now}')" . "\n AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= '{$now}')" . "\n AND a.access <= " . intval($gid);
    $database->setQuery($query);
    if (!$database->loadResult()) {
        exit(T_('You are not authorized to view this resource.'));
    }
    include 'includes/class.ezpdf.php';
    $row = new mosContent($database);
    $row->load($id);
    //Find Author Name
    $users_rows = new mosUser($database);
    $users_rows->load($row->created_by);
    $row->author = $users_rows->name;
    $row->usertype = $users_rows->usertype;
    // Ugly but needed to get rid of all the stuff the PDF class cant handle
    $row->fulltext = str_replace('<p>', "\n\n", $row->fulltext);
    $row->fulltext = str_replace('<P>', "\n\n", $row->fulltext);
    $row->fulltext = str_replace('<br />', "\n", $row->fulltext);
    $row->fulltext = str_replace('<br>', "\n", $row->fulltext);
    $row->fulltext = str_replace('<BR />', "\n", $row->fulltext);
    $row->fulltext = str_replace('<BR>', "\n", $row->fulltext);
    $row->fulltext = str_replace('<li>', "\n - ", $row->fulltext);
    $row->fulltext = str_replace('<LI>', "\n - ", $row->fulltext);
    $row->fulltext = strip_tags($row->fulltext);
    $row->fulltext = str_replace('{mosimage}', '', $row->fulltext);
    $row->fulltext = str_replace('{mospagebreak}', '', $row->fulltext);
    $row->fulltext = decodeHTML($row->fulltext);
    $row->introtext = str_replace('<p>', "\n\n", $row->introtext);
    $row->introtext = str_replace('<P>', "\n\n", $row->introtext);
    $row->introtext = str_replace('<li>', "\n - ", $row->introtext);
    $row->introtext = str_replace('<LI>', "\n - ", $row->introtext);
    $row->introtext = strip_tags($row->introtext);
    $row->introtext = str_replace('{mosimage}', '', $row->introtext);
    $row->introtext = str_replace('{mospagebreak}', '', $row->introtext);
    $row->introtext = decodeHTML($row->introtext);
    $pdf =& new Cezpdf('a4', 'P');
    //A4 Portrait
    $pdf->ezSetCmMargins(2, 1.5, 1, 1);
    $pdf->selectFont('./fonts/Helvetica.afm');
    //choose font
    $all = $pdf->openObject();
    $pdf->saveState();
    $pdf->setStrokeColor(0, 0, 0, 1);
    // footer
    $pdf->line(10, 40, 578, 40);
    $pdf->line(10, 822, 578, 822);
    $pdf->addText(30, 34, 6, $mosConfig_live_site . ' - ' . $mosConfig_sitename);
    $pdf->addText(250, 34, 6, T_('Powered by Mambo'));
    $pdf->addText(450, 34, 6, T_('Generated:') . date('j F, Y, H:i', time() + $mosConfig_offset * 60 * 60));
    $pdf->restoreState();
    $pdf->closeObject();
    $pdf->addObject($all, 'all');
    $pdf->ezSetDy(30);
    $txt1 = $row->title;
    $pdf->ezText($txt1, 14);
    $txt2 = NULL;
    $mod_date = NULL;
    $create_date = NULL;
    if (intval($row->modified) != 0) {
        $mod_date = mosFormatDate($row->modified);
    }
    if (intval($row->created) != 0) {
        $create_date = mosFormatDate($row->created);
    }
    if ($mosConfig_hideCreateDate == '0') {
        $txt2 .= '(' . $create_date . ') - ';
    }
    if ($mosConfig_hideAuthor == "0") {
        if ($row->author != '' && $mosConfig_hideAuthor == '0') {
            if ($row->usertype == 'administrator' || $row->usertype == 'superadministrator') {
                $txt2 .= T_('Written by') . ' ' . ($row->created_by_alias ? $row->created_by_alias : $row->author);
            } else {
                $txt2 .= T_('Contributed by') . ' ' . ($row->created_by_alias ? $row->created_by_alias : $row->author);
            }
        }
    }
    if ($mosConfig_hideModifyDate == "0") {
        $txt2 .= ' - ' . T_('Last Updated') . ' (' . $mod_date . ') ';
    }
    $txt2 .= "\n\n";
    $pdf->ezText($txt2, 8);
    $txt3 = $row->introtext . "\n" . $row->fulltext;
    $pdf->ezText($txt3, 10);
    $pdf->ezStream();
}
コード例 #16
0
/**
* changes the access level of a record
* @param integer The increment to reorder by
*/
function changeAccess($id, $access, $option)
{
    global $database;
    $row = new mosContent($database);
    $row->load($id);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    mosRedirect('index2.php?option=' . $option);
}
コード例 #17
0
/**
* @param integer The id of the content item
* @param integer The new access level
* @param string The URL option
*/
function accessMenu($uid, $access)
{
    global $database;
    josSpoofCheck();
    $row = new mosContent($database);
    $row->load((int) $uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    // clean any existing cache files
    mosCache::cleanCache('com_content');
    mosRedirect('index2.php?option=com_frontpage');
}
コード例 #18
0
ファイル: mod_newsflash.php プロジェクト: jwest00724/mambo
$noauth = !$mainframe->getCfg('shownoauth');
// query to determine article count
$query = "SELECT a.id" . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid" . "\n WHERE a.state = 1" . ($noauth ? "\n AND a.access <= '" . $my->gid . "' AND b.access <= '" . $my->gid . "'" : '') . "\n AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '" . $now . "') " . "\n AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '" . $now . "')" . "\n AND catid='" . $catid . "' " . "\n ORDER BY a.ordering" . "\n " . $limit;
$database->setQuery($query);
$rows = $database->loadResultArray();
$row = new mosContent($database);
if (!count($rows)) {
    return;
}
$numrows = count($rows);
switch ($style) {
    case 'horiz':
        echo "\n<table class=\"moduletable" . $moduleclass_sfx . "\">\n";
        echo "<tr>\n";
        foreach ($rows as $id) {
            $row->load($id);
            $row->text = $row->introtext;
            if ($image == 0) {
                $row->text = preg_replace('/\\<img[^>]+\\>/i', '', $row->text);
            }
            $row->groups = '';
            echo '<td>';
            HTML_content::show($row, $params, $access, 0, 'com_content');
            echo "</td>\n";
        }
        echo "</tr>\n</table>\n";
        break;
    case 'vert':
        foreach ($rows as $id) {
            $row->load($id);
            $row->text = $row->introtext;
コード例 #19
0
ファイル: pdf.php プロジェクト: cwcw/cms
function dofreePDF($database)
{
    global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_offset, $mosConfig_hideCreateDate, $mosConfig_hideAuthor, $mosConfig_hideModifyDate;
    $id = intval(mosGetParam($_REQUEST, 'id', 1));
    include 'includes/class.ezpdf.php';
    $row = new mosContent($database);
    $row->load($id);
    //Find Author Name
    $users_rows = new mosUser($database);
    $users_rows->load($row->created_by);
    $row->author = $users_rows->name;
    $row->usertype = $users_rows->usertype;
    // Ugly but needed to get rid of all the stuff the PDF class cant handle
    $row->fulltext = str_replace('<p>', "\n\n", $row->fulltext);
    $row->fulltext = str_replace('<P>', "\n\n", $row->fulltext);
    $row->fulltext = str_replace('<br />', "\n", $row->fulltext);
    $row->fulltext = str_replace('<br>', "\n", $row->fulltext);
    $row->fulltext = str_replace('<BR />', "\n", $row->fulltext);
    $row->fulltext = str_replace('<BR>', "\n", $row->fulltext);
    $row->fulltext = str_replace('<li>', "\n - ", $row->fulltext);
    $row->fulltext = str_replace('<LI>', "\n - ", $row->fulltext);
    $row->fulltext = strip_tags($row->fulltext);
    $row->fulltext = str_replace('{mosimage}', '', $row->fulltext);
    $row->fulltext = str_replace('{mospagebreak}', '', $row->fulltext);
    $row->fulltext = decodeHTML($row->fulltext);
    $row->introtext = str_replace('<p>', "\n\n", $row->introtext);
    $row->introtext = str_replace('<P>', "\n\n", $row->introtext);
    $row->introtext = str_replace('<li>', "\n - ", $row->introtext);
    $row->introtext = str_replace('<LI>', "\n - ", $row->introtext);
    $row->introtext = strip_tags($row->introtext);
    $row->introtext = str_replace('{mosimage}', '', $row->introtext);
    $row->introtext = str_replace('{mospagebreak}', '', $row->introtext);
    $row->introtext = decodeHTML($row->introtext);
    $pdf =& new Cezpdf('a4', 'P');
    //A4 Portrait
    $pdf->ezSetCmMargins(2, 1.5, 1, 1);
    $pdf->selectFont('./fonts/Helvetica.afm');
    //choose font
    $all = $pdf->openObject();
    $pdf->saveState();
    $pdf->setStrokeColor(0, 0, 0, 1);
    // footer
    $pdf->line(10, 40, 578, 40);
    $pdf->line(10, 822, 578, 822);
    $pdf->addText(30, 34, 6, $mosConfig_live_site . ' - ' . $mosConfig_sitename);
    $pdf->addText(250, 34, 6, 'Powered by Mambo');
    $pdf->addText(450, 34, 6, 'Generated: ' . date('j F, Y, H:i', time() + $mosConfig_offset * 60 * 60));
    $pdf->restoreState();
    $pdf->closeObject();
    $pdf->addObject($all, 'all');
    $pdf->ezSetDy(30);
    $txt1 = $row->title;
    $pdf->ezText($txt1, 14);
    $txt2 = NULL;
    $mod_date = NULL;
    $create_date = NULL;
    if (intval($row->modified) != 0) {
        $mod_date = mosFormatDate($row->modified);
    }
    if (intval($row->created) != 0) {
        $create_date = mosFormatDate($row->created);
    }
    if ($mosConfig_hideCreateDate == '0') {
        $txt2 .= '(' . $create_date . ') - ';
    }
    if ($mosConfig_hideAuthor == "0") {
        if ($row->author != '' && $mosConfig_hideAuthor == '0') {
            if ($row->usertype == 'administrator' || $row->usertype == 'superadministrator') {
                $txt2 .= _WRITTEN_BY . ' ' . ($row->created_by_alias ? $row->created_by_alias : $row->author);
            } else {
                $txt2 .= _AUTHOR_BY . ' ' . ($row->created_by_alias ? $row->created_by_alias : $row->author);
            }
        }
    }
    if ($mosConfig_hideModifyDate == "0") {
        $txt2 .= ' - ' . _LAST_UPDATED . ' (' . $mod_date . ') ';
    }
    $txt2 .= "\n\n";
    $pdf->ezText($txt2, 8);
    $txt3 = $row->introtext . "\n" . $row->fulltext;
    $pdf->ezText($txt3, 10);
    $pdf->ezStream();
}
コード例 #20
0
function saveOrder(&$cid)
{
    global $database;
    josSpoofCheck();
    $total = count($cid);
    $order = josGetArrayInts('order');
    $row = new mosContent($database);
    $conditions = array();
    // update ordering values
    for ($i = 0; $i < $total; $i++) {
        $row->load((int) $cid[$i]);
        if ($row->ordering != $order[$i]) {
            $row->ordering = $order[$i];
            if (!$row->store()) {
                echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
                exit;
            }
            // if
            // remember to updateOrder this group
            $condition = "catid=" . (int) $row->catid . " AND state >= 0";
            $found = false;
            foreach ($conditions as $cond) {
                if ($cond[1] == $condition) {
                    $found = true;
                    break;
                }
            }
            // if
            if (!$found) {
                $conditions[] = array($row->id, $condition);
            }
        }
        // if
    }
    // for
    // execute updateOrder for each group
    foreach ($conditions as $cond) {
        $row->load($cond[0]);
        $row->updateOrder($cond[1]);
    }
    // foreach
    // clean any existing cache files
    mosCache::cleanCache('com_content');
    $msg = 'New ordering saved';
    mosRedirect('index2.php?option=com_typedcontent', $msg);
}
コード例 #21
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);
}