function getCommunityToolAction() { $worker = CerberusApplication::getActiveWorker(); if (!$worker || !$worker->is_superuser) { echo "Access denied."; return; } @($portal = DevblocksPlatform::importGPC($_REQUEST['portal'], 'string', '')); @($is_submitted = DevblocksPlatform::importGPC($_POST['is_submitted'], 'integer', 0)); UmPortalHelper::setCode($portal); if (!empty($is_submitted)) { $is_submitted = time(); } $tpl = DevblocksPlatform::getTemplateService(); $tpl->cache_lifetime = "0"; $tpl_path = dirname(__FILE__) . '/templates/'; $tpl->assign('path', $tpl_path); $tpl->assign('portal', $portal); $tpl->assign('is_submitted', $is_submitted); if (null != ($instance = DAO_CommunityTool::getByCode($portal))) { $tpl->assign('instance', $instance); $manifest = DevblocksPlatform::getExtension($instance->extension_id, false, true); if (null != ($tool = $manifest->createInstance())) { /* @var $app Extension_UsermeetTool */ $tpl->assign('tool', $tool); } } // Community Record $community_id = $instance->community_id; $community = DAO_Community::get($community_id); $tpl->assign('community', $community); // Install $url_writer = DevblocksPlatform::getUrlService(); $url = $url_writer->write('c=portal&a=' . $portal, true); $url_parts = parse_url($url); $host = $url_parts['host']; @($port = $_SERVER['SERVER_PORT']); $base = substr(DEVBLOCKS_WEBPATH, 0, -1); // consume trailing $path = substr($url_parts['path'], strlen(DEVBLOCKS_WEBPATH) - 1); // consume trailing slash @($parts = explode('/', $path)); if ($parts[1] == 'index.php') { // 0 is null from /part1/part2 paths. unset($parts[1]); } $path = implode('/', $parts); $tpl->assign('host', $host); $tpl->assign('is_ssl', $url_writer->isSSL() ? 1 : 0); $tpl->assign('port', $port); $tpl->assign('base', $base); $tpl->assign('path', $path); $tpl->display('file:' . $tpl_path . 'community/config/tab/tool_config.tpl'); }