/** * 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);
foreach ($diskUsage as $key => $item) { if ($_GET['prune'] == $key || $_GET['prune'] == 'all') { $dir = $item['path'] . (!empty($item['subdir']) ? '/' . $item['subdir'] : ''); if (is_dir($dir) && strpos($item['path'], BIT_ROOT_PATH) === 0) { if (unlink_r($dir)) { $reload = TRUE; } else { $feedback['error'] = tra('There was a problem clearing out the cache.'); } } } } // nexus needs to rewrite the cache right away to avoid errors if ($gBitSystem->isPackageActive('nexus') && ($_GET['prune'] == 'all' || $_GET['prune'] == 'nexus')) { require_once NEXUS_PKG_PATH . 'Nexus.php'; $nexus = new Nexus(); $nexus->rewriteMenuCache(); } // depending on what we've just nuked, we need to reload the page if (!empty($reload)) { bit_redirect(KERNEL_PKG_URL . "admin/admin_system.php?pruned=1"); } } if (!empty($_GET['compiletemplates'])) { cache_templates(BIT_ROOT_PATH, $gBitLanguage->getLanguage(), $_GET['compiletemplates']); } foreach ($diskUsage as $key => $item) { $diskUsage[$key]['du'] = du($item['path']); } $gBitSmarty->assign('diskUsage', $diskUsage); $languages = array();
<?php require_once NEXUS_PKG_PATH . 'Nexus.php'; $gNexus = new Nexus(); $gNexusSystem->scanAllPlugins(NEXUS_PKG_PATH . 'plugins/'); $feedback = array(); if (!empty($_REQUEST['rewrite_cache'])) { if ($gNexus->rewriteMenuCache()) { $feedback['success'] = tra('The complete menu cache has been rewritten.'); } } if (!empty($_REQUEST['pluginsave'])) { $gNexusSystem->setActivePlugins($_REQUEST['plugins']); $feedback['success'] = tra('The plugins were successfully updated'); } $gBitSmarty->assign('feedback', $feedback);
/** * 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; }