Example #1
0
/**
 * Nexus store service
 * store the content as part of an existing menu
 */
function nexus_content_store($pObject, $pParamHash)
{
    global $gBitSystem, $gBitUser, $gBitSmarty;
    require_once NEXUS_PKG_PATH . 'Nexus.php';
    $nexus = new Nexus();
    if (!empty($pParamHash['content_id']) && !empty($pParamHash['nexus']['menu_id'])) {
        $nexusHash['title'] = $pParamHash['content_store']['title'];
        $nexusHash['hint'] = !empty($pParamHash['description']) ? $pParamHash['description'] : NULL;
        $nexusHash['menu_id'] = $pParamHash['nexus']['menu_id'];
        $nexusHash['after_ref_id'] = $pParamHash['nexus']['after_ref_id'];
        $nexusHash['rsrc'] = $pParamHash['content_id'];
        $nexusHash['rsrc_type'] = 'content_id';
        if (!$nexus->storeItem($nexusHash)) {
            $gBitSystem->fatalError("There was an error storing the item: " . vc($nexus->mErrors));
        }
        $nexus->load();
    } elseif (!empty($pParamHash['nexus']['remove_item'])) {
        $nexus->expungeItem($pParamHash['nexus']['remove_item']);
    }
}
Example #2
0
 /**
  * Expunge data associated with an uploaded file
  * 
  * @access public
  * @param should the attachment be expunged. Defaults to true.
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  * TODO: make it possible to remove only items when they are not part of other galleries
  */
 function expunge()
 {
     if ($this->isValid()) {
         $this->mDb->StartTrans();
         // Remove map entries
         $this->expungeItemMap();
         // now we can deal with the entry in liberty_content
         if (LibertyMime::expunge()) {
             $this->mDb->CompleteTrans();
         } else {
             $this->mErrors['expunge'] = tra('The item could not be completely removed.');
             $this->mDb->RollbackTrans();
         }
     }
     if (count($this->mErrors) != 0) {
         error_log("Error deleting treasury item: " . vc($this->mErrors));
     }
     return count($this->mErrors) == 0;
 }
Example #3
0
 /**
  * Store pigeonhole member
  * @param $pParamHash an array of content to be stored.
  * @param $pParamHash[parent_id] id of pigeonhole it belongs to, default is $this->mContentId
  * @param $pParamHash[content_id] content_id of the item to be stored
  * @return bool TRUE on success, FALSE if store could not occur. If FALSE, $this->mErrors will have reason why
  * @access public
  **/
 function insertPigeonholeMember(&$pParamHash)
 {
     if ($this->verifyPigeonholeMember($pParamHash)) {
         foreach ($pParamHash['member_store'] as $item) {
             $result = $this->mDb->associateInsert(BIT_DB_PREFIX . "pigeonhole_members", $item);
         }
     } else {
         error_log("Error inserting pigeonhole: " . vc($this->mErrors));
     }
     return count($this->mErrors) == 0;
 }
Example #4
0
// Is package installed and enabled
$gBitSystem->verifyPackage('boards');
// Look up Topic (lookup_inc is universal, gContent == BitBoardTopic)
require_once BOARDS_PKG_PATH . 'lookup_inc.php';
// Make sure topic exists since we only run through here for existing topics. New topics are created via comment system.
if (!$gContent->isValid()) {
    $gBitSystem->fatalError('No topic specified');
}
// Load up the Topic's board - we'll respect its permissions
$board = new BitBoard($gContent->mInfo['board_id']);
$board->load();
$board->verifyAdminPermission();
if (isset($_REQUEST["target"])) {
    // Check the user's ticket
    $gBitUser->verifyTicket();
    $targetBoard = new BitBoard(null, $_REQUEST["target"]);
    $targetBoard->load();
    if (!$targetBoard->hasAdminPermission()) {
        $gBitSystem->fatalError('You do not have permission to move topics to the Board' . $targetBoard->mInfo['title']);
    }
    if ($gContent->moveTo($_REQUEST["target"])) {
        bit_redirect($gContent->getDisplayUrl());
    } else {
        $gBitSystem->fatalError("There was an error moving the topic: " . vc($gContent->mErrors));
    }
}
// get list of boards we can move the topic to
$boards = $board->getBoardSelectList();
$gBitSmarty->assignByRef('boards', $boards);
$gBitSmarty->assign('fromBoardId', $board->mContentId);
$gBitSystem->display('bitpackage:boards/topic_move.tpl', tra('Move Topic') . ':' . $gContent->getTitle(), array('display_mode' => 'display'));
Example #5
0
function vd($pVar, $pGlobals = FALSE, $pDelay = FALSE)
{
    global $gBitSystem;
    ob_start();
    if ($pGlobals) {
        print '<h2>$pVar</h2>';
    }
    print vc($pVar);
    if ($pGlobals) {
        if (!empty($_GET)) {
            print '<h2>$_GET</h2>';
            print vc($_GET);
        }
        if (!empty($_POST)) {
            print '<h2>$_POST</h2>';
            print vc($_POST);
        }
        if (!empty($_FILES)) {
            print '<h2>$_FILES</h2>';
            print vc($_FILES);
        }
        if (!empty($_COOKIE)) {
            print '<h2>$_COOKIE</h2>';
            print vc($_COOKIE);
        }
    }
    if ($pDelay) {
        $gBitSystem->mDebugHtml .= ob_get_contents();
        ob_end_clean();
    } else {
        ob_end_flush();
    }
    flush();
}
Example #6
0
        }
    }
    if ($_REQUEST['action'] == 'convert_structure') {
        if ($gNexus->importStructure($_REQUEST['structure_id'])) {
            $formfeedback['success'] = tra('The structure was successfully imported as menu.');
        } else {
            $gBitSystem->fatalError(tra("There was an error importing the structure ") . vc($gNexus->mErrors));
        }
    }
}
if (isset($_REQUEST['confirm'])) {
    if ($gNexus->expungeMenu($menuId)) {
        header("Location: " . NEXUS_PKG_URL . "menus.php");
        die;
    } else {
        $gBitSystem->fatalError(tra("There was an error deleting the menu ") . vc($gNexus->mErrors));
    }
}
if (isset($_REQUEST['store_menu'])) {
    $menu_id = $gNexus->storeMenu($_REQUEST);
    // redirect to menu items page if this is a new menu
    if (empty($menuId)) {
        header('Location: ' . NEXUS_PKG_URL . 'menu_items.php?menu_id=' . $menu_id);
        die;
    }
    $gNexus->load();
    $formfeedback['success'] = tra("The following menu was updated successfully") . ": " . $gNexus->mInfo['title'];
}
$gBitSmarty->assign('menuList', $menuList = $gNexus->getMenuList());
$gBitSmarty->assign('formfeedback', $formfeedback);
// options only available if there is a top bar menu
Example #7
0
 * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * @package wiki
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
include_once WIKI_PKG_PATH . 'BitPage.php';
include_once WIKI_PKG_PATH . 'lookup_page_inc.php';
$gBitSystem->verifyPackage('wiki');
if (!$gContent->isValid()) {
    $gBitSystem->fatalError(tra("No page indicated"));
}
$gContent->verifyUserPermission('p_wiki_remove_page');
if (isset($_REQUEST["confirm"])) {
    if ($gContent->expunge()) {
        header("location: " . WIKI_PKG_URL);
        die;
    } else {
        $gBitSystem->fatalError(tra("There was an error deleting the page:") . ' ' . vc($gContent->mErrors));
    }
}
$gBitSystem->setBrowserTitle(tra('Confirm delete of: ') . $gContent->getTitle());
$formHash['remove'] = TRUE;
$formHash['page_id'] = $_REQUEST['page_id'];
$msgHash = array('label' => tra('Delete WikiPage'), 'confirm_item' => $gContent->getTitle(), 'warning' => tra('All previous versions of this page will be completely deleted.'), 'error' => tra('This cannot be undone!'));
$gBitSystem->confirmDialog($formHash, $msgHash);
Example #8
0
 /**
  * Load all uploaded items in this gallery
  *
  * @param array $pListHash ListHash is passed on to TreasuryItem::getList();
  * @access public
  * @return TRUE on success, FALSE on failure - populates $this->mItems
  */
 function loadItems(&$pListHash)
 {
     $ret = FALSE;
     if ($this->isValid()) {
         require_once TREASURY_PKG_PATH . 'TreasuryItem.php';
         $treasuryItem = new TreasuryItem();
         if (empty($pListHash['gallery_content_id'])) {
             $pListHash['gallery_content_id'] = $this->mContentId;
         }
         if ($this->mItems = $treasuryItem->getList($pListHash, $this->mStructureId)) {
             $ret = TRUE;
         } elseif (!empty($treasuryItem->mErrors)) {
             error_log("Error loading treasury items: " . vc($treasuryItem->mErrors));
         }
     }
     return $ret;
 }
Example #9
0
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * $Id$
 * @package sitehome
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
include_once SITEHOME_PKG_PATH . 'BitSiteHome.php';
include_once SITEHOME_PKG_PATH . 'lookup_sitehome_inc.php';
$gBitSystem->verifyPackage('sitehome');
if (!$gContent->isValid()) {
    $gBitSystem->fatalError("No sitehome indicated");
}
$gContent->verifyUpdatePermission();
if (isset($_REQUEST["confirm"])) {
    if ($gContent->expunge()) {
        header("location: " . BIT_ROOT_URL);
        die;
    } else {
        $gBitSystem->fatalError("There was an error deleting site home: " . vc($gContent->mErrors));
    }
}
$gBitSystem->setBrowserTitle(tra('Confirm delete of: ') . $gContent->getTitle());
$formHash['remove'] = TRUE;
$formHash['sitehome_id'] = $_REQUEST['sitehome_id'];
$msgHash = array('label' => tra('Delete SiteHome'), 'confirm_item' => $gContent->getTitle(), 'warning' => tra('This sitehome will be completely deleted.<br />This cannot be undone!'));
$gBitSystem->confirmDialog($formHash, $msgHash);
Example #10
0
 /**
  * Store menu in db
  * @param menu_id if set, will update given menu - if not set, we create a new entry in the db
  * @param title title of menu
  * @param description description of menu
  * @param menu_type type of menu
  * @param editable if menu is editable by other users - takes 0 or 1
  * @return new menu menu_id or FALSE if not created
  */
 function storeMenu(&$pParamHash)
 {
     $ret = FALSE;
     if ($this->verifyMenu($pParamHash)) {
         if (!@BitBase::verifyId($pParamHash['menu_id'])) {
             $query = "INSERT INTO `" . BIT_DB_PREFIX . "nexus_menus`( `title`,`description`,`menu_type`,`plugin_guid`,`editable` ) VALUES(?,?,?,?,?)";
             $result = $this->mDb->query($query, array($pParamHash['title'], $pParamHash['description'], $pParamHash['menu_type'], $pParamHash['plugin_guid'], $pParamHash['editable']));
             $query = "SELECT MAX(`menu_id`) FROM `" . BIT_DB_PREFIX . "nexus_menus`";
             $ret = $this->mDb->getOne($query, array());
         } else {
             $query = "UPDATE `" . BIT_DB_PREFIX . "nexus_menus` SET `title`=?,`description`=?,`menu_type`=?,`plugin_guid`=?,`editable`=? WHERE `" . BIT_DB_PREFIX . "nexus_menus`.`menu_id`=?";
             $result = $this->mDb->query($query, array($pParamHash['title'], $pParamHash['description'], $pParamHash['menu_type'], $pParamHash['plugin_guid'], $pParamHash['editable'], $pParamHash['menu_id']));
             $ret = $pParamHash['menu_id'];
         }
         $this->writeMenuCache($ret);
     } else {
         error_log("Error storing menu: " . vc($this->mErrors));
     }
     return $ret;
 }
Example #11
0
                unset($params);
                unset($nodeHash);
                $nodeHash['parent_id'] = $structure_id;
                $nodeHash['root_structure_id'] = $structure_id;
                $nodeHash['level'] = 1;
                //try to add a new structure
                $nodePage = new BitPage();
                $pageId = $nodePage->findByPageName($chapterName);
                if ($pageId) {
                    $nodePage->mPageId = $pageId;
                    $nodePage->load();
                } else {
                    $params['title'] = trim($chapterName);
                    $params['edit'] = '';
                    if (!$nodePage->store($params)) {
                        $gBitSystem->fatalError("There was an error storing the page: " . vc($gContent->mErrors));
                    }
                }
                $nodeHash['content_id'] = $nodePage->mContentId;
                $nodeHash['after_ref_id'] = $gStructure->storeNode($nodeHash);
            }
        }
        header("location: " . WIKI_PKG_URL . "edit_book.php?structure_id=" . $structure_id);
    } else {
        $gBitSmarty->assignByRef('errors', $gContent->mErrors);
        $gBitSmarty->assign('name', $_REQUEST['name']);
        $gBitSmarty->assign('chapters', $_REQUEST['chapters']);
        $mid = 'bitpackage:wiki/create_book.tpl';
    }
} elseif ($gContent->isValid()) {
    // Get all wiki pages for the select box
Example #12
0
 function expunge($pRecursiveDelete = FALSE)
 {
     if ($this->isValid()) {
         $this->StartTrans();
         if ($this->loadImages()) {
             foreach (array_keys($this->mItems) as $key) {
                 if ($pRecursiveDelete) {
                     $this->mItems[$key]->expunge($pRecursiveDelete);
                 } elseif (is_a($this->mItems[$key], 'FisheyeImage')) {
                     // make sure we have a valid content_id before we exec
                     if (is_numeric($this->mItems[$key]->mContentId)) {
                         $query = "SELECT COUNT(`item_content_id`) AS `other_gallery`\n\t\t\t\t\t\t\t\t\t  FROM `" . BIT_DB_PREFIX . "fisheye_gallery_image_map`\n\t\t\t\t\t\t\t\t\t  WHERE `item_content_id`=? AND `gallery_content_id`!=?";
                         if (!($inOtherGallery = $this->mDb->getOne($query, array($this->mItems[$key]->mContentId, $this->mContentId)))) {
                             $this->mItems[$key]->expunge();
                         }
                     }
                 }
             }
         }
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "fisheye_gallery_image_map` WHERE `gallery_content_id`=?";
         $rs = $this->mDb->query($query, array($this->mContentId));
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "fisheye_gallery_image_map` WHERE `item_content_id`=?";
         $rs = $this->mDb->query($query, array($this->mContentId));
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "fisheye_gallery` WHERE `content_id`=?";
         $rs = $this->mDb->query($query, array($this->mContentId));
         if (LibertyContent::expunge()) {
             $this->CompleteTrans();
         } else {
             $this->mDb->RollbackTrans();
             error_log("Error expunging fisheye gallery: " . vc($this->mErrors));
         }
     }
     return count($this->mErrors) == 0;
 }
Example #13
0
 /**
  * Store content restriction if single site update
  * @param $pContentId 
  * @return bool TRUE on success, FALSE if store could not occur. If FALSE, $this->mErrors will have reason why
  * @access public
  **/
 function singleSite($pContentId)
 {
     if (!empty($pContentId) && @BitBase::verifyId($pContentId)) {
         $this->mDb->StartTrans();
         $query = "DELETE FROM `" . BIT_DB_PREFIX . "multisite_content` WHERE content_id =?";
         $ret = $this->mDb->query($query, array($pContentId));
         $item = array('multisite_id' => $this->mMultisiteId, 'content_id' => $pContentId);
         $result = $this->mDb->associateInsert(BIT_DB_PREFIX . "multisite_content", $item);
         $this->mDb->CompleteTrans();
     } else {
         error_log("Error inserting single site restriction: " . vc($this->mErrors));
     }
     return count($this->mErrors) == 0;
 }