- fixed custom profile field get/store

- changed tz lang array to hold more descriptive timezones (no more tz+-13, dst is a seperate option)
- fixed bugs after jabber queue processing (data being escaped differently)


git-svn-id: file:///svn/phpbb/trunk@5116 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2005-04-10 11:21:01 +00:00
parent a01705c7d0
commit c947835317
10 changed files with 280 additions and 380 deletions

View file

@ -194,6 +194,7 @@ $display_vars = array(
'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'type' => 'custom', 'options' => 'password_length(\'{VALUE}\')', 'explain' => true), 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'type' => 'custom', 'options' => 'password_length(\'{VALUE}\')', 'explain' => true),
'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'type' => 'select', 'options' => 'select_password_chars(\'{VALUE}\')', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'type' => 'select', 'options' => 'select_password_chars(\'{VALUE}\')', 'explain' => true),
'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'type' => 'text:3:3', 'explain' => true), 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'type' => 'text:3:3', 'explain' => true),
'max_login_attempts'=> array('lang' => 'LOGIN_LIMIT', 'type' => 'text:4:4', 'explain' => true),
'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'type' => 'radio:yes_no', 'explain' => true), 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'type' => 'radio:yes_no', 'explain' => true),
'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true), 'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true),
'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'type' => 'radio:yes_no', 'explain' => true), 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'type' => 'radio:yes_no', 'explain' => true),

View file

@ -31,7 +31,7 @@ class acm
global $phpEx; global $phpEx;
if (file_exists($this->cache_dir . 'data_global.' . $phpEx)) if (file_exists($this->cache_dir . 'data_global.' . $phpEx))
{ {
@include($this->cache_dir . 'data_global.' . $phpEx); include($this->cache_dir . 'data_global.' . $phpEx);
} }
else else
{ {

View file

@ -96,6 +96,7 @@ function set_config($config_name, $config_value, $is_dynamic = false)
if (!$is_dynamic) if (!$is_dynamic)
{ {
$cache->destroy('config'); $cache->destroy('config');
$cache->save();
} }
} }
@ -380,6 +381,18 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
if ($row['left_id'] < $right)
{
$padding++;
$padding_store[$row['parent_id']] = $padding;
}
else if ($row['left_id'] > $right + 1)
{
$padding = $padding_store[$row['parent_id']];
}
$right = $row['right_id'];
if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
{ {
// Non-postable forum with no subforums, don't display // Non-postable forum with no subforums, don't display
@ -409,18 +422,6 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
$display_jumpbox = true; $display_jumpbox = true;
} }
if ($row['left_id'] < $right)
{
$padding++;
$padding_store[$row['parent_id']] = $padding;
}
else if ($row['left_id'] > $right + 1)
{
$padding = $padding_store[$row['parent_id']];
}
$right = $row['right_id'];
$template->assign_block_vars('jumpbox_forums', array( $template->assign_block_vars('jumpbox_forums', array(
'FORUM_ID' => $row['forum_id'], 'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'], 'FORUM_NAME' => $row['forum_name'],
@ -1360,6 +1361,7 @@ function login_forum_box(&$forum_data)
} }
while ($row = $db->sql_fetchrow($result)); while ($row = $db->sql_fetchrow($result));
// Remove expired sessions
$sql = 'DELETE FROM ' . FORUMS_ACCESS_TABLE . ' $sql = 'DELETE FROM ' . FORUMS_ACCESS_TABLE . '
WHERE session_id NOT IN (' . implode(', ', $sql_in) . ')'; WHERE session_id NOT IN (' . implode(', ', $sql_in) . ')';
$db->sql_query($sql); $db->sql_query($sql);
@ -1887,7 +1889,7 @@ function page_header($page_title = '')
'S_CONTENT_ENCODING' => $user->lang['ENCODING'], 'S_CONTENT_ENCODING' => $user->lang['ENCODING'],
'S_CONTENT_DIR_LEFT' => $user->lang['LEFT'], 'S_CONTENT_DIR_LEFT' => $user->lang['LEFT'],
'S_CONTENT_DIR_RIGHT' => $user->lang['RIGHT'], 'S_CONTENT_DIR_RIGHT' => $user->lang['RIGHT'],
'S_TIMEZONE' => ($user->data['user_dst'] || ($user->data['user_id'] == ANONYMOUS && $config['board_dst'])) ? sprintf($user->lang['ALL_TIMES'], $user->lang['tz'][$tz], $user->lang['tz']['dst']) : sprintf($user->lang['ALL_TIMES'], $user->lang['tz'][$tz], ''), 'S_TIMEZONE' => ($user->data['user_dst'] || ($user->data['user_id'] == ANONYMOUS && $config['board_dst'])) ? sprintf($user->lang['ALL_TIMES'], (($tz >= 0) ? '+' . $tz : $tz), $user->lang['tz']['dst']) : sprintf($user->lang['ALL_TIMES'], (($tz >= 0) ? '+' . $tz : $tz), ''),
'S_DISPLAY_ONLINE_LIST' => (!empty($config['load_online'])) ? 1 : 0, 'S_DISPLAY_ONLINE_LIST' => (!empty($config['load_online'])) ? 1 : 0,
'S_DISPLAY_SEARCH' => (!empty($config['load_search'])) ? 1 : 0, 'S_DISPLAY_SEARCH' => (!empty($config['load_search'])) ? 1 : 0,
'S_DISPLAY_PM' => (!empty($config['allow_privmsg'])) ? 1 : 0, 'S_DISPLAY_PM' => (!empty($config['allow_privmsg'])) ? 1 : 0,

View file

@ -25,7 +25,7 @@
* Removed functions/support not critical to integration with phpBB * Removed functions/support not critical to integration with phpBB
* *
*/ */
class Jabber class jabber
{ {
var $server; var $server;
var $port; var $port;
@ -57,26 +57,24 @@ class Jabber
var $returned_keep_alive; var $returned_keep_alive;
var $txnid; var $txnid;
var $CONNECTOR; var $connector;
function Jabber() function jabber()
{ {
$this->port = "5222"; $this->port = '5222';
$this->resource = NULL; $this->resource = NULL;
$this->packet_queue = $this->subscription_queue = array(); $this->packet_queue = $this->subscription_queue = array();
$this->iq_sleep_timer = $this->delay_disconnect = 1; $this->iq_sleep_timer = $this->delay_disconnect = 1;
$this->returned_keep_alive = TRUE; $this->returned_keep_alive = true;
$this->txnid = 0; $this->txnid = 0;
$this->iq_version_name = "Class.Jabber.PHP -- http://phpjabber.g-blog.net -- by Carlo 'Gossip' Zottmann, gossip@jabber.g-blog.net"; $this->iq_version_name = "Class.Jabber.PHP -- http://phpjabber.g-blog.net -- by Carlo 'Gossip' Zottmann, gossip@jabber.g-blog.net";
$this->iq_version_version = '0.4'; $this->iq_version_version = '0.4';
$this->iq_version_os = $_SERVER['SERVER_SOFTWARE']; $this->iq_version_os = $_SERVER['SERVER_SOFTWARE'];
$this->error_codes = array(400 => 'Bad Request', $this->error_codes = array(
400 => 'Bad Request',
401 => 'Unauthorized', 401 => 'Unauthorized',
402 => 'Payment Required', 402 => 'Payment Required',
403 => 'Forbidden', 403 => 'Forbidden',
@ -91,66 +89,67 @@ class Jabber
502 => 'Remove Server Error', 502 => 'Remove Server Error',
503 => 'Service Unavailable', 503 => 'Service Unavailable',
504 => 'Remove Server Timeout', 504 => 'Remove Server Timeout',
510 => 'Disconnected'); 510 => 'Disconnected'
);
} }
function Connect() function connect()
{ {
$this->CONNECTOR = new CJP_StandardConnector; $this->connector = new cjp_standard_connector;
if ($this->CONNECTOR->OpenSocket($this->server, $this->port)) if ($this->connector->open_socket($this->server, $this->port))
{ {
$this->SendPacket("<?xml version='1.0' encoding='UTF-8' ?" . ">\n"); $this->send_packet("<?xml version='1.0' encoding='UTF-8' ?" . ">\n");
$this->SendPacket("<stream:stream to='{$this->server}' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>\n"); $this->send_packet("<stream:stream to='{$this->server}' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>\n");
sleep(2); sleep(2);
if ($this->_check_connected()) if ($this->_check_connected())
{ {
$this->connected = TRUE; // Nathan Fritz $this->connected = true; // Nathan Fritz
return TRUE; return true;
} }
else else
{ {
return FALSE; return false;
} }
} }
else else
{ {
return FALSE; return false;
} }
} }
function Disconnect() function disconnect()
{ {
if (is_int($this->delay_disconnect)) if (is_int($this->delay_disconnect))
{ {
sleep($this->delay_disconnect); sleep($this->delay_disconnect);
} }
$this->SendPacket('</stream:stream>'); $this->send_packet('</stream:stream>');
$this->CONNECTOR->CloseSocket(); $this->connector->close_socket();
} }
function CruiseControl($seconds = -1) function cruise_control($seconds = -1)
{ {
$count = 0; $count = 0;
while ($count != $seconds) while ($count != $seconds)
{ {
$this->Listen(); $this->listen();
do do
{ {
$packet = $this->GetFirstFromQueue(); $packet = $this->get_first_from_queue();
if ($packet) if ($packet)
{ {
$this->CallHandler($packet); $this->call_handler($packet);
} }
} }
while (count($this->packet_queue) > 1); while (sizeof($this->packet_queue) > 1);
$count += 0.25; $count += 0.25;
usleep(250000); usleep(250000);
@ -158,38 +157,38 @@ class Jabber
if ($this->last_ping_time != date('H:i')) if ($this->last_ping_time != date('H:i'))
{ {
// Modified by Nathan Fritz // Modified by Nathan Fritz
if ($this->returned_keep_alive == FALSE) if ($this->returned_keep_alive == false)
{ {
$this->connected = FALSE; $this->connected = false;
$this->AddToLog('EVENT: Disconnected'); //EVENT: Disconnected
} }
$this->returned_keep_alive = FALSE; $this->returned_keep_alive = FALSE;
$this->keep_alive_id = 'keep_alive_' . time(); $this->keep_alive_id = 'keep_alive_' . time();
$this->SendPacket("<iq id='{$this->keep_alive_id}'/>", 'CruiseControl'); $this->send_packet("<iq id='{$this->keep_alive_id}'/>", 'cruise_control');
$this->last_ping_time = date("H:i"); $this->last_ping_time = date('H:i');
} }
} }
return TRUE; return true;
} }
function SendAuth() function send_auth()
{ {
$this->auth_id = 'auth_' . md5(time() . $_SERVER['REMOTE_ADDR']); $this->auth_id = 'auth_' . md5(time() . $_SERVER['REMOTE_ADDR']);
$this->jid = "{$this->username}@{$this->server}/{$this->resource}"; $this->jid = "{$this->username}@{$this->server}/{$this->resource}";
// request available authentication methods // request available authentication methods
$payload = "<username>{$this->username}</username>"; $payload = "<username>{$this->username}</username>";
$packet = $this->SendIq(NULL, 'get', $this->auth_id, 'jabber:iq:auth', $payload); $packet = $this->send_iq(NULL, 'get', $this->auth_id, 'jabber:iq:auth', $payload);
// was a result returned? // was a result returned?
if ($this->GetInfoFromIqType($packet) == 'result' && $this->GetInfoFromIqId($packet) == $this->auth_id) if ($this->get_info_from_iq_type($packet) == 'result' && $this->get_info_from_iq_id($packet) == $this->auth_id)
{ {
if (@function_exists('mhash') && isset($packet['iq']['#']['query'][0]['#']['sequence'][0]['#']) && isset($packet['iq']['#']['query'][0]['#']['token'][0]['#'])) if (@function_exists('mhash') && isset($packet['iq']['#']['query'][0]['#']['sequence'][0]['#']) && isset($packet['iq']['#']['query'][0]['#']['token'][0]['#']))
{ {
// auth_0k // auth_0k
return $this->_sendauth_0k($packet['iq']['#']['query'][0]['#']['token'][0]['#'], $packet['iq']['#']['query'][0]['#']['sequence'][0]['#']); return $this->_sendauth_ok($packet['iq']['#']['query'][0]['#']['token'][0]['#'], $packet['iq']['#']['query'][0]['#']['sequence'][0]['#']);
} }
elseif (@function_exists('mhash') && isset($packet['iq']['#']['query'][0]['#']['digest'])) elseif (@function_exists('mhash') && isset($packet['iq']['#']['query'][0]['#']['digest']))
{ {
@ -205,17 +204,17 @@ class Jabber
else else
{ {
// no result returned // no result returned
return FALSE; return false;
} }
} }
function AccountRegistration($reg_email = NULL, $reg_name = NULL) function account_registration($reg_email = NULL, $reg_name = NULL)
{ {
$packet = $this->SendIq($this->server, 'get', 'reg_01', 'jabber:iq:register'); $packet = $this->send_iq($this->server, 'get', 'reg_01', 'jabber:iq:register');
if ($packet) if ($packet)
{ {
$key = $this->GetInfoFromIqKey($packet); // just in case a key was passed back from the server $key = $this->get_info_from_iq_key($packet); // just in case a key was passed back from the server
unset($packet); unset($packet);
$payload = "<username>{$this->username}</username> $payload = "<username>{$this->username}</username>
@ -225,14 +224,14 @@ class Jabber
$payload .= ($key) ? "<key>$key</key>\n" : ''; $payload .= ($key) ? "<key>$key</key>\n" : '';
$packet = $this->SendIq($this->server, 'set', 'reg_01', 'jabber:iq:register', $payload); $packet = $this->send_iq($this->server, 'set', 'reg_01', 'jabber:iq:register', $payload);
if ($this->GetInfoFromIqType($packet) == 'result') if ($this->get_info_from_iq_type($packet) == 'result')
{ {
$return_code = (isset($packet['iq']['#']['query'][0]['#']['registered'][0]['#'])) ? 1 : 2; $return_code = (isset($packet['iq']['#']['query'][0]['#']['registered'][0]['#'])) ? 1 : 2;
$this->jid = ($this->resource) ? "{$this->username}@{$this->server}/{$this->resource}" : "{$this->username}@{$this->server}"; $this->jid = ($this->resource) ? "{$this->username}@{$this->server}/{$this->resource}" : "{$this->username}@{$this->server}";
} }
elseif ($this->GetInfoFromIqType($packet) == 'error' && isset($packet['iq']['#']['error'][0]['#'])) elseif ($this->get_info_from_iq_type($packet) == 'error' && isset($packet['iq']['#']['error'][0]['#']))
{ {
// "conflict" error, i.e. already registered // "conflict" error, i.e. already registered
if ($packet['iq']['#']['error'][0]['@']['code'] == '409') if ($packet['iq']['#']['error'][0]['@']['code'] == '409')
@ -253,26 +252,26 @@ class Jabber
} }
} }
function ChangePassword($new_password) function change_password($new_password)
{ {
$packet = $this->SendIq($this->server, 'get', 'A0', 'jabber:iq:register'); $packet = $this->send_iq($this->server, 'get', 'A0', 'jabber:iq:register');
if ($packet) if ($packet)
{ {
$key = $this->GetInfoFromIqKey($packet); // just in case a key was passed back from the server $key = $this->get_info_from_iq_key($packet); // just in case a key was passed back from the server
unset($packet); unset($packet);
$payload = "<username>{$this->username}</username> $payload = "<username>{$this->username}</username>
<password>{$new_password}</password>\n"; <password>{$new_password}</password>\n";
$payload .= ($key) ? "<key>$key</key>\n" : ''; $payload .= ($key) ? "<key>$key</key>\n" : '';
$packet = $this->SendIq($this->server, 'set', 'A0', 'jabber:iq:register', $payload); $packet = $this->send_iq($this->server, 'set', 'A0', 'jabber:iq:register', $payload);
if ($this->GetInfoFromIqType($packet) == 'result') if ($this->get_info_from_iq_type($packet) == 'result')
{ {
$return_code = (isset($packet['iq']['#']['query'][0]['#']['registered'][0]['#'])) ? 1 : 2; $return_code = (isset($packet['iq']['#']['query'][0]['#']['registered'][0]['#'])) ? 1 : 2;
} }
elseif ($this->GetInfoFromIqType($packet) == 'error' && isset($packet['iq']['#']['error'][0]['#'])) elseif ($this->get_info_from_iq_type($packet) == 'error' && isset($packet['iq']['#']['error'][0]['#']))
{ {
// "conflict" error, i.e. already registered // "conflict" error, i.e. already registered
if ($packet['iq']['#']['error'][0]['@']['code'] == '409') if ($packet['iq']['#']['error'][0]['@']['code'] == '409')
@ -293,19 +292,19 @@ class Jabber
} }
} }
function SendPacket($xml) function send_packet($xml)
{ {
$xml = trim($xml); $xml = trim($xml);
return ($this->CONNECTOR->WriteToSocket($xml)) ? TRUE : FALSE; return ($this->connector->write_to_socket($xml)) ? true : false;
} }
// get the transport registration fields // get the transport registration fields
// method written by Steve Blinch, http://www.blitzaffe.com // method written by Steve Blinch, http://www.blitzaffe.com
function TransportRegistrationDetails($transport) function transport_registration_details($transport)
{ {
$this->txnid++; $this->txnid++;
$packet = $this->SendIq($transport, 'get', "reg_{$this->txnid}", "jabber:iq:register", NULL, $this->jid); $packet = $this->send_iq($transport, 'get', "reg_{$this->txnid}", "jabber:iq:register", NULL, $this->jid);
if ($packet) if ($packet)
{ {
@ -329,14 +328,14 @@ class Jabber
// register with the transport // register with the transport
// method written by Steve Blinch, http://www.blitzaffe.com // method written by Steve Blinch, http://www.blitzaffe.com
function TransportRegistration($transport, $details) function transport_registration($transport, $details)
{ {
$this->txnid++; $this->txnid++;
$packet = $this->SendIq($transport, 'get', "reg_{$this->txnid}", "jabber:iq:register", NULL, $this->jid); $packet = $this->send_iq($transport, 'get', "reg_{$this->txnid}", "jabber:iq:register", NULL, $this->jid);
if ($packet) if ($packet)
{ {
$key = $this->GetInfoFromIqKey($packet); // just in case a key was passed back from the server $key = $this->get_info_from_iq_key($packet); // just in case a key was passed back from the server
unset($packet); unset($packet);
$payload = ($key) ? "<key>$key</key>\n" : ''; $payload = ($key) ? "<key>$key</key>\n" : '';
@ -345,9 +344,9 @@ class Jabber
$payload .= "<$element>$value</$element>\n"; $payload .= "<$element>$value</$element>\n";
} }
$packet = $this->SendIq($transport, 'set', "reg_{$this->txnid}", "jabber:iq:register", $payload); $packet = $this->send_iq($transport, 'set', "reg_{$this->txnid}", "jabber:iq:register", $payload);
if ($this->GetInfoFromIqType($packet) == 'result') if ($this->get_info_from_iq_type($packet) == 'result')
{ {
if (isset($packet['iq']['#']['query'][0]['#']['registered'][0]['#'])) if (isset($packet['iq']['#']['query'][0]['#']['registered'][0]['#']))
{ {
@ -358,12 +357,12 @@ class Jabber
$return_code = 2; $return_code = 2;
} }
} }
elseif ($this->GetInfoFromIqType($packet) == 'error') elseif ($this->get_info_from_iq_type($packet) == 'error')
{ {
if (isset($packet['iq']['#']['error'][0]['#'])) if (isset($packet['iq']['#']['error'][0]['#']))
{ {
$return_code = "Error " . $packet['iq']['#']['error'][0]['@']['code'] . ": " . $packet['iq']['#']['error'][0]['#']; $return_code = "Error " . $packet['iq']['#']['error'][0]['@']['code'] . ": " . $packet['iq']['#']['error'][0]['#'];
$this->AddToLog('ERROR: TransportRegistration()'); // ERROR: TransportRegistration()
} }
} }
@ -375,11 +374,11 @@ class Jabber
} }
} }
function Listen() function listen()
{ {
unset($incoming); $incoming = '';
while ($line = $this->CONNECTOR->ReadFromSocket(4096)) while ($line = $this->connector->read_from_socket(4096))
{ {
$incoming .= $line; $incoming .= $line;
} }
@ -396,16 +395,16 @@ class Jabber
} }
} }
return TRUE; return true;
} }
function StripJID($jid = NULL) function strip_jid($jid = NULL)
{ {
preg_match('#(.*)\/(.*)#Ui', $jid, $temp); preg_match('#(.*)\/(.*)#Ui', $jid, $temp);
return ($temp[1] != '') ? $temp[1] : $jid; return ($temp[1] != '') ? $temp[1] : $jid;
} }
function SendMessage($to, $type = 'normal', $id = NULL, $content = NULL, $payload = NULL) function send_message($to, $type = 'normal', $id = NULL, $content = NULL, $payload = NULL)
{ {
if ($to && is_array($content)) if ($to && is_array($content))
{ {
@ -418,12 +417,12 @@ class Jabber
$xml = "<message to='$to' type='$type' id='$id'>\n"; $xml = "<message to='$to' type='$type' id='$id'>\n";
if ($content['subject']) if (isset($content['subject']) && $content['subject'])
{ {
$xml .= '<subject>' . $content['subject'] . "</subject>\n"; $xml .= '<subject>' . $content['subject'] . "</subject>\n";
} }
if ($content['thread']) if (isset($content['thread']) && $content['thread'])
{ {
$xml .= '<thread>' . $content['thread'] . "</thread>\n"; $xml .= '<thread>' . $content['thread'] . "</thread>\n";
} }
@ -432,22 +431,22 @@ class Jabber
$xml .= $payload; $xml .= $payload;
$xml .= "</message>\n"; $xml .= "</message>\n";
if ($this->SendPacket($xml)) if ($this->send_packet($xml))
{ {
return TRUE; return true;
} }
else else
{ {
return FALSE; return false;
} }
} }
else else
{ {
return FALSE; return false;
} }
} }
function SendPresence($type = NULL, $to = NULL, $status = NULL, $show = NULL, $priority = NULL) function send_presence($type = NULL, $to = NULL, $status = NULL, $show = NULL, $priority = NULL)
{ {
$xml = '<presence'; $xml = '<presence';
$xml .= ($to) ? " to='$to'" : ''; $xml .= ($to) ? " to='$to'" : '';
@ -460,10 +459,10 @@ class Jabber
$xml .= ($status || $show || $priority) ? "</presence>\n" : ''; $xml .= ($status || $show || $priority) ? "</presence>\n" : '';
return ($this->SendPacket($xml)) ? TRUE : FALSE; return ($this->send_packet($xml)) ? true : false;
} }
function SendError($to, $id = NULL, $error_number, $error_message = NULL) function send_error($to, $id = NULL, $error_number, $error_message = NULL)
{ {
$xml = "<iq type='error' to='$to'"; $xml = "<iq type='error' to='$to'";
$xml .= ($id) ? " id='$id'" : ''; $xml .= ($id) ? " id='$id'" : '';
@ -473,17 +472,17 @@ class Jabber
$xml .= "</error>\n"; $xml .= "</error>\n";
$xml .= '</iq>'; $xml .= '</iq>';
$this->SendPacket($xml); $this->send_packet($xml);
} }
function GetFirstFromQueue() function get_first_from_queue()
{ {
return array_shift($this->packet_queue); return array_shift($this->packet_queue);
} }
function GetFromQueueById($packet_type, $id) function get_from_queue_by_id($packet_type, $id)
{ {
$found_message = FALSE; $found_message = false;
foreach ($this->packet_queue as $key => $value) foreach ($this->packet_queue as $key => $value)
{ {
@ -496,10 +495,10 @@ class Jabber
} }
} }
return (is_array($found_message)) ? $found_message : FALSE; return (is_array($found_message)) ? $found_message : false;
} }
function CallHandler($packet = NULL) function call_handler($packet = NULL)
{ {
$packet_type = $this->_get_packet_type($packet); $packet_type = $this->_get_packet_type($packet);
@ -507,19 +506,19 @@ class Jabber
{ {
$type = $packet['message']['@']['type']; $type = $packet['message']['@']['type'];
$type = ($type != '') ? $type : 'normal'; $type = ($type != '') ? $type : 'normal';
$funcmeth = "Handler_message_$type"; $funcmeth = "handler_message_$type";
} }
elseif ($packet_type == 'iq') elseif ($packet_type == 'iq')
{ {
$namespace = $packet['iq']['#']['query'][0]['@']['xmlns']; $namespace = $packet['iq']['#']['query'][0]['@']['xmlns'];
$namespace = str_replace(':', '_', $namespace); $namespace = str_replace(':', '_', $namespace);
$funcmeth = "Handler_iq_$namespace"; $funcmeth = "handler_iq_$namespace";
} }
elseif ($packet_type == 'presence') elseif ($packet_type == 'presence')
{ {
$type = $packet['presence']['@']['type']; $type = $packet['presence']['@']['type'];
$type = ($type != '') ? $type : 'available'; $type = ($type != '') ? $type : 'available';
$funcmeth = "Handler_presence_$type"; $funcmeth = "handler_presence_$type";
} }
if ($funcmeth != '') if ($funcmeth != '')
@ -534,18 +533,18 @@ class Jabber
} }
else else
{ {
$this->Handler_NOT_IMPLEMENTED($packet); $this->handler_not_implemented($packet);
} }
} }
} }
function SendIq($to = NULL, $type = 'get', $id = NULL, $xmlns = NULL, $payload = NULL, $from = NULL) function send_iq($to = NULL, $type = 'get', $id = NULL, $xmlns = NULL, $payload = NULL, $from = NULL)
{ {
if (!preg_match('#^(get|set|result|error)$#', $type)) if (!preg_match('#^(get|set|result|error)$#', $type))
{ {
unset($type); unset($type);
return FALSE; return false;
} }
else if ($id && $xmlns) else if ($id && $xmlns)
{ {
@ -558,15 +557,15 @@ class Jabber
</query> </query>
</iq>"; </iq>";
$this->SendPacket($xml); $this->send_packet($xml);
sleep($this->iq_sleep_timer); sleep($this->iq_sleep_timer);
$this->Listen(); $this->listen();
return (preg_match('#^(get|set)$#', $type)) ? $this->GetFromQueueById('iq', $id) : TRUE; return (preg_match('#^(get|set)$#', $type)) ? $this->get_from_queue_by_id('iq', $id) : true;
} }
else else
{ {
return FALSE; return false;
} }
} }
@ -575,7 +574,7 @@ class Jabber
// private methods // private methods
// ====================================================================== // ======================================================================
function _sendauth_0k($zerok_token, $zerok_sequence) function _sendauth_ok($zerok_token, $zerok_sequence)
{ {
// initial hash of password // initial hash of password
$zerok_hash = @mhash(MHASH_SHA1, $this->password); $zerok_hash = @mhash(MHASH_SHA1, $this->password);
@ -596,10 +595,10 @@ class Jabber
<hash>$zerok_hash</hash> <hash>$zerok_hash</hash>
<resource>{$this->resource}</resource>"; <resource>{$this->resource}</resource>";
$packet = $this->SendIq(NULL, 'set', $this->auth_id, 'jabber:iq:auth', $payload); $packet = $this->send_iq(NULL, 'set', $this->auth_id, 'jabber:iq:auth', $payload);
// was a result returned? // was a result returned?
return ($this->GetInfoFromIqType($packet) == 'result' && $this->GetInfoFromIqId($packet) == $this->auth_id) ? TRUE : FALSE; return ($this->get_info_from_iq_type($packet) == 'result' && $this->get_info_from_iq_id($packet) == $this->auth_id) ? true : false;
} }
function _sendauth_digest() function _sendauth_digest()
@ -608,10 +607,10 @@ class Jabber
<resource>{$this->resource}</resource> <resource>{$this->resource}</resource>
<digest>" . bin2hex(mhash(MHASH_SHA1, $this->stream_id . $this->password)) . "</digest>"; <digest>" . bin2hex(mhash(MHASH_SHA1, $this->stream_id . $this->password)) . "</digest>";
$packet = $this->SendIq(NULL, 'set', $this->auth_id, 'jabber:iq:auth', $payload); $packet = $this->send_iq(NULL, 'set', $this->auth_id, 'jabber:iq:auth', $payload);
// was a result returned? // was a result returned?
return ($this->GetInfoFromIqType($packet) == 'result' && $this->GetInfoFromIqId($packet) == $this->auth_id) ? TRUE : FALSE; return ($this->get_info_from_iq_type($packet) == 'result' && $this->get_info_from_iq_id($packet) == $this->auth_id) ? true : false;
} }
function _sendauth_plaintext() function _sendauth_plaintext()
@ -620,17 +619,17 @@ class Jabber
<password>{$this->password}</password> <password>{$this->password}</password>
<resource>{$this->resource}</resource>"; <resource>{$this->resource}</resource>";
$packet = $this->SendIq(NULL, 'set', $this->auth_id, 'jabber:iq:auth', $payload); $packet = $this->send_iq(NULL, 'set', $this->auth_id, 'jabber:iq:auth', $payload);
// was a result returned? // was a result returned?
return ($this->GetInfoFromIqType($packet) == 'result' && $this->GetInfoFromIqId($packet) == $this->auth_id) ? TRUE : FALSE; return ($this->get_info_from_iq_type($packet) == 'result' && $this->get_info_from_iq_id($packet) == $this->auth_id) ? true : false;
} }
function _listen_incoming() function _listen_incoming()
{ {
unset($incoming); $incoming = '';
while ($line = $this->CONNECTOR->ReadFromSocket(4096)) while ($line = $this->connector->read_from_socket(4096))
{ {
$incoming .= $line; $incoming .= $line;
} }
@ -651,16 +650,16 @@ class Jabber
{ {
$this->stream_id = $incoming_array['stream:stream']['@']['id']; $this->stream_id = $incoming_array['stream:stream']['@']['id'];
return TRUE; return true;
} }
else else
{ {
return FALSE; return false;
} }
} }
else else
{ {
return FALSE; return false;
} }
} }
@ -669,7 +668,7 @@ class Jabber
$temp = preg_split('#<(message|iq|presence|stream)#', $incoming, -1, PREG_SPLIT_DELIM_CAPTURE); $temp = preg_split('#<(message|iq|presence|stream)#', $incoming, -1, PREG_SPLIT_DELIM_CAPTURE);
$array = array(); $array = array();
for ($a = 1; $a < count($temp); $a = $a + 2) for ($a = 1; $a < sizeof($temp); $a = $a + 2)
{ {
$array[] = '<' . $temp[$a] . $temp[($a + 1)]; $array[] = '<' . $temp[$a] . $temp[($a + 1)];
} }
@ -685,7 +684,7 @@ class Jabber
$packet_type = key($packet); $packet_type = key($packet);
} }
return ($packet_type) ? $packet_type : FALSE; return ($packet_type) ? $packet_type : false;
} }
// _array_htmlspecialchars() // _array_htmlspecialchars()
@ -707,82 +706,82 @@ class Jabber
// <message/> parsers // <message/> parsers
// ====================================================================== // ======================================================================
function GetInfoFromMessageFrom($packet = NULL) function get_info_from_message_from($packet = NULL)
{ {
return (is_array($packet)) ? $packet['message']['@']['from'] : FALSE; return (is_array($packet)) ? $packet['message']['@']['from'] : false;
} }
function GetInfoFromMessageType($packet = NULL) function get_info_from_message_type($packet = NULL)
{ {
return (is_array($packet)) ? $packet['message']['@']['type'] : FALSE; return (is_array($packet)) ? $packet['message']['@']['type'] : false;
} }
function GetInfoFromMessageId($packet = NULL) function get_info_from_message_id($packet = NULL)
{ {
return (is_array($packet)) ? $packet['message']['@']['id'] : FALSE; return (is_array($packet)) ? $packet['message']['@']['id'] : false;
} }
function GetInfoFromMessageThread($packet = NULL) function get_info_from_message_thread($packet = NULL)
{ {
return (is_array($packet)) ? $packet['message']['#']['thread'][0]['#'] : FALSE; return (is_array($packet)) ? $packet['message']['#']['thread'][0]['#'] : false;
} }
function GetInfoFromMessageSubject($packet = NULL) function get_info_from_message_subject($packet = NULL)
{ {
return (is_array($packet)) ? $packet['message']['#']['subject'][0]['#'] : FALSE; return (is_array($packet)) ? $packet['message']['#']['subject'][0]['#'] : false;
} }
function GetInfoFromMessageBody($packet = NULL) function get_info_from_message_body($packet = NULL)
{ {
return (is_array($packet)) ? $packet['message']['#']['body'][0]['#'] : FALSE; return (is_array($packet)) ? $packet['message']['#']['body'][0]['#'] : false;
} }
function GetInfoFromMessageError($packet = NULL) function get_info_from_message_error($packet = NULL)
{ {
$error = preg_replace('#^\/$#', '', ($packet['message']['#']['error'][0]['@']['code'] . '/' . $packet['message']['#']['error'][0]['#'])); $error = preg_replace('#^\/$#', '', ($packet['message']['#']['error'][0]['@']['code'] . '/' . $packet['message']['#']['error'][0]['#']));
return (is_array($packet)) ? $error : FALSE; return (is_array($packet)) ? $error : false;
} }
// ====================================================================== // ======================================================================
// <iq/> parsers // <iq/> parsers
// ====================================================================== // ======================================================================
function GetInfoFromIqFrom($packet = NULL) function get_info_from_iq_from($packet = NULL)
{ {
return (is_array($packet)) ? $packet['iq']['@']['from'] : FALSE; return (is_array($packet)) ? $packet['iq']['@']['from'] : false;
} }
function GetInfoFromIqType($packet = NULL) function get_info_from_iq_type($packet = NULL)
{ {
return (is_array($packet)) ? $packet['iq']['@']['type'] : FALSE; return (is_array($packet)) ? $packet['iq']['@']['type'] : false;
} }
function GetInfoFromIqId($packet = NULL) function get_info_from_iq_id($packet = NULL)
{ {
return (is_array($packet)) ? $packet['iq']['@']['id'] : FALSE; return (is_array($packet)) ? $packet['iq']['@']['id'] : false;
} }
function GetInfoFromIqKey($packet = NULL) function get_info_from_iq_key($packet = NULL)
{ {
return (is_array($packet)) ? $packet['iq']['#']['query'][0]['#']['key'][0]['#'] : FALSE; return (is_array($packet)) ? $packet['iq']['#']['query'][0]['#']['key'][0]['#'] : false;
} }
function GetInfoFromIqError($packet = NULL) function get_info_from_iq_error($packet = NULL)
{ {
$error = preg_replace('#^\/$#', '', ($packet['iq']['#']['error'][0]['@']['code'] . '/' . $packet['iq']['#']['error'][0]['#'])); $error = preg_replace('#^\/$#', '', ($packet['iq']['#']['error'][0]['@']['code'] . '/' . $packet['iq']['#']['error'][0]['#']));
return (is_array($packet)) ? $error : FALSE; return (is_array($packet)) ? $error : false;
} }
// ====================================================================== // ======================================================================
// <message/> handlers // <message/> handlers
// ====================================================================== // ======================================================================
function Handler_message_normal($packet) function handler_message_normal($packet)
{ {
$from = $packet['message']['@']['from']; $from = $packet['message']['@']['from'];
} }
function Handler_message_error($packet) function handler_message_error($packet)
{ {
$from = $packet['message']['@']['from']; $from = $packet['message']['@']['from'];
} }
@ -792,29 +791,29 @@ class Jabber
// ====================================================================== // ======================================================================
// simple client authentication // simple client authentication
function Handler_iq_jabber_iq_auth($packet) function handler_iq_jabber_iq_auth($packet)
{ {
$from = $this->GetInfoFromIqFrom($packet); $from = $this->get_info_from_iq_from($packet);
$id = $this->GetInfoFromIqId($packet); $id = $this->get_info_from_iq_id($packet);
$this->SendError($from, $id, 501); $this->send_error($from, $id, 501);
} }
// method for interactive registration // method for interactive registration
function Handler_iq_jabber_iq_register($packet) function handler_iq_jabber_iq_register($packet)
{ {
$from = $this->GetInfoFromIqFrom($packet); $from = $this->get_info_from_iq_from($packet);
$id = $this->GetInfoFromIqId($packet); $id = $this->get_info_from_iq_id($packet);
$this->SendError($from, $id, 501); $this->send_error($from, $id, 501);
} }
// keepalive method, added by Nathan Fritz // keepalive method, added by Nathan Fritz
function Handler_iq_($packet) function handler_iq_($packet)
{ {
if ($this->keep_alive_id == $this->GetInfoFromIqId($packet)) if ($this->keep_alive_id == $this->get_info_from_iq_id($packet))
{ {
$this->returned_keep_alive = TRUE; $this->returned_keep_alive = true;
} }
} }
@ -823,13 +822,13 @@ class Jabber
// ====================================================================== // ======================================================================
// Generic handler for unsupported requests // Generic handler for unsupported requests
function Handler_NOT_IMPLEMENTED($packet) function handler_not_implemented($packet)
{ {
$packet_type = $this->_get_packet_type($packet); $packet_type = $this->_get_packet_type($packet);
$from = call_user_func(array(&$this, 'GetInfoFrom' . ucfirst($packet_type) . 'From'), $packet); $from = call_user_func(array(&$this, 'get_info_from_' . strtolower($packet_type) . '_from'), $packet);
$id = call_user_func(array(&$this, 'GetInfoFrom' . ucfirst($packet_type) . 'Id'), $packet); $id = call_user_func(array(&$this, 'get_info_from_' . strtolower($packet_type) . '_id'), $packet);
$this->SendError($from, $id, 501); $this->send_error($from, $id, 501);
} }
// Third party code // Third party code
@ -861,12 +860,12 @@ class Jabber
{ {
$children = array(); $children = array();
if ($vals[$i]['value']) if (isset($vals[$i]['value']) && $vals[$i]['value'])
{ {
array_push($children, trim($vals[$i]['value'])); array_push($children, trim($vals[$i]['value']));
} }
while (++$i < count($vals)) while (++$i < sizeof($vals))
{ {
switch ($vals[$i]['type']) switch ($vals[$i]['type'])
{ {
@ -876,9 +875,9 @@ class Jabber
case 'complete': case 'complete':
$tagname = $vals[$i]['tag']; $tagname = $vals[$i]['tag'];
$size = sizeof($children[$tagname]); $size = (isset($children[$tagname])) ? sizeof($children[$tagname]) : 0;
$children[$tagname][$size]['#'] = trim($vals[$i]['value']); $children[$tagname][$size]['#'] = (isset($vals[$i]['value'])) ? trim($vals[$i]['value']) : '';
if ($vals[$i]['attributes']) if (isset($vals[$i]['attributes']) && $vals[$i]['attributes'])
{ {
$children[$tagname][$size]['@'] = $vals[$i]['attributes']; $children[$tagname][$size]['@'] = $vals[$i]['attributes'];
} }
@ -886,7 +885,7 @@ class Jabber
case 'open': case 'open':
$tagname = $vals[$i]['tag']; $tagname = $vals[$i]['tag'];
$size = sizeof($children[$tagname]); $size = (isset($children[$tagname])) ? sizeof($children[$tagname]) : 0;
if ($vals[$i]['attributes']) if ($vals[$i]['attributes'])
{ {
$children[$tagname][$size]['@'] = $vals[$i]['attributes']; $children[$tagname][$size]['@'] = $vals[$i]['attributes'];
@ -907,9 +906,9 @@ class Jabber
return $children; return $children;
} }
// TraverseXMLize() // traverse_xmlize()
// (c) acebone@f2s.com, a HUGE help! // (c) acebone@f2s.com, a HUGE help!
function TraverseXMLize($array, $arrName = 'array', $level = 0) function traverse_xmlize($array, $arr_name = 'array', $level = 0)
{ {
if ($level == 0) if ($level == 0)
{ {
@ -920,11 +919,11 @@ class Jabber
{ {
if (is_array($val)) if (is_array($val))
{ {
$this->TraverseXMLize($val, $arrName . '[' . $key . ']', $level + 1); $this->traverse_xmlize($val, $arr_name . '[' . $key . ']', $level + 1);
} }
else else
{ {
echo '$' . $arrName . '[' . $key . '] = "' . $val . "\"\n"; echo '$' . $arr_name . '[' . $key . '] = "' . $val . "\"\n";
} }
} }
@ -937,18 +936,19 @@ class Jabber
/** /**
* @package phpBB3 * @package phpBB3
* MakeXML * make_xml
* Currently not in use
*/ */
class MakeXML extends Jabber class make_xml extends jabber
{ {
var $nodes; var $nodes;
function MakeXML() function make_xml()
{ {
$nodes = array(); $nodes = array();
} }
function AddPacketDetails($string, $value = NULL) function add_packet_details($string, $value = NULL)
{ {
if (preg_match('#\(([0-9]*)\)$#i', $string)) if (preg_match('#\(([0-9]*)\)$#i', $string))
{ {
@ -971,7 +971,7 @@ class MakeXML extends Jabber
eval('$this->nodes' . $node . ' = "' . htmlspecialchars($value) . '";'); eval('$this->nodes' . $node . ' = "' . htmlspecialchars($value) . '";');
} }
function BuildPacket($array = NULL) function build_packet($array = NULL)
{ {
if (!$array) if (!$array)
{ {
@ -1010,7 +1010,7 @@ class MakeXML extends Jabber
$text .= '>'; $text .= '>';
} }
$text .= $this->BuildPacket($value[$a]); $text .= $this->build_packet($value[$a]);
$text .= "</$key>\n"; $text .= "</$key>\n";
} }
} }
@ -1034,47 +1034,47 @@ class MakeXML extends Jabber
$newarray[$key] = $val; $newarray[$key] = $val;
} }
} }
return (is_array($newarray)) ? $newarray : FALSE; return (is_array($newarray)) ? $newarray : false;
} }
} }
/** /**
* @package phpBB3 * @package phpBB3
* Connector * connector
*/ */
class CJP_StandardConnector class cjp_standard_connector
{ {
var $active_socket; var $active_socket;
function OpenSocket($server, $port) function open_socket($server, $port)
{ {
if ($this->active_socket = @fsockopen($server, $port, $err, $err2, 5)) if ($this->active_socket = @fsockopen($server, $port, $err, $err2, 5))
{ {
@socket_set_blocking($this->active_socket, 0); @socket_set_blocking($this->active_socket, 0);
@socket_set_timeout($this->active_socket, 31536000); @socket_set_timeout($this->active_socket, 31536000);
return TRUE; return true;
} }
else else
{ {
return FALSE; return false;
} }
} }
function CloseSocket() function close_socket()
{ {
return @fclose($this->active_socket); return @fclose($this->active_socket);
} }
function WriteToSocket($data) function write_to_socket($data)
{ {
return @fwrite($this->active_socket, $data); return @fwrite($this->active_socket, $data);
} }
function ReadFromSocket($chunksize) function read_from_socket($chunksize)
{ {
$buffer = stripslashes(@fread($this->active_socket, $chunksize)); $buffer = stripslashes(@fread($this->active_socket, $chunksize));
@set_magic_quotes_runtime(get_magic_quotes_gpc()); //@set_magic_quotes_runtime(get_magic_quotes_gpc());
return $buffer; return $buffer;
} }

View file

@ -370,7 +370,7 @@ class messenger
if (!$use_queue) if (!$use_queue)
{ {
include_once($phpbb_root_path . 'includes/functions_jabber.'.$phpEx); include_once($phpbb_root_path . 'includes/functions_jabber.'.$phpEx);
$this->jabber = new Jabber; $this->jabber = new jabber;
$this->jabber->server = $config['jab_host']; $this->jabber->server = $config['jab_host'];
$this->jabber->port = ($config['jab_port']) ? $config['jab_port'] : 5222; $this->jabber->port = ($config['jab_port']) ? $config['jab_port'] : 5222;
@ -378,32 +378,32 @@ class messenger
$this->jabber->password = $config['jab_password']; $this->jabber->password = $config['jab_password'];
$this->jabber->resource = ($config['jab_resource']) ? $config['jab_resource'] : ''; $this->jabber->resource = ($config['jab_resource']) ? $config['jab_resource'] : '';
if (!$this->jabber->Connect()) if (!$this->jabber->connect())
{ {
$this->error('JABBER', 'Could not connect to Jabber server'); $this->error('JABBER', 'Could not connect to Jabber server');
return false; return false;
} }
if (!$this->jabber->SendAuth()) if (!$this->jabber->send_auth())
{ {
$this->error('JABBER', 'Could not authorise on Jabber server'); $this->error('JABBER', 'Could not authorise on Jabber server');
return false; return false;
} }
$this->jabber->SendPresence(NULL, NULL, 'online'); $this->jabber->send_presence(NULL, NULL, 'online');
foreach ($addresses as $address) foreach ($addresses as $address)
{ {
$this->jabber->SendMessage($address, 'normal', NULL, array('body' => $msg)); $this->jabber->send_message($address, 'normal', NULL, array('body' => $msg));
} }
sleep(1); sleep(1);
$this->jabber->Disconnect(); $this->jabber->disconnect();
} }
else else
{ {
$this->queue->put('jabber', array( $this->queue->put('jabber', array(
'addresses' => $addresses, 'addresses' => $addresses,
'subject' => htmlentities($subject), 'subject' => htmlentities($this->subject),
'msg' => htmlentities($this->msg)) 'msg' => htmlentities($this->msg))
); );
} }
@ -449,7 +449,7 @@ class queue
{ {
global $db, $config, $phpEx, $phpbb_root_path; global $db, $config, $phpEx, $phpbb_root_path;
set_config('last_queue_run', time()); set_config('last_queue_run', time(), true);
// Delete stale lock file // Delete stale lock file
if (file_exists($this->cache_file . '.lock') && !file_exists($this->cache_file)) if (file_exists($this->cache_file . '.lock') && !file_exists($this->cache_file))
@ -494,7 +494,7 @@ class queue
} }
include_once($phpbb_root_path . 'includes/functions_jabber.'.$phpEx); include_once($phpbb_root_path . 'includes/functions_jabber.'.$phpEx);
$this->jabber = new Jabber; $this->jabber = new jabber;
$this->jabber->server = $config['jab_host']; $this->jabber->server = $config['jab_host'];
$this->jabber->port = ($config['jab_port']) ? $config['jab_port'] : 5222; $this->jabber->port = ($config['jab_port']) ? $config['jab_port'] : 5222;
@ -502,18 +502,18 @@ class queue
$this->jabber->password = $config['jab_password']; $this->jabber->password = $config['jab_password'];
$this->jabber->resource = ($config['jab_resource']) ? $config['jab_resource'] : ''; $this->jabber->resource = ($config['jab_resource']) ? $config['jab_resource'] : '';
if (!$this->jabber->Connect()) if (!$this->jabber->connect())
{ {
messenger::error('JABBER', 'Could not connect to Jabber server'); messenger::error('JABBER', 'Could not connect to Jabber server');
continue 2; continue 2;
} }
if (!$this->jabber->SendAuth()) if (!$this->jabber->send_auth())
{ {
messenger::error('JABBER', 'Could not authorise on Jabber server'); messenger::error('JABBER', 'Could not authorise on Jabber server');
continue 2; continue 2;
} }
$this->jabber->SendPresence(NULL, NULL, 'online'); $this->jabber->send_presence(NULL, NULL, 'online');
break; break;
default: default:
@ -545,7 +545,7 @@ class queue
case 'jabber': case 'jabber':
foreach ($addresses as $address) foreach ($addresses as $address)
{ {
$this->jabber->SendMessage($address, 'normal', NULL, array('body' => $msg)); $this->jabber->send_message($address, 'normal', NULL, array('body' => $msg));
} }
break; break;
} }
@ -564,7 +564,7 @@ class queue
// Hang about a couple of secs to ensure the messages are // Hang about a couple of secs to ensure the messages are
// handled, then disconnect // handled, then disconnect
sleep(1); sleep(1);
$this->jabber->Disconnect(); $this->jabber->disconnect();
break; break;
} }
} }

View file

@ -416,7 +416,7 @@ class custom_profile
} }
else else
{ {
$value = (isset($_REQUEST[$profile_row['field_ident']])) ? request_var($profile_row['field_ident'], $default_value) : ((!isset($user->profile_fields[$profile_row['field_ident']]) || $preview) ? $default_value : $user->profile_fields[$profile_row['field_ident']]); $value = (isset($_REQUEST[$profile_row['field_ident']])) ? request_var($profile_row['field_ident'], $default_value) : ((!isset($user->profile_fields[str_replace('pf_', '', $profile_row['field_ident'])]) || $preview) ? $default_value : $user->profile_fields[str_replace('pf_', '', $profile_row['field_ident'])]);
} }
switch ($field_validation) switch ($field_validation)
@ -538,6 +538,7 @@ class custom_profile
global $user; global $user;
$value = $this->get_var('', $profile_row, $profile_row['lang_default_value'], $preview); $value = $this->get_var('', $profile_row, $profile_row['lang_default_value'], $preview);
if ($preview == false) if ($preview == false)
{ {
$message_parser = new parse_message(); $message_parser = new parse_message();
@ -665,10 +666,12 @@ class custom_profile
// Get the allowed settings from the global settings. Magic URLs are always set to true. // Get the allowed settings from the global settings. Magic URLs are always set to true.
// TODO: It might be nice to make this a per field setting. // TODO: It might be nice to make this a per field setting.
$message_parser->parse($config['allow_html'], $config['allow_bbcode'], true, $config['allow_smilies']); $message_parser->parse($config['allow_html'], $config['allow_bbcode'], true, $config['allow_smilies']);
$var = array($profile_row['field_ident'] => $message_parser->message, $var = array(
$profile_row['field_ident'] => $message_parser->message,
$profile_row['field_ident'] . '_bbcode_uid' => $message_parser->bbcode_uid, $profile_row['field_ident'] . '_bbcode_uid' => $message_parser->bbcode_uid,
$profile_row['field_ident'] . '_bbcode_bitfield' => $message_parser->bbcode_bitfield, $profile_row['field_ident'] . '_bbcode_bitfield' => $message_parser->bbcode_bitfield,
'submitted' => request_var($var_name, '')); 'submitted' => request_var($var_name, '')
);
break; break;
default: default:
$var = request_var($var_name, $profile_row['field_default_value']); $var = request_var($var_name, $profile_row['field_default_value']);

View file

@ -1220,6 +1220,7 @@ class auth
// If login returned anything other than an array there was an error // If login returned anything other than an array there was an error
if (!is_array($login)) if (!is_array($login))
{ {
// TODO: Login Attempt++
return $login; return $login;
} }

View file

@ -800,6 +800,8 @@ $lang += array(
'ACC_DISABLE' => 'Disable', 'ACC_DISABLE' => 'Disable',
'VISUAL_CONFIRM' => 'Enable visual confirmation', 'VISUAL_CONFIRM' => 'Enable visual confirmation',
'VISUAL_CONFIRM_EXPLAIN' => 'Requires new users enter a random code matching an image to help prevent mass registrations.', 'VISUAL_CONFIRM_EXPLAIN' => 'Requires new users enter a random code matching an image to help prevent mass registrations.',
'LOGIN_LIMIT' => 'Login attempts',
'LOGIN_LIMIT_EXPLAIN' => 'Number of failed logins users can make before being locked out that session',
'REG_LIMIT' => 'Registration attempts', 'REG_LIMIT' => 'Registration attempts',
'REG_LIMIT_EXPLAIN' => 'Number of attempts users can make at the confirmation code before being locked out that session.', 'REG_LIMIT_EXPLAIN' => 'Number of attempts users can make at the confirmation code before being locked out that session.',
'FORCE_PASS_CHANGE' => 'Force password change', 'FORCE_PASS_CHANGE' => 'Force password change',

View file

@ -52,7 +52,7 @@ $lang += array(
'ALL_FORUMS' => 'All Forums', 'ALL_FORUMS' => 'All Forums',
'ALL_MESSAGES' => 'All Messages', 'ALL_MESSAGES' => 'All Messages',
'ALL_POSTS' => 'All Posts', 'ALL_POSTS' => 'All Posts',
'ALL_TIMES' => 'All times are %s %s', 'ALL_TIMES' => 'All times are GMT%1$s %2$s',
'ALL_TOPICS' => 'All Topics', 'ALL_TOPICS' => 'All Topics',
'AND' => 'And', 'AND' => 'And',
'ARE_WATCHING_FORUM' => 'You have subscribed to receive updates on this forum', 'ARE_WATCHING_FORUM' => 'You have subscribed to receive updates on this forum',
@ -484,150 +484,39 @@ $lang += array(
), ),
'tz' => array( 'tz' => array(
'-13' => 'GMT - 13 Hours', '-12' => '[GMT-12] Eniwetok, Kwaialein',
'-12' => 'GMT - 12 Hours', '-11' => '[GMT-11] Midway Island, Samoa',
'-11' => 'GMT - 11 Hours', '-10' => '[GMT-10] Hawaii, Honolulu',
'-10' => 'GMT - 10 Hours', '-9' => '[GMT-9] Alaska',
'-9' => 'GMT - 9 Hours', '-8' => '[GMT-8] Anchorage, Los Angeles, San Francisco, Seattle',
'-8' => 'GMT - 8 Hours', '-7' => '[GMT-7] Denver, Edmonton, Phoenix, Salt Lake City, Santa Fe',
'-7' => 'GMT - 7 Hours', '-6' => '[GMT-6] Chicago, Guatamala, Mexico City, Saskatchewan East',
'-6' => 'GMT - 6 Hours', '-5' => '[GMT-5] Bogota, Kingston, Lima, New York',
'-5' => 'GMT - 5 Hours', '-4' => '[GMT-4] Caracas, Labrador, La Paz, Maritimes, Santiago',
'-4' => 'GMT - 4 Hours', '-3.5' => '[GMT-3.5] Standard Time [Canada], Newfoundland',
'-3.5' => 'GMT - 3.5 Hours', '-3' => '[GMT-3] Brazilia, Buenos Aires, Georgetown, Rio de Janero',
'-3' => 'GMT - 3 Hours', '-2' => '[GMT-2] Mid-Atlantic',
'-2.5' => 'GMT - 2.5 Hours', '-1' => '[GMT-1] Azores, Cape Verde Is.',
'-2' => 'GMT - 2 Hours', '0' => '[GMT] Dublin, Edinburgh, Iceland, Lisbon, London, Casablanca',
'-1' => 'GMT - 1 Hours', '1' => '[GMT+1] Amsterdam, Berlin, Bern, Brussells, Madrid, Paris, Rome, Oslo, Vienna',
'0' => 'GMT', '2' => '[GMT+2] Athens, Bucharest, Harare, Helsinki, Israel, Istanbul',
'1' => 'GMT + 1 Hour', '3' => '[GMT+3] Ankara, Baghdad, Bahrain, Beruit, Kuwait, Moscow, Nairobi, Riyadh',
'2' => 'GMT + 2 Hours', '3.5' => '[GMT+3.5] Iran',
'3' => 'GMT + 3 Hours', '4' => '[GMT+4] Abu Dhabi, Kabul, Muscat, Tbilisi, Volgograd',
'3.5' => 'GMT + 3.5 Hours', '4.5' => '[GMT+4.5] Afghanistan',
'4' => 'GMT + 4 Hours', '5' => '[GMT+5] Calcutta, Madras, New Dehli',
'4.5' => 'GMT + 4.5 Hours', '5.5' => '[GMT+5.5] India',
'5' => 'GMT + 5 Hours', '6' => '[GMT+6] Almaty, Dhakar, Kathmandu',
'5.5' => 'GMT + 5.5 Hours', '6.5' => '[GMT+6.5] Rangoon',
'6' => 'GMT + 6 Hours', '7' => '[GMT+7] Bangkok, Hanoi, Jakarta, Phnom Penh',
'6.5' => 'GMT + 6.5 Hours', '8' => '[GMT+8] Beijing, Hong Kong, Kuala Lumpar, Manila, Perth, Singapore, Taipei',
'7' => 'GMT + 7 Hours', '9' => '[GMT+9] Osaka, Sapporo, Seoul, Tokyo, Yakutsk',
'8' => 'GMT + 8 Hours', '9.5' => '[GMT+9.5] Adelaide, Darwin',
'9' => 'GMT + 9 Hours', '10' => '[GMT+10) Brisbane, Canberra, Guam, Hobart, Melbourne, Port Moresby, Sydney',
'9.5' => 'GMT + 9.5 Hours', '11' => '[GMT+11] Magadan, New Caledonia, Solomon Is.',
'10' => 'GMT + 10 Hours', '12' => '[GMT+12] Auckland, Fiji, Kamchatka, Marshall Is., Suva, Wellington',
'10.5' => 'GMT + 10.5 Hours',
'11' => 'GMT + 11 Hours',
'12' => 'GMT + 12 Hours',
'13' => 'GMT + 13 Hours',
'dst' => '[DST]' 'dst' => '[DST]'
), ),
); );
/* Pool of unused or currently not assignable language variables
$unused = array(
'ALREADY_VOTED' => 'You have already voted in this poll and may not change your selection.',
'AM' => 'AM',
'AVATAR' => 'Avatar',
'Add_member' => 'Add Member',
'All_Messages' => 'All Messages',
'Already_member_group' => 'You are already a member of this group',
'Approve_selected' => 'Approve Selected',
'Are_group_moderator' => 'You are the group moderator',
'BY' => 'by',
'CANNOT_DELETE_POLL' => 'Sorry but you cannot delete an active poll.',
'CANNOT_SPLIT_FIRST_POST' => 'You cannot split the first post of a topic',
'CONTACT' => 'Contact',
'Cannot_send_privmsg' => 'Sorry but the administrator has prevented you from sending private messages',
'Confirm_delete_pm' => 'Are you sure you want to delete this message?',
'Confirm_delete_pms' => 'Are you sure you want to delete these messages?',
'Confirm_unsub' => 'Are you sure you want to unsubscribe from this group?',
'Confirm_unsub_pending' => 'Your subscription to this group has not yet been approved, are you sure you want to unsubscribe?',
'Could_not_add_user' => 'The user you selected does not exist',
'Could_not_anon_user' => 'You cannot make Anonymous a group member',
'Current_memberships' => 'Current memberships',
'DESCRIPTION' => 'Description',
'DOWNLOAD' => 'Download',
'Date' => 'Date',
'Deny_selected' => 'Deny Selected',
'Disable_BBCode_pm' => 'Disable BBCode in this message',
'Disable_HTML_pm' => 'Disable HTML in this message',
'Disable_Smilies_pm' => 'Disable Smilies in this message',
'Display_messages' => 'Display messages from previous',
'EDIT_OWN_POSTS' => 'Sorry but you can only edit your own posts.',
'EMAIL_TAKEN_EMAIL' => 'The email address you specified is already in use, please select an alternative.',
'ERROR' => 'Error',
'Edit_message' => 'Edit private message',
'Find' => 'Find',
'Flag' => 'Flag',
'From' => 'From',
'IP_ADDRESS' => 'IP Address',
'Inbox' => 'Inbox',
'Inbox_size' => 'Your Inbox is %d%% full',
'Join_group' => 'Join Group',
'LOGOUT' => 'Logout',
'Login_to_join' => 'Login to join or manage group memberships',
'Member_this_group' => 'You are a member of this group',
'Memberships_pending' => 'Memberships pending',
'Message_sent' => 'Your message has been sent',
'NEVER' => 'Never',
'NOT_AUTHORISED' => 'Not Authorised',
'NO_MODE' => 'No mode specified.',
'No_folder' => 'No folder specified',
'No_group_members' => 'This group has no members',
'No_match' => 'No matches found',
'No_messages_folder' => 'You have no messages in this folder',
'No_pending_group_members' => 'This group has no pending members',
'No_such_folder' => 'No such folder exists',
'No_such_user' => 'Sorry but no such user exists',
'No_to_user' => 'You must specify a username to send this message',
'Non_member_groups' => 'Non-member groups',
'Not_group_moderator' => 'You are not this groups moderator therefor you cannot preform that action.',
'Not_logged_in' => 'You must be logged in to join a group.',
'Notification_subject' => 'New Private Message has arrived',
'Outbox' => 'Outbox',
'PASSWORD_MISMATCH' => 'The passwords you entered did not match',
'PLEASE_SELECT_FORUM' => 'Please select a forum',
'POLL_DELETED' => 'Your poll has been deleted successfully',
'POSTER_CHANGED_SUCESS' => 'The poster of this message has been successfully changed',
'POST_IGNORE' => 'This post was made by <b>%1$s</b> who is on your ignore list. To display this post click %sHERE%s.',
'POST_TOPIC_LOCKED' => 'Topic is locked',
'Pending_members' => 'Pending Members',
'Pending_this_group' => 'Your membership of this group is pending',
'RATING' => 'Rating',
'RESULT_DIR' => 'Order results',
'RETURN_GROUP' => 'Click %sHere%s to return to the Group Control Panel',
'RETURN_LOGIN' => 'Click %sHere%s to try again',
'RETURN_MCP' => 'Click %sHere%s to return to the Moderator Control Panel',
'Read_message' => 'Read message',
'Read_pm' => 'Read message',
'Remove_selected' => 'Remove Selected',
'SEARCH_PREVIOUS' => 'Search previous',
'SIGNATURE_NOTICE' => 'Please note that some forums limit the size and content of your signature. Be sure to read any forum or board rules to ensure you comply with them.',
'SORT_POSTS' => 'Total posts',
'SORT_WEBSITE' => 'Website',
'SPELLCHECK' => 'Spellcheck',
'START_PAGE' => 'Make my start page',
'Save_marked' => 'Save Marked',
'Save_message' => 'Save Message',
'Savebox' => 'Savebox',
'Savebox_size' => 'Your Savebox is %d%% full',
'Saved' => 'Saved',
'Send_a_new_message' => 'Send a new private message',
'Send_a_reply' => 'Reply to a private message',
'Sent' => 'Sent',
'Sentbox_size' => 'Your Sentbox is %d%% full',
'This_closed_group' => 'This is a closed group, no more users accepted',
'This_hidden_group' => 'This is a hidden group, automatic user addition is not allowed',
'This_open_group' => 'This is an open group, click to request membership',
'To_long_subject' => 'The subject is too long it must be 60 characters or less.',
'UNREAD_NO_PM' => 'You have no unread private messages',
'UPDATE' => 'Update',
'USER_OFFLINE' => 'Offline',
'Unsub_success' => 'You have been un-subscribed from this group.',
'User_is_member_group' => 'User is already a member of this group',
'VIEWING_MESSAGES' => 'Viewing Private Messages',
'View_Information' => 'View Information'
);
*/
?> ?>

View file

@ -1,29 +1,31 @@
<!-- BEGIN dropdown --> <!-- BEGIN dropdown -->
<select name="{dropdown.FIELD_NAME}"> <select name="{dropdown.FIELD_IDENT}">
<!-- BEGIN options --><option value="{dropdown.options.OPTION_ID}"{dropdown.options.SELECTED}>{dropdown.options.VALUE}</option><!-- END options --> <!-- BEGIN options --><option value="{dropdown.options.OPTION_ID}"{dropdown.options.SELECTED}>{dropdown.options.VALUE}</option><!-- END options -->
</select> </select>
<!-- END dropdown --> <!-- END dropdown -->
<!-- BEGIN text --> <!-- BEGIN text -->
<textarea name="{text.FIELD_NAME}" rows="{text.FIELD_ROWS}" cols="{text.FIELD_COLS}">{text.FIELD_VALUE}</textarea> <textarea name="{text.FIELD_IDENT}" rows="{text.FIELD_ROWS}" cols="{text.FIELD_COLS}">{text.FIELD_VALUE}</textarea>
<!-- END text --> <!-- END text -->
<!-- BEGIN string --> <!-- BEGIN string -->
<input type="text" class="post" name="{string.FIELD_NAME}" size="{string.FIELD_LENGTH}" maxlength="{string.FIELD_MAXLEN}" value="{string.FIELD_VALUE}" /> <input type="text" class="post" name="{string.FIELD_IDENT}" size="{string.FIELD_LENGTH}" maxlength="{string.FIELD_MAXLEN}" value="{string.FIELD_VALUE}" />
<!-- END string --> <!-- END string -->
<!-- BEGIN bool --> <!-- BEGIN bool -->
<!-- IF bool.FIELD_LENGTH eq 1 --> <!-- IF bool.FIELD_LENGTH eq 1 -->
<!-- BEGIN options --><input type="radio" name="{bool.FIELD_NAME}" value="{bool.options.OPTION_ID}"{bool.options.CHECKED} /><span class="genmed">{bool.options.VALUE}</span>&nbsp; &nbsp;<!-- END options --> <!-- BEGIN options --><input type="radio" name="{bool.FIELD_IDENT}" value="{bool.options.OPTION_ID}"{bool.options.CHECKED} /><span class="genmed">{bool.options.VALUE}</span>&nbsp; &nbsp;<!-- END options -->
<!-- ELSE --> <!-- ELSE -->
<input type="checkbox" name="{bool.FIELD_NAME}"<!-- IF bool.FIELD_VALUE --> checked="checked"<!-- ENDIF --> /> <input type="checkbox" name="{bool.FIELD_IDENT}"<!-- IF bool.FIELD_VALUE --> checked="checked"<!-- ENDIF --> />
<!-- ENDIF --> <!-- ENDIF -->
<!-- END bool --> <!-- END bool -->
<!-- BEGIN int --> <!-- BEGIN int -->
<input type="text" class="post" name="{int.FIELD_NAME}" size="{int.FIELD_LENGTH}" value="{int.FIELD_VALUE}" /> <input type="text" class="post" name="{int.FIELD_IDENT}" size="{int.FIELD_LENGTH}" value="{int.FIELD_VALUE}" />
<!-- END int --> <!-- END int -->
<!-- BEGIN date --> <!-- BEGIN date -->
<span class="genmed">{L_DAY}:</span> <select name="{date.FIELD_NAME}_day">{date.S_DAY_OPTIONS}</select> <span class="genmed">{L_MONTH}:</span> <select name="{date.FIELD_NAME}_month">{date.S_MONTH_OPTIONS}</select> <span class="genmed">{L_YEAR}:</span> <select name="{date.FIELD_NAME}_year">{date.S_YEAR_OPTIONS}</select> <span class="genmed">{L_DAY}:</span> <select name="{date.FIELD_IDENT}_day">{date.S_DAY_OPTIONS}</select>
<span class="genmed">{L_MONTH}:</span> <select name="{date.FIELD_IDENT}_month">{date.S_MONTH_OPTIONS}</select>
<span class="genmed">{L_YEAR}:</span> <select name="{date.FIELD_IDENT}_year">{date.S_YEAR_OPTIONS}</select>
<!-- END date --> <!-- END date -->