Skip to content

Instantly share code, notes, and snippets.

@nickvergessen
nickvergessen / Fix 3.0.9 files and 3.0.8 database
Created July 5, 2011 13:24
PHPBB3-10247 mediumint(8) too small for phpbb_login_attempts.attempt_id
diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php
index 6ca69d9..9d7deda 100644
--- a/phpBB/includes/auth/auth_db.php
+++ b/phpBB/includes/auth/auth_db.php
@@ -72,6 +72,9 @@ function login_db($username, $password, $ip = '', $browser = '', $forwarded_for
if (($ip && !$config['ip_login_limit_use_forwarded']) ||
($forwarded_for && $config['ip_login_limit_use_forwarded']))
{
+ // If the database is not yet updated, there will be an error due to missing LOGIN_ATTEMPT_TABLE
+ $db->sql_return_on_error(true);
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 10d7973..7816484 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -868,10 +868,18 @@ class auth_admin extends auth
$db->sql_query($sql);
}
- // Ok, include the any-flag if one or more auth options are set to yes...
+ // Ok, set the any flag to Never.
@nickvergessen
nickvergessen / phpBB\includes\functions_display.php
Created July 11, 2011 16:55
Clean handling of $start... fail
function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0)
{
global $template, $db, $user, $phpEx, $start, $phpbb_root_path;
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index b29e279..3adec08 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -346,7 +346,7 @@ class dbal
}
else
{
- $values[] = $this->_sql_validate_value($var);
+ $values[] = $this->_sql_validate_value($var, $key);
@nickvergessen
nickvergessen / gist:1078063
Created July 12, 2011 14:10
sql_escape_binary() solution
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index b29e279..15c220b 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -541,12 +541,16 @@ class dbal
* Function for validating values
* @access private
*/
- function _sql_validate_value($var)
+ function _sql_validate_value($var, $is_binary = false)
<?php
/**
*
* @package VC
* @version $Id: phpbb_captcha_sortables_plugin.php 2009-09-03 Derky $
* extending from: phpbb_captcha_qa_plugin.php 10484 2010-02-08 16:43:39Z bantu $
* @copyright (c) 2006, 2008 phpBB Group
* @copyright (c) 2009 Derky - phpBB3styles.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@nickvergessen
nickvergessen / gist:1084291
Created July 15, 2011 08:06
ticket/10252
diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php
index 5564de2..dc289e6 100644
--- a/phpBB/includes/auth.php
+++ b/phpBB/includes/auth.php
@@ -349,6 +349,13 @@ class auth
/**
* Get permission listing based on user_id/options/forum_ids
+ *
+ * Be carefully when using this function with permissions a_, m_, u_ and f_ !
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index af262ba..1b14fdc 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -81,7 +81,7 @@ function mcp_front_view($id, $mode, $action)
if ($total)
{
- $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
+ $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.post_attachment, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
@nickvergessen
nickvergessen / gist:1214498
Created September 13, 2011 17:50
Convert online user stuff to plural forms
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 628f8ee..d39e773 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -4161,59 +4161,26 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum'
}
else if ($config['load_online_guests'])
{
- $l_online = ($online_users['guests_online'] === 1) ? $user->lang['BROWSING_' . $item_caps . '_GUEST'] : $user->lang['BROWSING_' . $item_caps . '_GUESTS'];
- $online_userlist = sprintf($l_online, $online_userlist, $online_users['guests_online']);
@nickvergessen
nickvergessen / gist:1215299
Created September 13, 2011 22:05
Plurals patch for language/en/ files (NOT acp/
diff --git a/phpBB/feed.php b/phpBB/feed.php
index 9816f0f..9cb9f6f 100644
--- a/phpBB/feed.php
+++ b/phpBB/feed.php
@@ -1169,7 +1169,7 @@ class phpbb_feed_forums extends phpbb_feed_base
{
global $user;
- $item_row['statistics'] = sprintf($user->lang['TOTAL_TOPICS_OTHER'], $row['forum_topics'])
+ $item_row['statistics'] = $user->lang('TOTAL_TOPICS', (int) $row['forum_topics'])