bug fixing minor improvements

This commit is contained in:
exodus4d
2015-07-31 15:54:10 +02:00
parent 9826be3275
commit 65cbc9440f
377 changed files with 6077 additions and 3136 deletions

View File

@@ -10,7 +10,13 @@
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or later.
Please see the LICENSE file for more information.
Fat-Free Framework is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with Fat-Free Framework. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -137,8 +143,9 @@ class Session extends Mapper {
* @param $db object
* @param $table string
* @param $force bool
* @param $onsuspect callback
**/
function __construct(\DB\SQL $db,$table='sessions',$force=TRUE) {
function __construct(\DB\SQL $db,$table='sessions',$force=TRUE,$onsuspect=NULL) {
if ($force) {
$eol="\n";
$tab="\t";
@@ -178,8 +185,12 @@ class Session extends Mapper {
($agent=$this->agent()) &&
(!isset($headers['User-Agent']) ||
$agent!=$headers['User-Agent'])) {
session_destroy();
$fw->error(403);
if (isset($onsuspect))
$fw->call($onsuspect,array($this));
else {
session_destroy();
$fw->error(403);
}
}
$csrf=$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
$fw->hash(mt_rand());