本文整理汇总了PHP中e107::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getSession方法的具体用法?PHP e107::getSession怎么用?PHP e107::getSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sc_lm_password_input
function sc_lm_password_input($parm = '')
{
$pref = e107::getPref();
$t_password = "<input class='form-control tbox login pass' type='password' placeholder='" . LAN_PASSWORD . "' required='required' name='userpass' id='userpass' size='15' value='' maxlength='30' />\n";
if (!USER && e107::getSession()->is('challenge') && varset($pref['password_CHAP'], 0)) {
$t_password .= "<input type='hidden' name='hashchallenge' id='hashchallenge' value='" . e107::getSession()->get('challenge') . "' />\n\n";
}
return $t_password;
}
示例2: sc_login_table_password
function sc_login_table_password($parm = '')
{
$pref = e107::getPref();
$text = "<input class='tbox form-control input-block-level' type='password' name='userpass' id='userpass' size='40' maxlength='100' placeholder=\"" . LAN_LOGIN_2 . "\" />";
if (!USER && e107::getSession()->is('challenge') && varset($pref['password_CHAP'], 0)) {
$text .= "<input type='hidden' name='hashchallenge' id='hashchallenge' value='" . e107::getSession()->get('challenge') . "' />\n\n";
}
return $text;
}
示例3: tryProviderSession
public function tryProviderSession($deniedAs)
{
// don't allow if main admin browse front-end or there is already user session
if (!$deniedAs && $this->getSessionDataAs() || null !== $this->_session_data || !e107::getPref('social_login_active', false)) {
return $this;
}
try {
// detect all currently connected providers
$hybrid = e107::getHybridAuth();
// init the auth class
$connected = Hybrid_Auth::getConnectedProviders();
} catch (Exception $e) {
e107::getMessage()->addError('[' . $e->getCode() . ']' . $e->getMessage(), 'default', true);
$session = e107::getSession();
$session->set('HAuthError', true);
$connected = false;
}
// no active session found
if (!$connected) {
return $this;
}
// query DB
$sql = e107::getDb();
$where = array();
foreach ($connected as $providerId) {
$adapter = Hybrid_Auth::getAdapter($providerId);
if (!$adapter->getUserProfile()->identifier) {
continue;
}
$id = $providerId . '_' . $adapter->getUserProfile()->identifier;
$where[] = "user_xup='" . $sql->escape($id) . "'";
}
$where = implode(' OR ', $where);
if ($sql->db_Select('user', 'user_id, user_password, user_xup', $where)) {
$user = $sql->db_Fetch();
e107::getUserSession()->makeUserCookie($user);
$this->setSessionData();
}
return $this;
}
示例4: e_install
function e_install()
{
// notice removal, required from various core routines
define('USERID', 1);
define('USER', true);
define('ADMIN', true);
// session instance
$this->session = e107::getSession();
$this->logFile = '';
if (MAKE_INSTALL_LOG) {
if (is_writable(dirname(__FILE__))) {
$this->logFile = dirname(__FILE__) . '/e107InstallLog.log';
}
}
// $this->logLine('Query string: ');
$this->template = new SimpleTemplate();
while (@ob_end_clean()) {
}
global $e107;
$this->e107 = $e107;
if (isset($_POST['previous_steps'])) {
$this->previous_steps = unserialize(base64_decode($_POST['previous_steps']));
unset($_POST['previous_steps']);
} else {
$this->previous_steps = array();
}
$this->get_lan_file();
$this->post_data = $_POST;
$this->template->SetTag('required', '');
if (isset($this->previous_steps['language'])) {
define("e_LANGUAGE", $this->previous_steps['language']);
include_lan(e_LANGUAGEDIR . e_LANGUAGE . "/admin/lan_admin.php");
}
}
示例5: enter_comment
/**
* Add a comment to an item
* e-token POST value should be always valid when using this method.
*
* @param string|array $data - $author_name or array of all values.
* @param unknown_type $comment
* @param unknown_type $table
* @param integer $id - reference of item in source table to which comment is linked
* @param unknown_type $pid - parent comment id when it's a reply to a specific comment. t
* @param unknown_type $subject
* @param unknown_type $rateindex
*/
function enter_comment($data, $comment = '', $table = '', $id = '', $pid = '', $subject = '', $rateindex = FALSE)
{
//rateindex : the posted value from the rateselect box (without the urljump) (see function rateselect())
if ($this->engine != 'e107') {
return;
}
if (is_array($data)) {
$table = $data['comment_type'];
$id = intval($data['comment_item_id']);
$pid = intval($data['comment_pid']);
$subject = $data['comment_subject'];
$comment = $data['comment_comment'];
$author_name = $data['comment_author_name'];
$comment_share = intval($data['comment_share']);
$comment_datestamp = $data['comment_datestamp'];
} else {
$author_name = $data;
//BC Fix.
}
global $e107, $rater;
$sql = e107::getDb();
$sql2 = e107::getDb('sql2');
$tp = e107::getParser();
$pref = e107::getPref();
if ($this->getCommentPermissions() != 'rw') {
return;
}
if ($user_func = e107::getOverride()->check($this, 'enter_comment')) {
return call_user_func($user_func, array('data' => $data, 'comment' => $comment, 'table' => $table, 'id' => $id, 'pid' => $pid, 'subject' => $subject, 'rateindex' => $rateindex));
}
if (!isset($_POST['e-token'])) {
$_POST['e-token'] = '';
}
// check posted token
if (!e107::getSession()->check(false)) {
return false;
}
// This will return false on error
if (isset($_GET['comment']) && $_GET['comment'] == 'edit') {
$eaction = 'edit';
$editpid = $_GET['comment_id'];
} elseif (strstr(e_QUERY, "edit")) {
$eaction = "edit";
$tmp = explode(".", e_QUERY);
$count = 0;
foreach ($tmp as $t) {
if ($t == "edit") {
$editpid = $tmp[$count + 1];
break;
}
$count++;
}
}
$type = $this->getCommentType($table);
$comment = $tp->toDB($comment);
$subject = $tp->toDB($subject);
$cuser_id = 0;
$cuser_name = 'Anonymous';
// Preset as an anonymous comment
if (!$sql->select("comments", "*", "comment_comment='" . $comment . "' AND comment_item_id='" . intval($id) . "' AND comment_type='" . $tp->toDB($type, true) . "' ")) {
if ($_POST['comment']) {
if (USER == TRUE) {
$cuser_id = USERID;
$cuser_name = USERNAME;
$cuser_mail = USEREMAIL;
} elseif ($_POST['author_name'] != '') {
if ($sql2->select("user", "*", "user_name='" . $tp->toDB($_POST['author_name']) . "' ")) {
if ($sql2->select("user", "*", "user_name='" . $tp->toDB($_POST['author_name']) . "' AND user_ip='" . $tp->toDB($ip, true) . "' ")) {
//list($cuser_id, $cuser_name) = $sql2->db_Fetch();
$tmp = $sql2->fetch();
$cuser_id = $tmp['user_id'];
$cuser_name = $tmp['user_name'];
$cuser_mail = $tmp['user_email'];
} else {
define("emessage", COMLAN_310);
}
} else {
$cuser_name = $tp->toDB($author_name);
}
}
if (!defined("emessage")) {
$ip = $e107->getip();
// Store IP 'in the raw' - could be IPv4 or IPv6. Its always returned in a normalised form
$_t = time();
if ($editpid) {
$comment .= "\n[ " . COMLAN_319 . " [time=short]" . time() . "[/time] ]";
$sql->update("comments", "comment_comment='{$comment}' WHERE comment_id='" . intval($editpid) . "' ");
e107::getCache()->clear("comment");
//.........这里部分代码省略.........
示例6: checkUserPassword
/**
* Checks user password againt preferences set etc
* Assumes that $this->userData array already set up
*
* @param string $username - the user name string as entered (might not relate to the intended user at this stage)
* @param string $userpass - as entered
* @param string $response - received string if CHAP used
* @param boolean $forceLogin - TRUE if login is being forced from clicking signup link; normally FALSE
* @return TRUE if valid password
* otherwise FALSE
*/
protected function checkUserPassword($username, $userpass, $response, $forceLogin)
{
$pref = e107::getPref();
if ($forceLogin === 'provider') {
return true;
}
if ($this->lookEmail && vartrue($pref['passwordEncoding'])) {
$tmp = e107::getArrayStorage()->unserialize($this->userData['user_prefs']);
if (!$tmp && $this->userData['user_prefs']) {
$tmp = unserialize($this->userData['user_prefs']);
}
// try old storage type
$requiredPassword = varset($tmp['email_password'], $this->userData['user_password']);
// Use email-specific password if set. Otherwise, 'normal' one might work
unset($tmp);
} else {
$requiredPassword = $this->userData['user_password'];
}
// FIXME - [SecretR] $username is not set and I really can't get the idea.
//$username = $this->userData['user_loginname']; // TODO for Steve - temporary fix, where $username comes from?
// Now check password
if ($forceLogin) {
if (md5($this->userData['user_name'] . $this->userData['user_password'] . $this->userData['user_join']) != $userpass) {
return $this->invalidLogin($username, LOGIN_BAD_PW);
}
} else {
$session = e107::getSession();
$gotChallenge = $session->is('challenge');
//$aLogVal = "U: {$username}, P: ******, C: ".$session->get('challenge')." R:{$response} S: {$this->userData['user_password']} Prf: {$pref['password_CHAP']}/{$gotChallenge}";
if ($pref['password_CHAP'] > 0 && ($response && $gotChallenge) && $response != $session->get('challenge') || $pref['password_CHAP'] == 2) {
// Verify using CHAP
//$this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","CHAP login",$aLogVal, FALSE, LOG_TO_ROLLING);
if (($pass_result = $this->userMethods->CheckCHAP($session->get('challenge'), $response, $username, $requiredPassword)) === PASSWORD_INVALID) {
return $this->invalidLogin($username, LOGIN_CHAP_FAIL);
}
} else {
// Plaintext password
//$this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Plaintext login",$aLogVal, FALSE,LOG_TO_ROLLING);
if (($pass_result = $this->userMethods->CheckPassword($userpass, $this->lookEmail ? $this->userData['user_loginname'] : $username, $requiredPassword)) === PASSWORD_INVALID) {
return $this->invalidLogin($username, LOGIN_BAD_PW);
}
}
$this->passResult = $pass_result;
}
return TRUE;
}
示例7: authcheck
/**
* Admin auth check
* @param string $authname, entered name
* @param string $authpass, entered pass
* @param object $authresponse [optional]
* @return boolean if fail, else result array
*/
public function authcheck($authname, $authpass, $authresponse = '')
{
$pref = e107::getPref();
$tp = e107::getParser();
$sql_auth = e107::getDb('sql_auth');
$user_info = e107::getUserSession();
$reason = '';
$authname = $tp->toDB(preg_replace("/\\sOR\\s|\\=|\\#/", "", trim($authname)));
$authpass = trim($authpass);
if ($authpass == '' && $authresponse == '' || $authname == '') {
$reason = 'np';
}
if (strlen($authname) > varset($pref['loginname_maxlength'], 30)) {
$reason = 'lu';
}
if (!$reason) {
if ($sql_auth->db_Select("user", "*", "user_loginname='{$authname}' AND user_admin='1' ")) {
$row = $sql_auth->db_Fetch();
} elseif ($sql_auth->db_Select("user", "*", "user_name='{$authname}' AND user_admin='1' ")) {
$row = $sql_auth->db_Fetch();
$authname = $row['user_loginname'];
} else {
$reason = 'iu';
}
}
if (!$reason && $row['user_id']) {
$session = e107::getSession();
if ($authresponse && $session->is('prevchallenge') && $authresponse != $session->get('prevchallenge')) {
// Verify using CHAP (can't handle login by email address - only loginname - although with this code it does still work if the password is stored unsalted)
/*
$title = 'Login via admin';
$extra_text = 'C: '.$session->get('challenge').' PC: '.$session->get('prevchallenge').' PPC: '.$session->get('prevprevchallenge').' R:'.$authresponse.' P:'.$row['user_password'];
$text = 'CHAP: '.$username.' ('.$extra_text.')';
$title = e107::getParser()->toDB($title);
$text = e107::getParser()->toDB($text);
e107::getAdminLog()->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
$logfp = fopen(e_LOG.'authlog.txt', 'a+'); fwrite($logfp, $title.': '.$text."\n"); fclose($logfp);
*/
if (($pass_result = $user_info->CheckCHAP($session->get('prevchallenge'), $authresponse, $authname, $row['user_password'])) !== PASSWORD_INVALID) {
return $row;
}
} else {
// Plaintext password
/*
$title = 'Login via admin';
$extra_text = 'C: '.$session->get('challenge').' PC: '.$session->get('prevchallenge').' PPC: '.$session->get('prevprevchallenge').' R:'.$authresponse.' P:'.$row['user_password'];
$text = 'STD: '.$username.' ('.$extra_text.')';
$title = e107::getParser()->toDB($title);
$text = e107::getParser()->toDB($text);
e107::getAdminLog()->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
// $logfp = fopen(e_LOG.'authlog.txt', 'a+'); fwrite($logfp, $title.': '.$text."\n"); fclose($logfp);
*/
if (($pass_result = $user_info->CheckPassword($authpass, $authname, $row['user_password'])) !== PASSWORD_INVALID) {
return $row;
}
}
}
return array("authfail", "reason" => $reason);
}
示例8: varset
$id = varset($tmp[2]);
unset($tmp);
} elseif (!getperms('0')) {
$action = 'tools';
}
if (isset($_POST['submit_prefs']) && isset($_POST['mainsitelanguage']) && getperms('0')) {
unset($temp);
$changes = array();
$temp['multilanguage'] = $_POST['multilanguage'];
$temp['multilanguage_subdomain'] = $_POST['multilanguage_subdomain'];
$temp['multilanguage_domain'] = $_POST['multilanguage_domain'];
$temp['sitelanguage'] = $_POST['mainsitelanguage'];
$temp['adminlanguage'] = $_POST['mainadminlanguage'];
$temp['noLanguageSubs'] = $_POST['noLanguageSubs'];
e107::getConfig()->setPref($temp)->save(true);
e107::getSession()->clear('e_language');
}
// ----------------- delete tables ---------------------------------------------
if (isset($_POST['del_existing']) && $_POST['lang_choices'] && getperms('0')) {
$lang = strtolower($_POST['lang_choices']);
foreach ($tabs as $del_table) {
if ($sql->db_Table_exists($lang . "_" . $del_table, TRUE)) {
// echo $del_table." exists<br />";
$qry = "DROP TABLE " . $mySQLprefix . "lan_" . $lang . "_" . $del_table;
if (mysql_query($qry)) {
$msg = $tp->lanVars(LANG_LAN_100, $_POST['lang_choices'] . ' ' . $del_table);
$message .= $msg . '[!br!]';
$mes->addSuccess($msg);
} else {
$msg = $tp->lanVars(LANG_LAN_101, $_POST['lang_choices'] . ' ' . $del_table);
$message .= $msg . '[!br!]';
示例9: getSessionHandler
/**
* Get session handler
* @return eMessage
*/
public function getSessionHandler()
{
if (null === $this->_session_handler) {
$session = e107::getSession();
if (!$session->has($this->_session_id)) {
$session->set($this->_session_id, array());
}
$this->_session_handler = $session;
}
return $this->_session_handler;
}
示例10: unset
}
// v2 Custom language File Path.
$customLan2 = e_SYSTEM . '/lans/' . e_LANGUAGE . '_custom.php';
if (is_readable($customLan2)) {
include $customLan2;
}
unset($customLan, $customLan2);
$sql->db_Mark_Time('Start: Global Language Files');
if (isset($pref['lan_global_list'])) {
foreach ($pref['lan_global_list'] as $path) {
e107::plugLan($path, 'global', true);
}
}
$sql->db_Mark_Time('Start: CHAP challenge');
$die = e_AJAX_REQUEST == true ? false : true;
e107::getSession()->challenge()->check($die);
// Token protection
unset($die);
//
// N: misc setups: online user tracking, cache
//
$sql->db_Mark_Time('Start: Misc resources. Online user tracking, cache');
/**
* @deprecated BC, call the method only when needed, $e107->ecache caught by __get()
*/
$e107cache = e107::getCache();
//TODO - find & replace $e107cache, $e107->ecache
//DEPRECATED, BC, call the method only when needed, $e107->override caught by __get()
$override = e107::getSingleton('override', true);
//TODO - find & replace $override, $e107->override
//DEPRECATED, BC, call the method only when needed, $e107->user_class caught by __get()
示例11: ajaxQuickReply
/**
* Handle the Ajax quick-reply.
*/
function ajaxQuickReply()
{
$tp = e107::getParser();
if (!isset($_POST['e_token'])) {
$_POST['e_token'] = '';
}
if (!e107::getSession()->check(false) || !$this->checkPerm($_POST['post'], 'post')) {
//$ret['status'] = 'ok';
// $ret['msg'] = "Token Error";
// echo json_encode($ret);
exit;
}
if (varset($_POST['action']) == 'quickreply' && vartrue($_POST['text'])) {
$postInfo = array();
$postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE);
if (USER) {
$postInfo['post_user'] = USERID;
} else {
$postInfo['post_user_anon'] = $_POST['anonname'];
}
$postInfo['post_entry'] = $_POST['text'];
$postInfo['post_forum'] = intval($_POST['post']);
$postInfo['post_datestamp'] = time();
$postInfo['post_thread'] = intval($_POST['thread']);
$postInfo['post_id'] = $this->postAdd($postInfo);
// save it.
$postInfo['user_name'] = USERNAME;
$postInfo['user_email'] = USEREMAIL;
$postInfo['user_image'] = USERIMAGE;
$postInfo['user_signature'] = USERSIGNATURE;
if ($_POST['insert'] == 1) {
$tmpl = e107::getTemplate('forum', 'forum_viewtopic', 'replies');
$sc = e107::getScBatch('view', 'forum');
$sc->setScVar('postInfo', $postInfo);
$ret['html'] = $tp->parseTemplate($tmpl, true, $sc) . "\n";
} else {
$ret['html'] = false;
}
$ret['status'] = 'ok';
$ret['msg'] = "Your post has been added";
//echo $ret;
echo json_encode($ret);
}
e107::getSession()->reset();
exit;
}
示例12: cookie
$core_pref->update($key, $newValue);
/*if($newValue != $core_pref->get($key))
{ // Changed value
$core_pref->set($key, $newValue);
$prefChanges[$key] = $newValue;
}*/
}
$core_pref->save(false);
// special case, do session cleanup, logout, redirect to login screen
if ($sessionRegenerate) {
// reset cookie
cookie($core_pref->get('cookie_name'), $_COOKIE[e_COOKIE], time() + 3600 * 24 * 30, e_HTTP, e107::getLanguage()->getCookieDomain());
cookie(e_COOKIE, null, null);
// regenerate session
$s = $_SESSION;
e107::getSession()->destroy();
$session = new e_core_session(array('name' => $core_pref->get('cookie_name')));
$_SESSION = $s;
}
}
if (e107::isInstalled('alt_auth')) {
$authlist[] = "e107";
$handle = opendir(e_PLUGIN . "alt_auth");
while ($file = readdir($handle)) {
if (preg_match("/^(.*)_auth\\.php/", $file, $match)) {
$authlist[] = $match[1];
}
}
}
function sendTest()
{
示例13: redirect
/**
* Redirect to the given URI
*
* @param string $url
* @param boolean $replace - default TRUE
* @param integer|null $http_response_code - default NULL
* @return void
*/
public function redirect($url, $replace = TRUE, $http_response_code = NULL)
{
if (session_id()) {
e107::getSession()->end();
}
if (null === $http_response_code) {
header('Location: ' . $url, $replace);
} else {
header('Location: ' . $url, $replace, $http_response_code);
}
// Safari endless loop fix.
header('Content-Length: 0');
// write session if needed
//if(session_id()) session_write_close();
exit;
}
示例14: go
/**
* Redirect to the given URI
*
* @param string $url or error code number. eg. 404 = Not Found. If left empty SITEURL will be used.
* @param boolean $replace - default TRUE
* @param integer|null $http_response_code - default NULL
* @param boolean $preventCache
* @return void
*/
public function go($url = '', $replace = TRUE, $http_response_code = NULL, $preventCache = true)
{
$url = str_replace("&", "&", $url);
// cleanup when using e_QUERY in $url;
if (empty($url)) {
$url = SITEURL;
}
if ($url == 'admin') {
$url = SITEURLBASE . e_ADMIN_ABS;
}
if (defset('e_DEBUG') === 'redirect') {
$error = debug_backtrace();
e107::getLog()->addDebug("URL: " . $url . "\nFile: " . $error[1]['file'] . "\nLine: " . $error[1]['line'] . "\nClass: " . $error[1]['class'] . "\nFunction: " . $error[1]['function'] . "\n\n");
e107::getLog()->toFile('redirect.log', true);
echo "debug active";
return;
}
if (session_id()) {
e107::getSession()->end();
}
if ($preventCache) {
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0', true);
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT', true);
}
if (null === $http_response_code) {
header('Location: ' . $url, $replace);
} else {
header('Location: ' . $url, $replace, $http_response_code);
}
// Safari endless loop fix.
header('Content-Length: 0');
// write session if needed
//if(session_id()) session_write_close();
exit;
}
示例15: setDefs
/**
* Set Language-specific Constants
* FIXME - language detection is a mess - db handler, mysql handler, session handler and language handler + constants invlolved,
* SIMPLIFY, test, get feedback
* @param string $language
* @return
*/
function setDefs()
{
global $pref;
$language = $this->e_language;
//$session = e107::getSession();
// SecretR - don't register lanlist in session, confusions, save it as class property (lan class is singleton)
e107::getSession()->set('language-list', null);
// cleanup test installs, will be removed soon
/*if(!$session->is('language-list'))
{
$session->set('language-list', implode(',',$this->installed()));
}*/
//define('e_LANLIST', $session->get('language-list'));
define('e_LANLIST', implode(',', $this->installed()));
define('e_LANGUAGE', $language);
define('USERLAN', $language);
// Keep USERLAN for backward compatibility
$iso = $this->convert($language);
define("e_LAN", $iso);
// Below is for BC
if (defined('e_LANCODE') && varset($pref['multilanguage']) && $language != $pref['sitelanguage']) {
define("e_LANQRY", "[" . $iso . "]");
} else {
define("e_LANCODE", '');
define("e_LANQRY", FALSE);
}
}