本文整理汇总了PHP中_elgg_session_boot函数的典型用法代码示例。如果您正苦于以下问题:PHP _elgg_session_boot函数的具体用法?PHP _elgg_session_boot怎么用?PHP _elgg_session_boot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_elgg_session_boot函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: finishBootstraping
/**
* Load remaining engine libraries and complete bootstraping (see start.php)
*
* @param string $step Which step to boot strap for. Required because
* boot strapping is different until the DB is populated.
*
* @return void
*/
protected function finishBootstraping($step)
{
$dbIndex = array_search('database', $this->getSteps());
$settingsIndex = array_search('settings', $this->getSteps());
$adminIndex = array_search('admin', $this->getSteps());
$completeIndex = array_search('complete', $this->getSteps());
$stepIndex = array_search($step, $this->getSteps());
// To log in the user, we need to use the Elgg core session handling.
// Otherwise, use default php session handling
$useElggSession = $stepIndex == $adminIndex && $this->isAction || $stepIndex == $completeIndex;
if (!$useElggSession) {
session_name('Elgg_install');
session_start();
elgg_unregister_event_handler('boot', 'system', 'session_init');
}
if ($stepIndex > $dbIndex) {
// once the database has been created, load rest of engine
global $CONFIG;
$lib_dir = $CONFIG->path . 'engine/lib/';
$this->loadSettingsFile();
$lib_files = array('database.php', 'actions.php', 'admin.php', 'annotations.php', 'cron.php', 'entities.php', 'extender.php', 'filestore.php', 'group.php', 'location.php', 'mb_wrapper.php', 'memcache.php', 'metadata.php', 'metastrings.php', 'navigation.php', 'notification.php', 'objects.php', 'opendd.php', 'pagehandler.php', 'pam.php', 'plugins.php', 'private_settings.php', 'relationships.php', 'river.php', 'sites.php', 'statistics.php', 'tags.php', 'user_settings.php', 'users.php', 'upgrade.php', 'web_services.php', 'widgets.php', 'xml.php', 'deprecated-1.7.php', 'deprecated-1.8.php', 'deprecated-1.9.php');
foreach ($lib_files as $file) {
$path = $lib_dir . $file;
if (!(include_once $path)) {
$msg = elgg_echo('InstallationException:MissingLibrary', array($file));
throw new InstallationException($msg);
}
}
setup_db_connections();
register_translations(dirname(dirname(__FILE__)) . "/languages/");
if ($stepIndex > $settingsIndex) {
$CONFIG->site_guid = (int) datalist_get('default_site');
$CONFIG->site_id = $CONFIG->site_guid;
$CONFIG->site = get_entity($CONFIG->site_guid);
$CONFIG->dataroot = datalist_get('dataroot');
_elgg_session_boot(NULL, NULL, NULL);
}
elgg_trigger_event('init', 'system');
}
}
示例2: finishBootstraping
/**
* Load remaining engine libraries and complete bootstrapping
*
* @param string $step Which step to boot strap for. Required because
* boot strapping is different until the DB is populated.
*
* @return void
* @throws InstallationException
*/
protected function finishBootstraping($step)
{
$dbIndex = array_search('database', $this->getSteps());
$settingsIndex = array_search('settings', $this->getSteps());
$adminIndex = array_search('admin', $this->getSteps());
$completeIndex = array_search('complete', $this->getSteps());
$stepIndex = array_search($step, $this->getSteps());
// To log in the user, we need to use the Elgg core session handling.
// Otherwise, use default php session handling
$useElggSession = $stepIndex == $adminIndex && $this->isAction || $stepIndex == $completeIndex;
if (!$useElggSession) {
session_name('Elgg_install');
session_start();
_elgg_services()->events->unregisterHandler('boot', 'system', 'session_init');
}
if ($stepIndex > $dbIndex) {
// once the database has been created, load rest of engine
$lib_dir = \Elgg\Application::elggDir()->chroot('/engine/lib/');
$this->loadSettingsFile();
$lib_files = array('autoloader.php', 'database.php', 'actions.php', 'admin.php', 'annotations.php', 'cron.php', 'entities.php', 'extender.php', 'filestore.php', 'group.php', 'mb_wrapper.php', 'memcache.php', 'metadata.php', 'metastrings.php', 'navigation.php', 'notification.php', 'objects.php', 'pagehandler.php', 'pam.php', 'plugins.php', 'private_settings.php', 'relationships.php', 'river.php', 'sites.php', 'statistics.php', 'tags.php', 'user_settings.php', 'users.php', 'upgrade.php', 'widgets.php');
foreach ($lib_files as $file) {
if (!(include_once $lib_dir->getPath($file))) {
throw new InstallationException('InstallationException:MissingLibrary', array($file));
}
}
_elgg_services()->db->setupConnections();
_elgg_services()->translator->registerTranslations(\Elgg\Application::elggDir()->getPath("/languages/"));
$this->CONFIG->language = 'en';
if ($stepIndex > $settingsIndex) {
$this->CONFIG->site_guid = (int) _elgg_services()->configTable->get('default_site');
$this->CONFIG->site = get_entity($this->CONFIG->site_guid);
$this->CONFIG->dataroot = _elgg_services()->configTable->get('dataroot');
_elgg_services()->config->getCookieConfig();
_elgg_session_boot();
}
_elgg_services()->events->trigger('init', 'system');
}
}
示例3: _elgg_engine_boot
/**
* Boots the engine
*
* 1. sets error handlers
* 2. connects to database
* 3. verifies the installation succeeded
* 4. loads application configuration
* 5. loads i18n data
* 6. loads cached autoloader state
* 7. loads site configuration
*
* @access private
*/
function _elgg_engine_boot()
{
// Register the error handlers
set_error_handler('_elgg_php_error_handler');
set_exception_handler('_elgg_php_exception_handler');
_elgg_services()->db->setupConnections();
_elgg_services()->db->assertInstalled();
_elgg_load_application_config();
_elgg_load_autoload_cache();
_elgg_load_site_config();
_elgg_session_boot();
_elgg_services()->systemCache->loadAll();
_elgg_services()->translator->loadTranslations();
}
示例4: _elgg_engine_boot
/**
* Boots the engine
*
* 1. sets error handlers
* 2. connects to database
* 3. verifies the installation succeeded
* 4. loads application configuration
* 5. loads i18n data
* 6. loads cached autoloader state
* 7. loads site configuration
*
* @access private
*/
function _elgg_engine_boot()
{
// Register the error handlers
set_error_handler('_elgg_php_error_handler');
set_exception_handler('_elgg_php_exception_handler');
setup_db_connections();
verify_installation();
_elgg_load_application_config();
_elgg_load_autoload_cache();
_elgg_load_site_config();
_elgg_session_boot();
_elgg_load_cache();
_elgg_load_translations();
}
示例5: logout
/**
* Log the current user out
*
* @return bool
*/
function logout()
{
if (isset($_SESSION['user'])) {
if (!elgg_trigger_event('logout', 'user', $_SESSION['user'])) {
return false;
}
$_SESSION['user']->code = "";
$_SESSION['user']->save();
}
unset($_SESSION['username']);
unset($_SESSION['name']);
unset($_SESSION['code']);
unset($_SESSION['guid']);
unset($_SESSION['id']);
unset($_SESSION['user']);
setcookie("elggperm", "", time() - 86400 * 30, "/");
// pass along any messages
$old_msg = $_SESSION['msg'];
session_destroy();
// starting a default session to store any post-logout messages.
_elgg_session_boot(NULL, NULL, NULL);
$_SESSION['msg'] = $old_msg;
return TRUE;
}
示例6: _elgg_engine_boot
/**
* Boots the engine
*
* 1. sets error handlers
* 2. connects to database
* 3. verifies the installation succeeded
* 4. loads application configuration
* 5. loads i18n data
* 6. loads cached autoloader state
* 7. loads site configuration
*
* @access private
*/
function _elgg_engine_boot()
{
// Register the error handlers
set_error_handler('_elgg_php_error_handler');
set_exception_handler('_elgg_php_exception_handler');
$db = _elgg_services()->db;
// we inject the logger here to allow use of DB without loading core
$db->setLogger(_elgg_services()->logger);
$db->setupConnections();
$db->assertInstalled();
_elgg_load_application_config();
_elgg_load_site_config();
_elgg_session_boot();
_elgg_services()->systemCache->loadAll();
_elgg_services()->translator->loadTranslations();
}
示例7: boot
/**
* Boots the engine
*
* @return void
*/
public function boot()
{
// Register the error handlers
set_error_handler('_elgg_php_error_handler');
set_exception_handler('_elgg_php_exception_handler');
$db = _elgg_services()->db;
// we inject the logger here to allow use of DB without loading core
$db->setLogger(_elgg_services()->logger);
$db->setupConnections();
$db->assertInstalled();
$CONFIG = _elgg_services()->config->getStorageObject();
$local_path = Local::root()->getPath();
// setup stuff available without any DB info
$CONFIG->path = $local_path;
$CONFIG->plugins_path = "{$local_path}mod/";
$CONFIG->pluginspath = "{$local_path}mod/";
$CONFIG->entity_types = ['group', 'object', 'site', 'user'];
$CONFIG->language = 'en';
// set cookie values for session and remember me
_elgg_services()->config->getCookieConfig();
// we need this stuff before cache
$rows = $db->getData("\n\t\t\tSELECT *\n\t\t\tFROM {$db->prefix}config\n\t\t\tWHERE `name` IN ('__site_secret__', 'default_site', 'dataroot')\n\t\t");
$configs = [];
foreach ($rows as $row) {
$configs[$row->name] = unserialize($row->value);
}
// booting during installation
if (empty($configs['dataroot'])) {
$configs['dataroot'] = '';
// don't use cache
$CONFIG->boot_cache_ttl = 0;
}
if (!$GLOBALS['_ELGG']->dataroot_in_settings) {
$CONFIG->dataroot = rtrim($configs['dataroot'], '/\\') . DIRECTORY_SEPARATOR;
}
$CONFIG->site_guid = (int) $configs['default_site'];
if (!isset($CONFIG->boot_cache_ttl)) {
$CONFIG->boot_cache_ttl = self::DEFAULT_BOOT_CACHE_TTL;
}
if ($this->timer) {
$this->timer->begin([__CLASS__ . '::getBootData']);
}
// early config is done, now get the core boot data
$data = $this->getBootData($CONFIG, $db);
if ($this->timer) {
$this->timer->begin([__CLASS__ . '::getBootData']);
}
$configs_cache = $data->getConfigValues();
$CONFIG->site = $data->getSite();
$CONFIG->wwwroot = $CONFIG->site->url;
$CONFIG->sitename = $CONFIG->site->name;
$CONFIG->sitedescription = $CONFIG->site->description;
$CONFIG->url = $CONFIG->wwwroot;
_elgg_services()->subtypeTable->setCachedValues($data->getSubtypeData());
foreach ($data->getConfigValues() as $key => $value) {
$CONFIG->{$key} = $value;
}
_elgg_services()->plugins->setBootPlugins($data->getActivePlugins());
_elgg_services()->pluginSettingsCache->setCachedValues($data->getPluginSettings());
if (!$GLOBALS['_ELGG']->simplecache_enabled_in_settings) {
$simplecache_enabled = $configs_cache['simplecache_enabled'];
$CONFIG->simplecache_enabled = $simplecache_enabled === false ? 1 : $simplecache_enabled;
}
$system_cache_enabled = $configs_cache['system_cache_enabled'];
$CONFIG->system_cache_enabled = $system_cache_enabled === false ? 1 : $system_cache_enabled;
// needs to be set before [init, system] for links in html head
$CONFIG->lastcache = (int) $configs_cache['simplecache_lastupdate'];
$GLOBALS['_ELGG']->i18n_loaded_from_cache = false;
if (!empty($CONFIG->debug)) {
_elgg_services()->logger->setLevel($CONFIG->debug);
_elgg_services()->logger->setDisplay(true);
}
_elgg_services()->views->view_path = \Elgg\Application::elggDir()->getPath("/views/");
// finish boot sequence
_elgg_session_boot();
if ($CONFIG->system_cache_enabled) {
_elgg_services()->systemCache->loadAll();
}
_elgg_services()->translator->loadTranslations();
// we always need site->email and user->icontime, so load them together
$user_guid = _elgg_services()->session->getLoggedInUserGuid();
if ($user_guid) {
_elgg_services()->metadataCache->populateFromEntities([$user_guid]);
}
// gives hint to get() how to approach missing values
$CONFIG->site_config_loaded = true;
// invalidate on some actions just in case other invalidation triggers miss something
_elgg_services()->hooks->registerHandler('action', 'all', function ($action) {
if (0 === strpos($action, 'admin/' || $action === 'plugins/settings/save')) {
$this->invalidateCache();
}
}, 1);
}
示例8: logout
/**
* Log the current user out
*
* @return bool
*/
function logout()
{
global $CONFIG;
if (isset($_SESSION['user'])) {
if (!elgg_trigger_event('logout', 'user', $_SESSION['user'])) {
return false;
}
$_SESSION['user']->code = "";
$_SESSION['user']->save();
}
unset($_SESSION['username']);
unset($_SESSION['name']);
unset($_SESSION['code']);
unset($_SESSION['guid']);
unset($_SESSION['id']);
unset($_SESSION['user']);
$cookie = new ElggCookie("elggperm");
$cookie->setExpire("-30 days");
$cookie->domain = "/";
elgg_set_cookie($cookie);
// pass along any messages
$old_msg = $_SESSION['msg'];
session_destroy();
// starting a default session to store any post-logout messages.
_elgg_session_boot(NULL, NULL, NULL);
$_SESSION['msg'] = $old_msg;
return TRUE;
}