aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/db/firebird.php10
-rw-r--r--phpBB/includes/db/mysql.php2
-rw-r--r--phpBB/includes/db/postgres.php6
-rw-r--r--phpBB/includes/functions.php40
-rw-r--r--phpBB/includes/functions_admin.php34
-rw-r--r--phpBB/includes/functions_jabber.php16
-rw-r--r--phpBB/includes/functions_posting.php19
-rw-r--r--phpBB/includes/functions_user.php99
-rw-r--r--phpBB/includes/session.php45
-rw-r--r--phpBB/includes/ucp/ucp_profile.php33
10 files changed, 206 insertions, 98 deletions
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index 247f3dd429..65be3b7723 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -43,7 +43,7 @@ class sql_db
$this->password = $sqlpassword;
$this->server = $sqlserver;
- $this->db_connect_id =($this->persistency) ? @ibase_pconnect($this->server, $this->user, $this->password) : @ibase_connect($this->server, $this->user, $this->password);
+ $this->db_connect_id =($this->persistency) ? @ibase_pconnect($this->server, $this->user, $this->password, false, false, 3) : @ibase_connect($this->server, $this->user, $this->password, false, false, 3);
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
}
@@ -132,6 +132,12 @@ class sql_db
$this->sql_error($query);
}
+ if (!$this->transaction && (strpos($query, 'INSERT') === 0 || strpos($query, 'UPDATE') === 0))
+ {
+ echo $query;
+ ibase_commit();
+ }
+
if (!empty($_GET['explain']))
{
$endtime = explode(' ', microtime());
@@ -415,7 +421,7 @@ class sql_db
function sql_escape($msg)
{
- return (@ini_get('magic_quotes_sybase') || strtoupper(@ini_get('magic_quotes_sybase')) == 'ON') ? str_replace('\\\'', '\'', addslashes($msg)) : str_replace('\\\'', '\'\'', $msg);
+ return (@ini_get('magic_quotes_sybase') || strtolower(@ini_get('magic_quotes_sybase')) == 'on') ? str_replace('\\\'', '\'', addslashes($msg)) : str_replace('\'', '\'\'', stripslashes($msg));
}
function sql_error($sql = '')
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php
index cd9a074f35..040f057f4e 100644
--- a/phpBB/includes/db/mysql.php
+++ b/phpBB/includes/db/mysql.php
@@ -134,7 +134,7 @@ class sql_db
$curtime = $curtime[0] + $curtime[1] - $starttime;
}
- if (!($this->query_result = @mysql_query($query, $this->db_connect_id)))
+ if (($this->query_result = @mysql_query($query, $this->db_connect_id)) === false)
{
$this->sql_error($query);
}
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index 8f916eae99..aa26e8ec8f 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -35,12 +35,9 @@ class sql_db
var $rownum = array();
var $num_queries = 0;
- //
- // Constructor
- //
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
- $this->connect_string = "";
+ $this->connect_string = '';
if ($sqluser)
{
@@ -363,7 +360,6 @@ class sql_db
function sql_error($sql = '')
{
-
if (!$this->return_on_error)
{
if ($this->transaction)
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 57282981ba..40de5d6690 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1,23 +1,15 @@
<?php
-/***************************************************************************
- * functions.php
- * -------------------
- * begin : Saturday, Feb 13, 2001
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
- * $Id$
- *
- ***************************************************************************/
-
-/***************************************************************************
- *
- * 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.
- *
- ***************************************************************************/
+// -------------------------------------------------------------
+//
+// $Id$
+//
+// FILENAME : functions.php
+// STARTED : Sat Feb 13, 2001
+// COPYRIGHT : � 2001,2003 phpBB Group
+// WWW : http://www.phpbb.com/
+// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
+//
+// -------------------------------------------------------------
function set_config($config_name, $config_value, $is_dynamic = FALSE)
{
@@ -697,10 +689,11 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
$page_string .= ($on_page == $total_pages) ? '<b>' . $total_pages . '</b>' : '<a href="' . $base_url . '&amp;start=' . (($total_pages - 1) * $per_page) . '">' . $total_pages . '</a>&nbsp;&nbsp;<a href="' . $base_url . "&amp;start=" . ($on_page * $per_page) . '">' . $user->lang['NEXT'] . '</a>';
-// $page_string = '<a href="javascript:goto();">' . $user->lang['GOTO_PAGE'] . '</a> ' . $page_string;
$page_string = $user->lang['GOTO_PAGE'] . ' ' . $page_string;
+// $page_string = '<a href="javascript:goto();">' . $user->lang['GOTO_PAGE'] . '</a> ' . $page_string;
// $template->assign_var('BASE_URL', $base_url);
+// $template->assign_var('PER_PAGE', $per_page);
return $page_string;
}
@@ -944,10 +937,6 @@ function login_box($s_action, $s_hidden_fields = '', $login_explain = '')
$err = ($result === 0) ? $user->lang['ACTIVE_ERROR'] : $user->lang['LOGIN_ERROR'];
}
- $sql = 'DELETE FROM ' . CONFIRM_TABLE . '
- WHERE confirm_time < ' . (time() - $config['session_length']);
-// $db->sql_query($sql);
-
$template->assign_vars(array(
'LOGIN_ERROR' => $err,
'LOGIN_EXPLAIN' => $login_explain,
@@ -994,6 +983,9 @@ function login_forum_box(&$forum_data)
if (!empty($_POST['password']))
{
+ // TODO
+ // Remove old valid sessions
+
if ($_POST['password'] == $forum_data['forum_password'])
{
$sql = 'INSERT INTO phpbb_forum_access (forum_id, user_id, session_id)
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 503ede56ca..d4da25127b 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1,23 +1,15 @@
<?php
-/***************************************************************************
- * functions_admin.php
- * -------------------
- * begin : Saturday, Feb 13, 2001
- * copyright : � 2001 The phpBB Group
- * email : support@phpbb.com
- *
- * $Id$
- *
- ***************************************************************************/
-
-/***************************************************************************
- *
- * 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.
- *
- ***************************************************************************/
+// -------------------------------------------------------------
+//
+// $Id$
+//
+// FILENAME : functions_admin.php
+// STARTED : Sat Feb 13, 2001
+// COPYRIGHT : � 2001,2003 phpBB Group
+// WWW : http://www.phpbb.com/
+// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
+//
+// -------------------------------------------------------------
// Simple version of jumpbox, just lists authed forums
function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true)
@@ -1362,7 +1354,7 @@ function split_sql_file($sql, $delimiter)
// and group names must be carried through for the moderators table
function cache_moderators()
{
- global $db;
+ global $db, $cache;
// Clear table
$sql = (SQL_LAYER != 'sqlite') ? 'TRUNCATE ' . MODERATOR_TABLE : 'DELETE FROM ' . MODERATOR_TABLE;
@@ -1448,6 +1440,8 @@ function cache_moderators()
}
}
}
+
+ $cache->destroy(MODERATOR_TABLE);
}
// Logging functions
diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php
index 271bf98b7c..8059f55589 100644
--- a/phpBB/includes/functions_jabber.php
+++ b/phpBB/includes/functions_jabber.php
@@ -296,6 +296,22 @@ class Jabber
}
}
+ function SendPresence($type = NULL, $to = NULL, $status = NULL, $show = NULL, $priority = NULL)
+ {
+ $xml = '<presence';
+ $xml .= ($to) ? " to='$to'" : '';
+ $xml .= ($type) ? " type='$type'" : '';
+ $xml .= ($status || $show || $priority) ? ">\n" : " />\n";
+
+ $xml .= ($status) ? " <status>$status</status>\n" : '';
+ $xml .= ($show) ? " <show>$show</show>\n" : '';
+ $xml .= ($priority) ? " <priority>$priority</priority>\n" : '';
+
+ $xml .= ($status || $show || $priority) ? "</presence>\n" : '';
+
+ return ($this->SendPacket($xml)) ? TRUE : FALSE;
+ }
+
function SendError($to, $id = NULL, $error_number, $error_message = NULL)
{
$xml = "<iq type='error' to='$to'";
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index a42952375b..a25c44f5e3 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -29,6 +29,8 @@ function generate_smilies($mode)
if ($mode == 'window')
{
+ $user->setup(false);
+
page_header($user->lang['SMILIES'] . ' - ' . $topic_title);
$template->set_filenames(array(
@@ -555,7 +557,8 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata)
}
}
}
- return '';
+
+ return;
}
// Delete File
@@ -568,14 +571,13 @@ function phpbb_unlink($filename, $mode = 'file', $use_ftp = false)
if (file_exists($filename))
{
- $filesys = eregi_replace('/','\\', $filename);
+ $filesys = str_replace('/','\\', $filename);
$deleted = @system("del $filesys");
if (file_exists($filename))
{
@chmod($filename, 0777);
- $deleted = @unlink($filename);
- if (!$deleted)
+ if (!($deleted = @unlink($filename)))
{
$deleted = @system("del $filename");
}
@@ -590,8 +592,8 @@ function phpbb_unlink($filename, $mode = 'file', $use_ftp = false)
function get_img_size_format($width, $height)
{
// Change these two values to define the Thumbnail Size
- $max_width = 300;
- $max_height = 85;
+ $max_width = 400;
+ $max_height = 200;
if ($height > $max_height)
{
@@ -673,8 +675,7 @@ function create_thumbnail($source, $new_file, $mimetype)
$new_size = get_img_size_format($size[0], $size[1]);
- $tmp_path = '';
- $old_file = '';
+ $tmp_path = $old_file = '';
$used_imagick = FALSE;
@@ -682,7 +683,7 @@ function create_thumbnail($source, $new_file, $mimetype)
{
if (is_array($size) && count($size) > 0)
{
- @exec($config['img_imagick'] . 'convert' . ((defined('PHP_OS') && preg_match('#win#i', PHP_OS)) ? '.exe' : '') . ' -quality 75 -antialias -sample ' . $new_size[0] . 'x' . $new_size[1] . ' ' . $source . ' +profile "*" ' . $new_file);
+ passthru($config['img_imagick'] . 'convert' . ((defined('PHP_OS') && preg_match('#win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -antialias -sample ' . $new_size[0] . 'x' . $new_size[1] . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $new_file) . '"');
if (file_exists($new_file))
{
$used_imagick = TRUE;
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index cf2614cce3..a352a3987c 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -569,16 +569,12 @@ function create_group($action, $group_id, &$type, &$name, &$desc, &$colour, &$ra
return (sizeof($error)) ? $error : false;
}
-
+// Call with: user_id_ary or username_ary set ... if both false entire group
+// will be set default
function set_default_group($id, $user_id_ary, $username_ary, &$name, &$colour, &$rank, $avatar, $avatar_type)
{
global $db;
- if (!is_array($$which_ary))
- {
- $$which_ary = array($$which_ary);
- }
-
if (is_array($user_id_ary) || is_array($username_ary))
{
$sql_where = ($user_id_ary) ? 'user_id IN (' . implode(', ', $user_id_ary) . ')' : 'username IN (' . implode(', ', $username_ary) . ')';
@@ -656,31 +652,41 @@ function set_default_group($id, $user_id_ary, $username_ary, &$name, &$colour, &
return false;
}
-// TODO
-// approve group
+// Call with: user_id_ary or username_ary set ... if both false entire group
+// will be approved
function approve_user($group_id, $user_id_ary, $username_ary, &$group_name)
{
global $db;
- $sql_where = ($user_id_ary) ? 'user_id IN (' . implode(', ', $user_id_ary) . ')' : 'username IN (' . implode(', ', $username_ary) . ')';
+ if (is_array($user_id_ary) || is_array($username_ary))
+ {
+ $sql_where = ($user_id_ary) ? 'user_id IN (' . implode(', ', $user_id_ary) . ')' : 'username IN (' . implode(', ', $username_ary) . ')';
- $sql = 'SELECT user_id, username
- FROM ' . USERS_TABLE . "
- WHERE $sql_where";
+ $sql = 'SELECT user_id, username
+ FROM ' . USERS_TABLE . "
+ WHERE $sql_where";
+ }
+ else
+ {
+ $sql = 'SELECT u.user_id, u.username
+ FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . "
+ WHERE ug.group_id = $group_id
+ AND u.user_id = ug.user_id";
+ }
$result = $db->sql_query($sql);
$usernames = array();
while ($row = $db->sql_fetchrow($result))
{
$username_ary[] = $row['username'];
- $user_id_ary[] = $row['user_id'];
+ $user_id_ary[] = $row['user_id'];
}
$db->sql_freeresult($result);
- $sql = 'UPDATE ' . USER_GROUP_TABLE . '
+ $sql = 'UPDATE ' . USER_GROUP_TABLE . "
SET user_pending = 0
- WHERE user_id IN (' . implode(', ', $user_id_ary) . ")
- AND group_id = $group_id";
+ WHERE group_id = $group_id
+ AND user_id IN (" . implode(', ', $user_id_ary) . ')';
$db->sql_query($sql);
add_log('admin', 'LOG_GROUP_APPROVE', $group_name, implode(', ', $username_ary));
@@ -691,4 +697,65 @@ function approve_user($group_id, $user_id_ary, $username_ary, &$group_name)
return false;
}
+// If user_id or username_ary are set users are deleted, else group is
+// removed. Setting action to demote true will demote leaders to users
+// (if appropriate), deleting leaders removes them from group as with
+// normal users
+function remove_from_group($type, $id, $user_id_ary, $username_ary, &$group_name)
+{
+ global $db;
+
+ // Delete or demote individuals if data exists, else delete group
+ if (is_array($user_id_ary) || is_array($username_ary))
+ {
+ $sql_where = ($user_id_ary) ? 'user_id IN (' . implode(', ', $user_id_ary) . ')' : 'username IN (' . implode(', ', $username_ary) . ')';
+
+ $sql = 'SELECT user_id, username
+ FROM ' . USERS_TABLE . "
+ WHERE $sql_where";
+ $result = $db->sql_query($sql);
+
+ $usernames = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $username_ary[] = $row['username'];
+ $user_id_ary[] = $row['user_id'];
+ }
+ $db->sql_freeresult($result);
+
+ switch ($type)
+ {
+ case 'demote':
+ $sql = 'UPDATE ' . USER_GROUP_TABLE . "
+ SET group_leader = 0
+ WHERE $sql_where";
+ $db->sql_query($sql);
+ break;
+
+ default:
+ $sql = 'SELECT g.group_id, g.group_name, u.user_id
+ FROM ' . USER_GROUP_TABLE . ' ug, ' . GROUPS_TABLE . ' g
+ WHERE u.user_id IN ' . implode(', ', $user_id_ary) . "
+ AND ug.group_id <> $group_id
+ AND g.group_type = " . GROUP_SPECIAL . '
+ GROUP BY u.user_id';
+ break;
+ }
+ }
+ else
+ {
+ }
+
+ if (!function_exists('add_log'))
+ {
+ global $phpbb_root_path, $phpEx;
+ include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
+ }
+
+ $log = ($action == 'demote') ? 'LOG_GROUP_DEMOTED' : (($action == 'deleteusers') ? 'LOG_GROUP_REMOVE' : 'LOG_GROUP_DELETED');
+ add_log('admin', $log, $name, implode(', ', $username_ary));
+
+ return false;
+}
+
?> \ No newline at end of file
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 96cc8ee974..9cb1200d76 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -71,9 +71,9 @@ class session
}
// Load limit check (if applicable)
- if (doubleval($config['limit_load']) && @file_exists('/proc/loadavg'))
+ if (@file_exists('/proc/loadavg'))
{
- if ($load = @file('/proc/loadavg'))
+ if ($config['limit_load'] && $load = @file('/proc/loadavg'))
{
list($this->load) = explode(' ', $load[0]);
@@ -398,6 +398,8 @@ class user extends session
var $lang_path;
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');
+
function setup($lang_set = false, $style = false)
{
global $db, $template, $config, $auth, $phpEx, $phpbb_root_path;
@@ -539,6 +541,45 @@ class user extends session
}
return $imgs[$img];
}
+
+ // Start code for checking/setting option bit field for user table (if we go that way)
+ // TODO
+ // array_search begone
+ // set values, blah, everything else
+ function option_set($key, $value = false)
+ {
+ if (is_array($key))
+ {
+ if (is_array($value))
+ {
+ $return = array();
+ foreach ($key as $k)
+ {
+ $return[$key] = ($user->data['user_options'] & pow(2, array_search($key, $this->keyoptions))) ? true : false;
+ }
+ return $return;
+ }
+ else
+ {
+ $return = array();
+ 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;
+ }
+ }
+ }
}
// Will be keeping my eye of 'other products' to ensure these things don't
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index deedf20f25..1c5d498d52 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -1,23 +1,18 @@
<?php
-/***************************************************************************
- * ucp_profile.php
- * -------------------
- * begin : Saturday, Feb 21, 2003
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
- * $Id$
- *
- ***************************************************************************/
-
-/***************************************************************************
- *
- * 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.
- *
- ***************************************************************************/
+// -------------------------------------------------------------
+//
+// $Id$
+//
+// FILENAME : admin_styles.php
+// STARTED : Thu Aug 7 2003
+// COPYRIGHT : � 2003 phpBB Group
+// WWW : http://www.phpbb.com/
+// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
+//
+// -------------------------------------------------------------
+
+// TODO
+// Check birthday for date in past
class ucp_profile extends ucp
{