mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Valid login event added. Session conflict fix. Session test added. Featurebox tree() fix.
This commit is contained in:
@@ -224,6 +224,8 @@ class userlogin
|
||||
$userpass = ''; // Finished with any plaintext password - can get rid of it
|
||||
|
||||
|
||||
|
||||
|
||||
$ret = $e_event->trigger("preuserlogin", $username);
|
||||
if ($ret != '')
|
||||
{
|
||||
@@ -247,8 +249,14 @@ class userlogin
|
||||
}
|
||||
|
||||
|
||||
|
||||
// User login definitely accepted here
|
||||
|
||||
if($ret = $e_event->trigger("user_validlogin", $user_id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$cookieval = $this->userMethods->makeUserCookie($this->userData,$autologin);
|
||||
|
||||
|
||||
@@ -649,7 +657,7 @@ class userlogin
|
||||
$time = time();
|
||||
$description = e107::getParser()->lanVars(LAN_LOGIN_18,$failLimit);
|
||||
e107::getIPHandler()->add_ban(4, $description, $this->userIP, 1);
|
||||
e107::getDb()->insert("generic", "0, 'auto_banned', '".$time."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".e107::getParser()->toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' ");
|
||||
e107::getDb()->insert("generic", "0, 'auto_banned', '".$time."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".e107::getParser()->toDB($username).", ".LAN_LOGIN_17);
|
||||
e107::getEvent()->trigger('user_ban_failed_login', array('time'=>$time, 'ip'=>$this->userIP, 'other'=>$extra_text));
|
||||
}
|
||||
}
|
||||
|
@@ -118,7 +118,7 @@ class e_session
|
||||
|
||||
protected $_namespace;
|
||||
protected $_name;
|
||||
protected $_sessionStarted = false; // Fixes lost $_SESSION value problem.
|
||||
protected static $_sessionStarted = false; // Fixes lost $_SESSION value problem.
|
||||
|
||||
/**
|
||||
* Validation options
|
||||
@@ -477,7 +477,7 @@ class e_session
|
||||
public function start($sessionName = null)
|
||||
{
|
||||
|
||||
if (isset($_SESSION) && ($this->_sessionStarted == true))
|
||||
if (isset($_SESSION) && (self::$_sessionStarted === true))
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
@@ -544,7 +544,7 @@ class e_session
|
||||
|
||||
|
||||
session_start();
|
||||
$this->_sessionStarted = true;
|
||||
self::$_sessionStarted = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ class e_session
|
||||
if (!empty($name) && preg_match('#^[0-9a-z_]+$#i', $name))
|
||||
{
|
||||
$this->_name = $name;
|
||||
return session_name($name);
|
||||
// return session_name($name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -156,7 +156,7 @@ class plugin_featurebox_category extends e_model
|
||||
'random' => $this->getParam('random', $this->get('fb_category_random')),
|
||||
'ids' => $this->getParam('ids', '')
|
||||
);
|
||||
$this->_tree->load($this->getId(), $options, $force);
|
||||
$this->_tree->load($this->getId(), $force, $options);
|
||||
}
|
||||
|
||||
return $this->_tree;
|
||||
|
@@ -319,13 +319,33 @@ class e107Test extends \Codeception\Test\Unit
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Test sessions and namespaced sessions.
|
||||
* Make sure data is kept separate.
|
||||
*/
|
||||
public function testGetSession()
|
||||
{
|
||||
$res = null;
|
||||
$this->assertTrue($res);
|
||||
|
||||
$e107 = $this->e107;
|
||||
|
||||
// Simple session set/get
|
||||
$sess = $e107::getSession();
|
||||
$input = 'test-key-result';
|
||||
$sess->set('test-key', $input);
|
||||
$this->assertSame($input, $sess->get('test-key'));
|
||||
|
||||
// Create Session 2 with namespace. Make sure Session 1 key is not present.
|
||||
$sess2 = $e107::getSession('other');
|
||||
$this->assertEmpty($sess2->get('test-key'));
|
||||
|
||||
// Make sure Session 2 key is set and not present in Session 1.
|
||||
$sess2->set('other-key', true);
|
||||
$this->assertEmpty($sess->get('other-key'));
|
||||
$this->assertTrue($sess2->get('other-key'));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testGetRedirect()
|
||||
{
|
||||
$res = null;
|
||||
@@ -709,6 +729,7 @@ class e107Test extends \Codeception\Test\Unit
|
||||
*/
|
||||
public function testGetCoreTemplate()
|
||||
{
|
||||
|
||||
$templates = scandir(e_CORE . "templates");
|
||||
$e107 = $this->e107;
|
||||
|
||||
@@ -892,6 +913,7 @@ class e107Test extends \Codeception\Test\Unit
|
||||
|
||||
private function generateRows($var, $plugin)
|
||||
{
|
||||
|
||||
preg_match_all('#\{([a-z_]*)\}#', $var['sef'], $matches);
|
||||
|
||||
|
||||
@@ -918,6 +940,7 @@ class e107Test extends \Codeception\Test\Unit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*else
|
||||
{
|
||||
echo "\n".$plugin.' had no matches for: '.varset($var['sef'])."\n";
|
||||
@@ -929,6 +952,7 @@ class e107Test extends \Codeception\Test\Unit
|
||||
|
||||
private function generateExpected($string, $rows)
|
||||
{
|
||||
|
||||
$search = array('&');;
|
||||
$replace = array('&');
|
||||
|
||||
@@ -1004,22 +1028,22 @@ class e107Test extends \Codeception\Test\Unit
|
||||
/**
|
||||
* /*
|
||||
* e107::getUrl()->create('page/book/index', $row,'allow=chapter_id,chapter_sef,book_sef') ;
|
||||
e107::getUrl()->create('user/profile/view', $this->news_item)
|
||||
e107::getUrl()->create('user/profile/view', array('name' => $this->var['user_name'], 'id' => $this->var['user_id']));
|
||||
e107::getUrl()->create('page/chapter/index', $row,'allow=chapter_id,chapter_sef,book_sef') ;
|
||||
e107::getUrl()->create('user/myprofile/edit');
|
||||
e107::getUrl()->create('gallery/index/list', $this->var);
|
||||
e107::getUrl()->create('news/view/item', $row, array('full' => 1));
|
||||
e107::getUrl()->create('news/list/all'),
|
||||
e107::getUrl()->create('page/view/index',$row),
|
||||
e107::getUrl()->create('page/chapter/index', $sef),
|
||||
($sef = $row;
|
||||
$sef['chapter_sef'] = $this->getSef($row['chapter_id']);
|
||||
$sef['book_sef'] = $this->getSef($row['chapter_parent']);)
|
||||
|
||||
e107::getUrl()->create('news/list/tag', array('tag' => $word));
|
||||
$LINKTOFORUM = e107::getUrl()->create('forum/forum/view', array('id' => $row['thread_forum_id'])); //$e107->url->getUrl('forum', 'forum', "func=view&id={$row['thread_forum_id']}");
|
||||
e107::getUrl()->create('search');
|
||||
* e107::getUrl()->create('user/profile/view', $this->news_item)
|
||||
* e107::getUrl()->create('user/profile/view', array('name' => $this->var['user_name'], 'id' => $this->var['user_id']));
|
||||
* e107::getUrl()->create('page/chapter/index', $row,'allow=chapter_id,chapter_sef,book_sef') ;
|
||||
* e107::getUrl()->create('user/myprofile/edit');
|
||||
* e107::getUrl()->create('gallery/index/list', $this->var);
|
||||
* e107::getUrl()->create('news/view/item', $row, array('full' => 1));
|
||||
* e107::getUrl()->create('news/list/all'),
|
||||
* e107::getUrl()->create('page/view/index',$row),
|
||||
* e107::getUrl()->create('page/chapter/index', $sef),
|
||||
* ($sef = $row;
|
||||
* $sef['chapter_sef'] = $this->getSef($row['chapter_id']);
|
||||
* $sef['book_sef'] = $this->getSef($row['chapter_parent']);)
|
||||
*
|
||||
* e107::getUrl()->create('news/list/tag', array('tag' => $word));
|
||||
* $LINKTOFORUM = e107::getUrl()->create('forum/forum/view', array('id' => $row['thread_forum_id'])); //$e107->url->getUrl('forum', 'forum', "func=view&id={$row['thread_forum_id']}");
|
||||
* e107::getUrl()->create('search');
|
||||
*/
|
||||
public function testUrlLegacy()
|
||||
{
|
||||
@@ -1097,10 +1121,6 @@ e107::getUrl()->create('search');
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// todo add more.
|
||||
);
|
||||
|
||||
@@ -1130,28 +1150,19 @@ e107::getUrl()->create('search');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->setUrlConfig($oldConfig); // return config to previous state.
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save the url_config preference
|
||||
* @param array $newConfig
|
||||
*/
|
||||
private function setUrlConfig($newConfig = array())
|
||||
{
|
||||
|
||||
if(empty($newConfig))
|
||||
{
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user