static function logout() { SessionStorage::destroy(SJB_Session::getSessionId()); $forumPath = SJB_Settings::getSettingByName('forum_path'); if (empty($forumPath)) { return; } $url = SJB_System::getSystemSettings('SITE_URL') . $forumPath . '/'; $client = new Zend_Http_Client($url, array('useragent' => SJB_Request::getUserAgent())); $client->setCookie($_COOKIE); $client->setCookieJar(); try { $response = $client->request(); $matches = array(); if (preg_match('/\\.\\/ucp.php\\?mode=logout\\&sid=([\\w\\d]+)"/', $response->getBody(), $matches)) { $sid = $matches[1]; $client->setUri($url . 'ucp.php?mode=logout&sid=' . $sid); $response = $client->request(); foreach ($response->getHeaders() as $key => $header) { if ('set-cookie' == strtolower($key)) { if (is_array($header)) { foreach ($header as $val) { header("Set-Cookie: " . $val, false); } } else { header("Set-Cookie: " . $header, false); } } } } } catch (Exception $ex) { } }
public static function init() { SJB_DB::init(SJB_System::getSystemSettings('DBHOST'), SJB_System::getSystemSettings('DBUSER'), SJB_System::getSystemSettings('DBPASSWORD'), SJB_System::getSystemSettings('DBNAME')); ini_set('zlib.output_compression', SJB_System::getSettingByName('gzip_compression')); $GLOBALS['fatal_error_reserve_buffer'] = str_repeat('x', 1024 * 200); ob_start(array('SJB_Error', 'fatalErrorHandler')); SJB_Session::init(SJB_System::getSystemSettings('SITE_URL')); $sessionId = SJB_DB::queryValue("SELECT `session_id` FROM `user_session_data_storage` WHERE `session_id` = ?s", SJB_Session::getSessionId()); // if not updated (row not exists) - insert that value if (empty($sessionId)) { SJB_DB::query("INSERT INTO `user_session_data_storage` SET `last_activity` = NOW(), `session_id` = ?s", SJB_Session::getSessionId()); } else { SJB_DB::query("UPDATE `user_session_data_storage` SET `last_activity` = NOW() WHERE `session_id` = ?s", $sessionId); } //set timezone if (SJB_Settings::getSettingByName('timezone')) { ini_set('date.timezone', SJB_Settings::getSettingByName('timezone')); } // Set Error Handler and Shutdown function set_error_handler(array('SJB_Error', 'errorHandler')); register_shutdown_function(array('SJB_System', 'shutdownFunction')); SJB_System::prepareGlobalArrays(); SJB_System::setGlobalTemplateVariable('is_ajax', SJB_Request::isAjax()); SJB_System::setGlobalTemplateVariable('site_url', SJB_System::getSystemSettings('SITE_URL')); SJB_System::setGlobalTemplateVariable('user_site_url', SJB_System::getSystemSettings('USER_SITE_URL')); SJB_System::setGlobalTemplateVariable('admin_site_url', SJB_System::getSystemSettings('ADMIN_SITE_URL')); SJB_System::setGlobalTemplateVariable('radius_search_unit', SJB_System::getSettingByName('radius_search_unit')); SJB_System::setGlobalTemplateVariable('settings', SJB_Settings::getSettings()); ThemeManager::getCurrentTheme(); SJB_PluginManager::loadPlugins(SJB_System::getSystemSettings('PLUGINS_DIR')); SJB_System::setGlobalTemplateVariable('plugins', SJB_PluginManager::getAllPluginsList()); $GLOBALS['System']['MODULE_MANAGER'] = new SJB_ModuleManager(); SJB_Event::dispatch('moduleManagerCreated'); $GLOBALS['System']['MODULE_MANAGER']->executeModulesStartupFunctions(); // define if subadmin loged in and set subamdinmode for templates if (SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') == SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE') && SJB_SubAdmin::getSubAdminSID()) { SJB_System::setGlobalTemplateVariable('subAdminSID', SJB_SubAdmin::getSubAdminSID()); } $GLOBALS['uri'] = SJB_Navigator::getURI(); }
<?php require_once 'phpbb_bridge_plugin.php'; $userSession = PhpBBBridgePlugin::getUserSessionBySessionId(SJB_Session::getSessionId()); if (!empty($userSession)) { if (SJB_UserManager::isUserLoggedIn()) { if ($userSession['user_sid'] !== SJB_UserManager::getCurrentUserSID()) { if (!$userSession['user_sid']) { SJB_Authorization::logout(); } else { SJB_Session::setValue('current_user', PhpBBBridgePlugin::sessionDecode($userSession['data'])); } } } else { SJB_Session::setValue('current_user', PhpBBBridgePlugin::sessionDecode($userSession['data'])); } } SJB_Event::handle('Login', array('PhpBBBridgePlugin', 'login')); SJB_Event::handle('Logout', array('PhpBBBridgePlugin', 'logout'));
private function validationManager($fieldInfo, $tp, $uploadedFieldId, $complex = null) { // will use tmp_uploads_storage in $_SESSION to storage file info $uniqueStorageId = SJB_Session::getSessionId(); $this->fileUniqueId = $uniqueStorageId . "_" . $uploadedFieldId . "_tmp"; // delete uniquie value SJB_UploadFileManager::deleteUploadedFileByID($this->fileUniqueId); $this->property = new SJB_ObjectProperty($fieldInfo); $this->property->setValue(''); if ($complex) { $this->property->setComplexParent($complex['parentField']); $this->property->setComplexEnum($complex['complexStep']); $fileNamePath = "{$complex['parentField']}/name/{$complex['subFieldId']}/{$complex['complexStep']}"; $fileSizePath = "{$complex['parentField']}/size/{$complex['subFieldId']}/{$complex['complexStep']}"; } else { $fileNamePath = $uploadedFieldId . '/name'; $fileSizePath = $uploadedFieldId . '/size'; } $fileName = SJB_Array::getPath($_FILES, $fileNamePath); if (!$fileName) { $validation = 'UPLOAD_ERR_INI_SIZE'; } else { $uploadedFilesize = SJB_Array::getPath($_FILES, $fileSizePath); $filesizeInfo = SJB_HelperFunctions::getFileSizeAndSizeToken($uploadedFilesize); $tp->assign(array('filesize' => $filesizeInfo['filesize'], 'size_token' => $filesizeInfo['size_token'])); $validation = $this->property->isValid(); } $this->propertyValue = $this->property->getValue(); if ($validation !== true) { $this->errors[$validation] = 1; if (!$complex) { $tp->assign(array('id' => $uploadedFieldId, 'value' => array('file_url' => SJB_Array::get($this->propertyValue, 'file_url'), 'file_name' => SJB_Array::get($this->propertyValue, 'file_name'), 'saved_file_name' => SJB_Array::get($this->propertyValue, 'saved_file_name'), 'file_id' => $this->fileUniqueId))); } } $tp->assign("uploadMaxFilesize", SJB_UploadFileManager::getIniUploadMaxFilesize()); return $validation === true; }