user option method (get) start

git-svn-id: file:///svn/phpbb/trunk@4446 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-08-27 22:25:43 +00:00
parent c45905852b
commit 323f495fb8

View file

@ -1,23 +1,15 @@
<?php <?php
/*************************************************************************** // -------------------------------------------------------------
* session.php //
* ------------------- // $Id$
* begin : Saturday, Feb 13, 2001 //
* copyright : © 2002 The phpBB Group // FILENAME : session.php
* email : support@phpbb.com // STARTED : Sat Dec 16, 2000
* // COPYRIGHT : © 2001, 2003 phpBB Group
* $Id$ // WWW : http://www.phpbb.com/
* // LICENCE : GPL vs2.0 [ see /docs/COPYING ]
***************************************************************************/ //
// -------------------------------------------------------------
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
class session class session
{ {
@ -85,7 +77,6 @@ class session
} }
// session_id exists so go ahead and attempt to grab all data in preparation // session_id exists so go ahead and attempt to grab all data in preparation
// Added session check
if (!empty($this->session_id) && (!defined('NEED_SID') || $this->session_id == $_GET['sid'])) if (!empty($this->session_id) && (!defined('NEED_SID') || $this->session_id == $_GET['sid']))
{ {
$sql = 'SELECT u.*, s.* $sql = 'SELECT u.*, s.*
@ -398,7 +389,8 @@ class user extends session
var $lang_path; var $lang_path;
var $img_lang; var $img_lang;
var $keyoptions = array('viewimg', 'notify', 'notify_pm', 'popup_pm', 'viewflash', 'viewsmilies', 'viewsigs', 'viewavatars', 'viewcensors', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmile', 'allowavatar', 'allow_pm', 'allow_email', 'allow_viewonline', 'allow_viewemail', 'allow_massemail'); var $keyoptions = array('viewimg' => 0, 'notify' => 1, 'notify_pm' => 2, 'popup_pm' => 3, 'viewflash' => 4, 'viewsmilies' => 5, 'viewsigs' => 6, 'viewavatars' => 7, 'viewcensors' => 8, 'attachsig' => 9, 'allowhtml' => 10, 'allowbbcode' => 11, 'allowsmile' => 12, 'allowavatar' => 13, 'allow_pm' => 14, 'allow_email' => 15, 'allow_viewonline' => 16, 'allow_viewemail' => 16, 'allow_massemail' => 17);
var $keyvalues = array();
function setup($lang_set = false, $style = false) function setup($lang_set = false, $style = false)
{ {
@ -543,42 +535,18 @@ class user extends session
} }
// Start code for checking/setting option bit field for user table (if we go that way) // Start code for checking/setting option bit field for user table (if we go that way)
// TODO function keyget($key)
// array_search begone
// set values, blah, everything else
function option_set($key, $value = false)
{ {
if (is_array($key)) if (!isset($this->keyvalues[$key]))
{ {
if (is_array($value)) $this->keyvalues[$key] = ($user->data['user_options'] & pow(2, $this->keyoptions[$key])) ? true : false;
{
$return = array();
foreach ($key as $k)
{
$return[$key] = ($user->data['user_options'] & pow(2, array_search($key, $this->keyoptions))) ? true : false;
} }
return $return; return $this->keyvalues[$key];
} }
else
function keyset($key, $value)
{ {
$return = array(); return $this->keyvalues[$key];
foreach ($key as $k)
{
$return[$key] = ($user->data['user_options'] & pow(2, array_search($key, $this->keyoptions))) ? true : false;
}
return $return;
}
}
else
{
if ($value !== false)
{
}
else
{
return ($user->data['user_options'] & pow(2, array_search($key, $this->keyoptions))) ? true : false;
}
}
} }
} }