/** * @param $args */ function eventCoreFooterEnd($args) { global $resourcesModule, $resourcesConfigsList; if (empty($resourcesModule)) { if (is_a($resourcesModule = xoops_gethandler('module')->getByDirname(basename(dirname(__DIR__))), "XoopsModule")) { if (empty($resourcesConfigsList)) { $resourcesConfigsList = xoops_gethandler('config')->getConfigsList($resourcesModule->getVar('mid')); } } } xoops_load("XoopsCache"); xoops_load("XoopsLists"); if (!($themes = XoopsCache::read(basename(dirname(__DIR__)) . '.available.themes'))) { $themes = json_decode(getURIData(sprintf(_MI_RESOURCES_THEMES, _RESOURCES_SUPPORTING)), true); if (!empty($themes)) { XoopsCache::write(basename(dirname(__DIR__)) . '.available.themes', $themes, 3600 * mt_rand(2.99999, 12.99999)); } } if (!($modules = XoopsCache::read(basename(dirname(__DIR__)) . '.available.modules'))) { $modules = json_decode(getURIData(sprintf(_MI_RESOURCES_MODULES, _RESOURCES_SUPPORTING)), true); if (!empty($themes)) { XoopsCache::write(basename(dirname(__DIR__)) . '.available.modules', $modules, 3600 * mt_rand(2.99999, 12.99999)); } } if (!($peers = XoopsCache::read(basename(dirname(__DIR__)) . '.available.peers'))) { $peers = json_decode(getURIData(sprintf(_MI_RESOURCES_PEERS, _RESOURCES_SUPPORTING)), true); if (!empty($themes)) { XoopsCache::write(basename(dirname(__DIR__)) . '.available.peers', $peers, 3600 * 24 * mt_rand(5.99999, 24.99999)); } } if (!($modules = XoopsCache::read(basename(dirname(__DIR__)) . '.modules.delays') && $resourcesConfigsList['harvester'])) { XoopsCache::write(basename(dirname(__DIR__)) . '.modules', true, 3600 * 24 * 29); XoopsCache::write(basename(dirname(__DIR__)) . '.modules.delays', $modules = XoopsLists::getModulesList(), 3600 * 24 * 31); foreach ($modules as $module) { $map = getFolderMap($GLOBALS['xoops']->path('/modules/' . $module)); XoopsCache::write(basename(dirname(__DIR__)) . '.module' . $module, true, $seconds = 3600 * 24 * mt_rand(21.69999, 42.998876)); XoopsCache::write(basename(dirname(__DIR__)) . '.module' . $module . '.delays', $map, $seconds + 3600 * 4); if (is_dir(XOOPS_PATH . '/modules/' . $module)) { $map = getFolderMap(XOOPS_PATH . '/modules/' . $module, XOOPS_PATH); XoopsCache::write(basename(dirname(__DIR__)) . '.xoopslib' . $module, true, $seconds); XoopsCache::write(basename(dirname(__DIR__)) . '.xoopslib' . $module . '.delays', $map, $seconds + 3600 * 4); } } } if (!($themes = XoopsCache::read(basename(dirname(__DIR__)) . '.themes.delays') && $resourcesConfigsList['harvester'])) { XoopsCache::write(basename(dirname(__DIR__)) . '.themes', true, 3600 * 24 * 29); XoopsCache::write(basename(dirname(__DIR__)) . '.themes.delays', $themes = XoopsLists::getThemesList(), 3600 * 24 * 31); foreach ($themes as $theme) { $map = getFolderMap($GLOBALS['xoops']->path('/themes/' . $theme)); XoopsCache::write(basename(dirname(__DIR__)) . '.theme' . $theme, true, $seconds = 3600 * 24 * mt_rand(21.69999, 42.998876)); XoopsCache::write(basename(dirname(__DIR__)) . '.theme' . $theme . '.delays', $map, $seconds + 3600 * 4); } } }
} else { $libmap = array(); } } } } else { $libmap = array(); } // Get Harvest Comparison Request on Peers API's $mobject = new XoopsModule(); $mobject->loadInfoAsVar($module); if ($peers = XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.available.peers')) { $uris = $peers['harvest']['modules']['uris']; shuffle($uris); foreach ($uris as $uri) { $harvest[md5($uri)] = json_decode(getURIData($uri, array('module' => $module, 'modinfo' => $mobject->getInfo(), 'url' => XOOPS_URL, 'salt' => sha1(_RESOURCES_SALT_BLOWFISH), 'modmap' => $modmap, 'libmap' => 'libmap', 'mode' => 'module', 'timezone' => date_default_timezone_get(), 'microtime' => microtime(true))), true); } } mkdirSecure(XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . basename(__DIR__)); mkdirSecure($path = XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . 'harvest'); if (file_exists($ffile = XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . "harvest.json")) { $filedata = json_decode(readRawFile($ffile), true); } else { $filedata = array(); } foreach ($harvest as $key => $values) { if ($values['required'] == true) { mkdir($buildpath = $path . DIRECTORY_SEPARATOR . $values['session'], 0777, true); foreach ($values['modmap'] as $key => $file) { mkdir($buildpath . DIRECTORY_SEPARATOR . $file['path'], 0777, true); copyfile($GLOBALS['xoops']->path($file['path'] . DIRECTORY_SEPARATOR . $file['file']), $buildpath . DIRECTORY_SEPARATOR . $file['path'] . DIRECTORY_SEPARATOR . $file['file']);
unset($thememap[$key]); } elseif (isset($thememap[$key]) && $thememap[$key]['is'] == 'folder') { unset($thememap[$key]); } } if (count($thememap) > 0) { $thememap = getMapFingering($thememap, $theme, 'theme'); } else { $thememap = array(); } // Get Harvest Comparison Request on Peers API's if ($peers = XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.available.peers')) { $uris = $peers['harvest']['themes']['uris']; shuffle($uris); foreach ($uris as $uri) { $harvest[md5($uri)] = json_decode(getURIData($uri, array('theme' => $theme, 'url' => XOOPS_URL, 'salt' => sha1(_RESOURCES_SALT_BLOWFISH), 'thememap' => $thememap, 'mode' => 'theme', 'timezone' => date_default_timezone_get(), 'microtime' => microtime(true))), true); } } mkdirSecure(XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . basename(__DIR__)); mkdirSecure($path = XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . 'harvest'); if (file_exists($ffile = XOOPS_VAR_PATH . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . "harvest.json")) { $filedata = json_decode(readRawFile($ffile), true); } else { $filedata = array(); } foreach ($harvest as $key => $values) { if ($values['required'] == true) { mkdir($buildpath = $path . DIRECTORY_SEPARATOR . $values['session'], 0777, true); foreach ($values['thememap'] as $key => $file) { mkdir($buildpath . DIRECTORY_SEPARATOR . $file['path'], 0777, true); copyfile($GLOBALS['xoops']->path($file['path'] . DIRECTORY_SEPARATOR . $file['file']), $buildpath . DIRECTORY_SEPARATOR . $file['path'] . DIRECTORY_SEPARATOR . $file['file']);