/** * 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']); } }
<?php /** * @author xing <*****@*****.**> * @version $Revision$ * @package nexus * @subpackage functions */ global $gNexus; if (@BitBase::verifyId($_REQUEST['menu_id'])) { $menuId = $_REQUEST['menu_id']; $gNexus = new Nexus($menuId); } else { $gNexus = new Nexus(); $menuId = NULL; } $gNexus->load(); $gBitSmarty->assign_by_ref('gNexus', $gNexus); $gBitSmarty->assign_by_ref('menuId', $menuId);
/** * writes cache files to where the plugins determine * @param $pMenuId menu id of the menu for which we want to create a cache file * @return number of errors encountered */ function writeMenuCache($pMenuId = NULL) { if ($this->isValid() && !@BitBase::verifyId($pMenuId)) { $pMenuId = $this->mInfo['menu_id']; } // load the menu if need be $cacheMenu = new Nexus($pMenuId); $cacheMenu->load(); if (!empty($cacheMenu->mInfo['plugin_guid'])) { global $gNexusSystem; if ($func = $gNexusSystem->getPluginFunction($cacheMenu->mInfo['plugin_guid'], 'write_cache_function')) { $moduleCache = $func($cacheMenu); } } if (!empty($moduleCache)) { foreach ($moduleCache as $cache_file => $cache_string) { $h = fopen(TEMP_PKG_PATH . NEXUS_PKG_NAME . '/modules/' . $cache_file, 'w'); if (isset($h)) { fwrite($h, $cache_string); fclose($h); } else { $this->mErrors['write_module_cache'] = tra("Unable to write to") . ': ' . realpath($cache_file); } } } else { $this->mErrors['write_module_cache'] = tra("Unable to write the cache file because there was something wrong with the plugin ") . ': ' . $cacheMenu->mInfo['plugin_guid']; } return count($this->mErrors) == 0; }