function installMods($mods) { global $config, $db, $user, $auth, $template, $cache; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; $res = $db->sql_query( 'SELECT style_name FROM ' . $table_prefix . 'styles WHERE style_id = ' . $config['default_style'] ); $this->style = $db->sql_fetchfield('style_name'); $build = Build::create(); foreach ($mods as $modName) $build->addMod(Mod::create()->setName($modName)); try { $deps = $build->getDependences('style'); } catch (Exception $e) { return null; } if ($deps && !in_array($this->style, $deps)) { return $build; } else { try { InstallAction::me()->setBuild($build)->run(); file_put_contents( USER_DIR . DIRECTORY_SEPARATOR . '.htaccess', str_replace( $this->build->getHash(), $build->getHash(), file_get_contents( USER_DIR . DIRECTORY_SEPARATOR . '.htaccess' ) ) ); file_put_contents( USER_DIR . DIRECTORY_SEPARATOR . 'nginx.rewrite', str_replace( $this->build->getHash(), $build->getHash(), file_get_contents( USER_DIR . DIRECTORY_SEPARATOR . 'nginx.rewrite' ) ) ); } catch (Exception $e) { trigger_error($e->getMessage(),E_USER_WARNING); } } return $this; }