本文整理汇总了PHP中ET::session方法的典型用法代码示例。如果您正苦于以下问题:PHP ET::session方法的具体用法?PHP ET::session怎么用?PHP ET::session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ET
的用法示例。
在下文中一共展示了ET::session方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: C
if (!class_exists($className)) {
continue;
}
ET::$plugins[$v] = new $className("addons/plugins/" . $v);
ET::$plugins[$v]->boot();
}
}
//***** 6. INITIALIZE SESSION AND DATABASE, AND CACHE
// Initialize the cache.
$cacheClass = C("esoTalk.cache");
ET::$cache = ETFactory::make($cacheClass ? $cacheClass : "cache");
// Connect to the database.
ET::$database = ETFactory::make("database");
ET::$database->init(C("esoTalk.database.host"), C("esoTalk.database.user"), C("esoTalk.database.password"), C("esoTalk.database.dbName"), C("esoTalk.database.prefix"), C("esoTalk.database.connectionOptions"), C("esoTalk.database.port"));
// Initialize the session.
ET::$session = ETFactory::make("session");
// Check if any plugins need upgrading by comparing the versions in ET::$pluginInfo with the versions in
// ET::$config.
foreach (ET::$plugins as $k => $v) {
if (C("{$k}.version") != ET::$pluginInfo[$k]["version"]) {
if ($v->setup(C("{$k}.version"))) {
ET::writeConfig(array("{$k}.version" => ET::$pluginInfo[$k]["version"]));
}
}
}
//***** 7. PARSE REQUEST
// If $_GET["p"] was explicitly specified, use that.
if (!empty($_GET["p"])) {
$request = $_GET["p"];
unset($_GET["p"]);
} elseif (C("esoTalk.urls.friendly") and isset($_SERVER["REQUEST_URI"])) {
示例2: action_install
/**
* Now that all necessary checks have been made and data has been gathered, perform the installation.
*
* @return void
*/
public function action_install()
{
// If we aren't supposed to be here, get out.
if (!($info = ET::$session->get("install"))) {
$this->redirect(URL("install/info"));
}
// Make sure the base URL has a trailing slash.
if (substr($info["baseURL"], -1) != "/") {
$info["baseURL"] .= "/";
}
// Prepare the $config variable with the installation settings.
$config = array("esoTalk.installed" => true, "esoTalk.version" => ESOTALK_VERSION, "esoTalk.forumTitle" => $info["forumTitle"], "esoTalk.baseURL" => $info["baseURL"], "esoTalk.emailFrom" => "do_not_reply@{$_SERVER["HTTP_HOST"]}", "esoTalk.cookie.name" => 'et');
//"esoTalk.cookie.name" => preg_replace(array("/\s+/", "/[^\w]/"), array("_", ""), $info["forumTitle"]),
// Merge these new config settings into our current conifg variable.
ET::$config = array_merge(ET::$config, $config);
// Initialize the database with our MySQL details.
ET::$database->init(C("esoTalk.database.host"), C("esoTalk.database.user"), C("esoTalk.database.password"), C("esoTalk.database.dbName"), C("esoTalk.database.prefix"), C("esoTalk.database.connectionOptions"), C("esoTalk.database.port"));
// Run the upgrade model's install function.
try {
ET::upgradeModel()->install($info);
} catch (Exception $e) {
$this->fatalError($e->getMessage());
}
// Write the $config variable to config.php.
@unlink(PATH_CONFIG . "/config.php");
ET::writeConfig($config);
/*
// Write custom.css and index.html as empty files (if they're not already there.)
if (!file_exists(PATH_CONFIG."/custom.css")) file_put_contents(PATH_CONFIG."/custom.css", "");
file_put_contents(PATH_CONFIG."/index.html", "");
file_put_contents(PATH_UPLOADS."/index.html", "");
file_put_contents(PATH_UPLOADS."/avatars/index.html", "");
// Write a .htaccess file if they are using friendly URLs (and mod_rewrite).
if (C("esoTalk.urls.rewrite")) {
file_put_contents(PATH_ROOT."/.htaccess", "# Generated by esoTalk
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>");
}
*/
/*
// Write a robots.txt file.
file_put_contents(PATH_ROOT."/robots.txt", "User-agent: *
Crawl-delay: 10
Disallow: /conversations/*?search=*
Disallow: /members/
Disallow: /user/
Disallow: /conversation/start/");
*/
// Clear the session of install data.
ET::$session->remove("install");
// Re-initialize the session and log the administrator in.
ET::$session = ETFactory::make("session");
ET::$session->loginWithMemberId(1);
// Redirect them to the administration page.
$this->redirect(URL("admin"));
}