function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; $this->tpl_name = 'acp_mods'; $this->page_title = 'ACP_MODS'; $this->tryBuild(); if ( is_dir( BUILDS_DIR . DIRECTORY_SEPARATOR . $this->build->getHash() . DIRECTORY_SEPARATOR . 'install' ) ) { trigger_error( 'Remove install dir('. BUILDS_DIR . DIRECTORY_SEPARATOR . $this->build->getHash() . DIRECTORY_SEPARATOR . 'install' .') and refresh this page', E_USER_WARNING ); } try { if ( !empty($_REQUEST['action']) && in_array( $_REQUEST['action'], array('installMods', 'installModsAndStyle') ) ) { DirUtils::clear($cache->cache_dir); if (!isset($_REQUEST['mod']) || !is_array($_REQUEST['mod'])) $_REQUEST['mod'] = array(); if ($_REQUEST['action'] == 'installModsAndStyle'){ $this->installStyle($_REQUEST['styleName']); } $res = $this->installMods($_REQUEST['mod']); if ($res instanceof Build) { $template->assign_var('WARNING', true); foreach ($_REQUEST['mod'] as $name) $template->assign_block_vars( 'mods', array('NAME'=>$name) ); foreach ($res->getDependences('style') as $name) $template->assign_block_vars( 'dependence', array('NAME'=>$name) ); } elseif ($res instanceof self) { $template->assign_var('SUCCESS', true); } else $template->assign_var('WARNING2', true); } } catch (Exception $e) { $template->assign_var('WARNING', true); foreach ($_REQUEST['mod'] as $name) $template->assign_block_vars( 'mods', array('NAME'=>$name) ); if ($res) foreach ($res->getDependences('style') as $name) $template->assign_block_vars( 'dependence', array('NAME'=>$name) ); } $this->tryBuild(); // error_reporting(E_ALL); foreach (Mod::getList() as $mod) { $template->assign_block_vars( 'result', array( 'NAME' => $mod->getName(), 'DESC' => $mod->getInfo(), 'CHECKED' => $this->build->inBuild($mod) ? ' checked' : '' ) ); } return array(); }