function saveLicensesAction() { $translate = DevblocksPlatform::getTranslationService(); $settings = DevblocksPlatform::getPluginSettingsService(); $worker = UsermeetApplication::getActiveWorker(); if (!$worker || !$worker->is_superuser) { echo $translate->_('common.access_denied'); return; } @($key = DevblocksPlatform::importGPC($_POST['key'], 'string', '')); @($email = DevblocksPlatform::importGPC($_POST['email'], 'string', '')); @($do_delete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0)); if (!empty($do_delete)) { $settings->set('usermeet.core', UsermeetSettings::LICENSE, ''); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings'))); return; } if (empty($key) || empty($email)) { DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings', 'empty'))); return; } if (null == ($valid = UsermeetLicense::validate($key, $email)) || 5 != count($valid)) { DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings', 'invalid'))); return; } /* * [IMPORTANT -- Yes, this is simply a line in the sand.] * You're welcome to modify the code to meet your needs, but please respect * our licensing. Buy a legitimate copy to help support the project! * http://www.usermeet.com/ */ $license = $valid; $settings->set('usermeet.core', UsermeetSettings::LICENSE, serialize($license)); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings'))); }
function hasPriv($priv_id) { // We don't need to do much work if we're a superuser if ($this->is_superuser) { return true; } $settings = DevblocksPlatform::getPluginSettingsService(); $acl_enabled = $settings->get('usermeet.core', UsermeetSettings::ACL_ENABLED); // ACL is a paid feature (please respect the licensing and support the project!) $license = UsermeetLicense::getInstance(); if (!$acl_enabled || !isset($license['serial']) || isset($license['a'])) { return "core.setup" == substr($priv_id, 0, 11) ? false : true; } // Check the aggregated worker privs from roles $acl = DAO_WorkerRole::getACL(); $privs_by_worker = $acl[DAO_WorkerRole::CACHE_KEY_PRIVS_BY_WORKER]; if (!empty($priv_id) && isset($privs_by_worker[$this->id][$priv_id])) { return true; } return false; }
public function writeResponse(DevblocksHttpResponse $response) { $path = $response->path; // [JAS]: Ajax? // [TODO] Explore outputting whitespace here for Safari // if(empty($path)) // return; $tpl = DevblocksPlatform::getTemplateService(); $session = DevblocksPlatform::getSessionService(); $settings = DevblocksPlatform::getPluginSettingsService(); $translate = DevblocksPlatform::getTranslationService(); $active_worker = UsermeetApplication::getActiveWorker(); $visit = $session->getVisit(); $page_manifests = $this->_getAllowedPages(); $controller = array_shift($path); // Default page [TODO] This is supposed to come from framework.config.php if (empty($controller)) { $controller = 'home'; } // [JAS]: Require us to always be logged in for Usermeet pages if (empty($visit) && 0 != strcasecmp($controller, 'login')) { $query = array(); if (!empty($response->path)) { $query = array('url' => urlencode(implode('/', $response->path))); } DevblocksPlatform::redirect(new DevblocksHttpRequest(array('login'), $query)); } $page_id = $this->_getPageIdByUri($controller); @($page = DevblocksPlatform::getExtension($page_id, true)); /* @var $page UsermeetPageExtension */ if (empty($page)) { header("Status: 404"); return; // [TODO] 404 } // [JAS]: Listeners (Step-by-step guided tour, etc.) $listenerManifests = DevblocksPlatform::getExtensions('devblocks.listener.http'); foreach ($listenerManifests as $listenerManifest) { /* @var $listenerManifest DevblocksExtensionManifest */ $inst = $listenerManifest->createInstance(); /* @var $inst DevblocksHttpRequestListenerExtension */ $inst->run($response, $tpl); } $tpl->assign('active_worker', $active_worker); $tour_enabled = false; if (!empty($visit) && !is_null($active_worker)) { $tour_enabled = intval(DAO_WorkerPref::get($active_worker->id, 'assist_mode', 1)); $keyboard_shortcuts = intval(DAO_WorkerPref::get($active_worker->id, 'keyboard_shortcuts', 1)); $tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts); // $active_worker_memberships = $active_worker->getMemberships(); // $tpl->assign('active_worker_memberships', $active_worker_memberships); $unread_notifications = DAO_WorkerEvent::getUnreadCountByWorker($active_worker->id); $tpl->assign('active_worker_notify_count', $unread_notifications); DAO_Worker::logActivity($active_worker->id, $page->getActivity()); } $tpl->assign('tour_enabled', $tour_enabled); // [JAS]: Variables provided to all page templates $tpl->assign('settings', $settings); $tpl->assign('session', $_SESSION); $tpl->assign('translate', $translate); $tpl->assign('visit', $visit); $tpl->assign('license', UsermeetLicense::getInstance()); $tpl->assign('page_manifests', $page_manifests); $tpl->assign('page', $page); $tpl->assign('response_uri', implode('/', $response->path)); $core_tpl = APP_PATH . '/features/usermeet.core/templates/'; $tpl->assign('core_tpl', $core_tpl); // Prebody Renderers $preBodyRenderers = DevblocksPlatform::getExtensions('usermeet.renderer.prebody', true); if (!empty($preBodyRenderers)) { $tpl->assign('prebody_renderers', $preBodyRenderers); } // Postbody Renderers $postBodyRenderers = DevblocksPlatform::getExtensions('usermeet.renderer.postbody', true); if (!empty($postBodyRenderers)) { $tpl->assign('postbody_renderers', $postBodyRenderers); } // Timings $tpl->assign('render_time', microtime(true) - DevblocksPlatform::getStartTime()); if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) { $tpl->assign('render_memory', memory_get_usage() - DevblocksPlatform::getStartMemory()); $tpl->assign('render_peak_memory', memory_get_peak_usage() - DevblocksPlatform::getStartPeakMemory()); } $tpl->display($core_tpl . 'border.tpl'); // $cache = DevblocksPlatform::getCacheService(); // $cache->printStatistics(); }