is "fork" a 4-letter word?

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: is "fork" a 4-letter word?

Post by Acyd Burn »

LEW21 wrote:Currently it's nearly impossible to make a frequently updated phpBB's fork that returns some code upstream, because phpBB uses centralized VCS. It's impossible to copy a branch, do some big changes and return these changes upstream - the patch will be very big, changes not well-documented, and nobody will have time to review it.
This is not about letting 3rd party have access to our repository... this is about a dedicated group of people, or individuals, participating by submitting patches upstream - these must be reviewed by at least one developer, always. No way around it.

A group of people is always able to merge in changes from the branch (the SVN tools are quite powerful). I also wished sometimes to have a VCS where a group of people are set on "review" and their commits then need to go to an approval workflow before commit, but we decided for SVN now. :)

As David, i would also be happy if there would be people submitting patches (for trunk or the branch does not matter) which do not consist of simple fixes we would have done during the time reading the patch. ;) Patches which are of quality, which adhere to the guidelines and which are built with every other touching aspect in mind. Of course, there are some very nasty bugs and although being a one-liner mostly these are hugely beneficial because the person who produced the patch invested hours to track the underlying bug down (as we need to do for some bugs).

Image

code reader
Registered User
Posts: 653
Joined: Wed Sep 21, 2005 3:01 pm

Re: is "fork" a 4-letter word?

Post by code reader »

it goes without saying that nothing is merged upstream without core team review.
the whole point of an open branch is that a change can be reviewed, improved upon and tested by community members without taking cycles from core development team during the development and testing phase.

the core team can, of course, view and be involved in this side development as much as they want (comments like "we will only consider this for inclusion if you do this or avoid doing that" in early stages can be beneficial, without committing the team to actually use anything), but generally they are not expected to: core team usually deals mainly with the project trunk.

once the patch/modification/change/improvement is good enough, it can be submitted for review to the core team.
i would expect that typical response would not be "great! we'll take it", but rather "please change x y z this way or that", so, submitting patches for upstream inclusion would be an iterative process.
of course the response can also be or "we discussed this feature, and decided we don't want it", in which case the branch can be used as a basis for a mod.

the key point in this modern style of forking is that the fork is not meant for competing distribution, but for parallel *open* development, and is kept synchronized with the main trunk: any commit to the main trunk is mirrored to the fork.

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: is "fork" a 4-letter word?

Post by Acyd Burn »

Funilly enough we are currently in the process of lining up something similar (without the bad word fork obviously), which boils down to having some aspects of what you "proposed" - our current draft for this is having Junior Developers which are basically "selected" people which we know are capable but not able to be added to the dev team (currently or never) for whatever reason. I understand that yours is quite more open in the sense of not people selected by us but people saying: "hey, i am able to do this", which may work out better. Our proposal for the patch review process includes a special forum here for the main devs to discuss an eligable patch and other people able to discuss and test the patch (QA team for example).

At the moment i like this discussion, please go on.

edit: one key "problem" (maybe not so much of a problem, but something you need to keep in mind) is IP/copyright. Currently, every developer agreed to have his work automatically assigned to the entity "phpBB Group" to mitigate copyright problems later. For such an open group, credits need to be collected on a central place within the product (similar to the AUTHORS file), but the copyright assigned to the phpBB Group.

Image

code reader
Registered User
Posts: 653
Joined: Wed Sep 21, 2005 3:01 pm

Re: is "fork" a 4-letter word?

Post by code reader »

Acyd Burn wrote: At the moment i like this discussion, please go on.

edit: one key "problem" (maybe not so much of a problem, but something you need to keep in mind) is IP/copyright. Currently, every developer agreed to have his work automatically assigned to the entity "phpBB Group" to mitigate copyright problems later. For such an open group, credits need to be collected on a central place within the product (similar to the AUTHORS file), but the copyright assigned to the phpBB Group.
thanks for the encouragement.
proposed mechanism:
  • use git-svn to create a git mirror of repo
  • clone repo on a git public hosting site (say, , with "mob" branch enabled
  • keep cloned repo synchronized to main repo (this will be done by the "maintainer" of the fork, not necessarily by a team member)
  • need more discussions about push/pull to main repo.
as to copyright:
i didn't even think about this issue. presumably, if everything is GPL'ed, there should be no harm if different parts of the project are copyrighted to different people. am i wrong here?
i know that at least some projects have no problem with this mode. every source file (or "module") is copyrighted to the person who started it, but all are under GPL. once you placed your code under GPL, you pretty much relinquish all rights to it except one: that this code should not be co-opted to non-gpl product/project without your permission.
i suppose there should be no problem if you make it clear from the get-go that in order for a branch to be merged upstream the copyright should belong to phpbb group. this way, authors can choose to relinquish copyright and opt for upstream inclusion, or keep their copyright with the understanding that this piece can only be used as MOD.

personally, i don't understand why you should insist on owning the copyright for every single piece of the project (and i'm not sure you even can do so, because part of phpbb were co-opted from other places).
for instance:
functions_template.php wrote:* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
i guess you could use this format for anything co-opted from the "fork" also.

in any event, this seems like counting the chicks befaore the eggs hatched: it is perfectly possible that there will be no useful stuff on the fork.
the only way to test for it is to create this "fork" thing and see if any useful contributions materialize.

currently i'm trying to set up something like this. will update once i lean enough to do it...

code reader
Registered User
Posts: 653
Joined: Wed Sep 21, 2005 3:01 pm

Re: is "fork" a 4-letter word?

Post by code reader »

ok. here goes:

you can look at http://repo.or.cz/w/phpbb.git

this repo contains the full history of the main trunk of phpbb (unfortunately not including any of the branches. i might rectify it in the future)
the way you work with git is a little different than the way you work with svn: you don't need a "commit" right to the global repository. instead, you "clone" the global repo to your own machine, and work against your local repo.
some of the the neat features of git is the ease of branching and merging, the unf***believable speed (more so on *nix/macosX. it is slower on windoze, but still incomparably faster than svn).
another interesting thing is, that with git's entire history on your local machine, it still takes less space than SVN parasite directories on the client side.

anyone who wishes to have "push" credential to the repo should first go to repo.or.cz, register as a user, and then email me at phpbb_git () yahoo dot com, and i will grant you the credentials.
theoretically it is also possible to push stuff onto the "mob" branch without any credentials, but i'm still learning how does this work...
one neat feature of repo.or.cz is that it allows anyone to "fork" the repo, which basically means that if i disappear from the face of the earth tomorrow, you can clone my fork onto your fork, and continue from there.

if the whole of repo.or.cz disappears, still every one who uses it has a full copy of the repo on their machine.

i intend to create a branch and commit some of my local changes some time soon, but there's no need to wait for me. every one can do it for themselves.

all you need if you want to participate in the festivities is git.
if you are a linux user chances are you already have it. if not, get it (preferably from your distro, if there's a problem, you can always get it from git.or.cz )

if you use windoze, you probably want to look here:
http://code.google.com/p/msysgit/

(ATTN: on windoze, if you want to use git-svn, don't use msysgit 1.5.6: git-svn is seriously broken there. use 1.5.5)

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: is "fork" a 4-letter word?

Post by Acyd Burn »

code reader wrote: as to copyright:
i didn't even think about this issue. presumably, if everything is GPL'ed, there should be no harm if different parts of the project are copyrighted to different people. am i wrong here?
You are mixing the license up with the copyright. ;) We do not want a case where a team member occasionally sues phpBB and requests removal of his code. ;)
once you placed your code under GPL, you pretty much relinquish all rights to it except one: that this code should not be co-opted to non-gpl product/project without your permission.
Again you are mixing the license up with intelectual property/copyright...
i suppose there should be no problem if you make it clear from the get-go that in order for a branch to be merged upstream the copyright should belong to phpbb group. this way, authors can choose to relinquish copyright and opt for upstream inclusion, or keep their copyright with the understanding that this piece can only be used as MOD.
Yes, the author of course need to approve this - in some countries even signing a paper. ;) This is partly much more complicated than it looks like.

Image

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: is "fork" a 4-letter word?

Post by Acyd Burn »

code reader wrote:ok. here goes:

you can look at http://repo.or.cz/w/phpbb.git

this repo contains the full history of the main trunk of phpbb (unfortunately not including any of the branches. i might rectify it in the future)
the way you work with git is a little different than the way you work with svn: [...]
The people working on a work are free to choose whatever they like. The patches submitted for approval to be merged to the upstream though need to be in context diff format or another compatible format - because as said... there will be only SVN.

Also... i said... go on with the discussion. ;) This was not meant as: "yes, sure, do it, you have the phpBB Groups approval, we will support you". ;)

Image

code reader
Registered User
Posts: 653
Joined: Wed Sep 21, 2005 3:01 pm

Re: is "fork" a 4-letter word?

Post by code reader »

Acyd Burn wrote:You are mixing the license up with the copyright. ;) We do not want a case where a team member occasionally sues phpBB and requests removal of his code. ;)
ianal, but i don't believe this is possible.
once you release something under the gpl license, you can't revoke it later.
holding the copyright means, in my understanding, that if you want to use it later under different type of license, you can, while someone else, who doesn't hold the copyright, can't.
however, as long as the software in question was originally released under gpl, there is nothing the copyright holder can do to prevent you from doing whatever you want with it, as long as you do not release it or sell it with a different license.
if my understanding is correct (and i believe it is) then phpbb should have no problem including pieces copyrighted to someone else, as long as those pieces were release under gpl.
all the above, of course, goes to crap if/when phpbb will want to change its license. i hope this will never happen, and i will be greatly disappointed with the project if it ever will.
Acyd Burn wrote:The patches submitted for approval to be merged to the upstream though need to be in context diff format or another compatible format - because as said... there will be only SVN.
sure. git has no problems creating the patches in any reasonable format, and "diff context format" is the most natural one git uses. i believe that if you don't configure it at all and use no command-line arguments to the "git diff" command, the result will be a context diff.
for instance, here is the output of the command
user@phpbb % git diff HEAD^..HEAD
(HEAD^ is gitt'ish for "one before head". you could also write HEAD^^^ for "3 before head"):

Code: Select all

diff --git a/develop/create_schema_files.php b/develop/create_schema_files.php
index 58057df..67c58e5 100644
--- a/develop/create_schema_files.php
+++ b/develop/create_schema_files.php
@@ -699,7 +699,7 @@ foreach ($supported_dbms as $dbms)
 						}
 
 						$line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : '';
-						
+
 						$line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ")\n";
 						$line .= "/\n";
 					break;
@@ -1032,7 +1032,7 @@ function get_schema_struct()
 			'topic_id'			=> array('UINT', 0),
 			'forum_id'			=> array('UINT', 0),
 			'save_time'			=> array('TIMESTAMP', 0),
-			'draft_subject'		=> array('XSTEXT_UNI', ''),
+			'draft_subject'		=> array('STEXT_UNI', ''),
 			'draft_message'		=> array('MTEXT_UNI', ''),
 		),
 		'PRIMARY_KEY'	=> 'draft_id',
@@ -1094,7 +1094,7 @@ function get_schema_struct()
 			'forum_topics_real'		=> array('UINT', 0),
 			'forum_last_post_id'	=> array('UINT', 0),
 			'forum_last_poster_id'	=> array('UINT', 0),
-			'forum_last_post_subject' => array('XSTEXT_UNI', ''),
+			'forum_last_post_subject' => array('STEXT_UNI', ''),
 			'forum_last_post_time'	=> array('TIMESTAMP', 0),
 			'forum_last_poster_name'=> array('VCHAR_UNI', ''),
 			'forum_last_poster_colour'=> array('VCHAR:6', ''),
@@ -1308,7 +1308,7 @@ function get_schema_struct()
 			'enable_magic_url'		=> array('BOOL', 1),
 			'enable_sig'			=> array('BOOL', 1),
 			'post_username'			=> array('VCHAR_UNI:255', ''),
-			'post_subject'			=> array('XSTEXT_UNI', '', 'true_sort'),
+			'post_subject'			=> array('STEXT_UNI', '', 'true_sort'),
 			'post_text'				=> array('MTEXT_UNI', ''),
 			'post_checksum'			=> array('VCHAR:32', ''),
 			'post_attachment'		=> array('BOOL', 0),
@@ -1344,7 +1344,7 @@ function get_schema_struct()
 			'enable_smilies'		=> array('BOOL', 1),
 			'enable_magic_url'		=> array('BOOL', 1),
 			'enable_sig'			=> array('BOOL', 1),
-			'message_subject'		=> array('XSTEXT_UNI', ''),
+			'message_subject'		=> array('STEXT_UNI', ''),
 			'message_text'			=> array('MTEXT_UNI', ''),
 			'message_edit_reason'	=> array('STEXT_UNI', ''),
 			'message_edit_user'		=> array('UINT', 0),
@@ -1562,6 +1562,7 @@ function get_schema_struct()
 		'KEYS'			=> array(
 			'session_time'		=> array('INDEX', 'session_time'),
 			'session_user_id'	=> array('INDEX', 'session_user_id'),
+			'session_fid'		=> array('INDEX', 'session_forum_id'),
 		),
 	);
 
@@ -1707,7 +1708,7 @@ function get_schema_struct()
 			'topic_attachment'			=> array('BOOL', 0),
 			'topic_approved'			=> array('BOOL', 1),
 			'topic_reported'			=> array('BOOL', 0),
-			'topic_title'				=> array('XSTEXT_UNI', '', 'true_sort'),
+			'topic_title'				=> array('STEXT_UNI', '', 'true_sort'),
 			'topic_poster'				=> array('UINT', 0),
 			'topic_time'				=> array('TIMESTAMP', 0),
 			'topic_time_limit'			=> array('TIMESTAMP', 0),
@@ -1723,7 +1724,7 @@ function get_schema_struct()
 			'topic_last_poster_id'		=> array('UINT', 0),
 			'topic_last_poster_name'	=> array('VCHAR_UNI', ''),
 			'topic_last_poster_colour'	=> array('VCHAR:6', ''),
-			'topic_last_post_subject'	=> array('XSTEXT_UNI', ''),
+			'topic_last_post_subject'	=> array('STEXT_UNI', ''),
 			'topic_last_post_time'		=> array('TIMESTAMP', 0),
 			'topic_last_view_time'		=> array('TIMESTAMP', 0),
 			'topic_moved_id'			=> array('UINT', 0),
diff --git a/docs/AUTHORS b/docs/AUTHORS
index 19bbda8..49281e2 100644
--- a/docs/AUTHORS
+++ b/docs/AUTHORS
@@ -22,13 +22,15 @@ involved in phpBB.
 
 phpBB Lead Developer  : Acyd Burn (Meik Sievertsen)
 
-phpBB Developers      : DavidMJ (David M.)
+phpBB Developers      : APTX (Marek A. R.)
+                        DavidMJ (David M.)
                         dhn (Dominik Dr�scher)
                         kellanved (Henry Sudhof)
                         naderman (Nils Adermann)
-                        subBlue (Tom Beddard)
+                        ToonArmy (Chris Smith)
                         Vic D'Elfant (Vic D'Elfant)
 
+
 -- Previous Contributors --
 
 phpBB Project Manager : theFinn (James Atkinson) [Founder - 04/2007]
diff --git a/includes/functions.php b/includes/functions.php
index 099e680..7eba95e 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -745,7 +745,7 @@ function tz_select($default = '', $truncate = false)
 	{
 		if ($truncate)
 		{
-			$zone_trunc = truncate_string($zone, 50, false, '...');
+			$zone_trunc = truncate_string($zone, 50, 255, false, '...');
 		}
 		else
 		{
diff --git a/includes/functions_content.php b/includes/functions_content.php
index 73ab553..bc31bf4 100644
--- a/includes/functions_content.php
+++ b/includes/functions_content.php
@@ -435,6 +435,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags)
 function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false)
 {
 	$uid = $bitfield = '';
+	$flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0);
 
 	if (!$text)
 	{
@@ -458,7 +459,6 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
 		$uid = '';
 	}
 
-	$flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0);
 	$bitfield = $message_parser->bbcode_bitfield;
 
 	return;
@@ -563,7 +563,7 @@ function make_clickable_callback($type, $whitespace, $url, $relative_url, $class
 			$relative_url	= preg_replace('/[&?]sid=[0-9a-f]{32}$/', '', preg_replace('/([&?])sid=[0-9a-f]{32}&/', '$1', $relative_url));
 			$url			= $url . '/' . $relative_url;
 			$text			= $relative_url;
-			
+
 			// this url goes to http://domain.tld/path/to/board/ which
 			// would result in an empty link if treated as local so
 			// don't touch it and let MAGIC_URL_FULL take care of it.
@@ -1062,8 +1062,16 @@ function extension_allowed($forum_id, $extension, &$extensions)
 /**
 * Truncates string while retaining special characters if going over the max length
 * The default max length is 60 at the moment
+* The maximum storage length is there to fit the string within the given length. The string may be further truncated due to html entities.
+* For example: string given is 'a "quote"' (length: 9), would be a stored as 'a "quote"' (length: 19)
+*
+* @param string $string The text to truncate to the given length. String is specialchared.
+* @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char)
+* @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars).
+* @param bool $allow_reply Allow Re: in front of string
+* @param string $append String to be appended
 */
-function truncate_string($string, $max_length = 60, $allow_reply = true, $append = '')
+function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = true, $append = '')
 {
 	$chars = array();
 
@@ -1086,6 +1094,21 @@ function truncate_string($string, $max_length = 60, $allow_reply = true, $append
 		$stripped = true;
 	}
 
+	// Due to specialchars, we may not be able to store the string...
+	if (utf8_strlen($string) > $max_store_length)
+	{
+		// let's split again, we do not want half-baked strings where entities are split
+		$_chars = utf8_str_split(htmlspecialchars_decode($string));
+		$chars = array_map('utf8_htmlspecialchars', $_chars);
+
+		do
+		{
+			array_pop($chars);
+			$string = implode('', $chars);
+		}
+		while (utf8_strlen($string) > $max_store_length || !sizeof($chars));
+	}
+
 	if ($strip_reply)
 	{
 		$string = 'Re: ' . $string;
diff --git a/includes/functions_convert.php b/includes/functions_convert.php
index 592fcf1..7a28cc2 100644
--- a/includes/functions_convert.php
+++ b/includes/functions_convert.php
@@ -148,7 +148,7 @@ function auto_id($pad = 0)
 	{
 		return $convert_row['max_id'] + $pad;
 	}
-	
+
 	return $auto_id + $pad;
 }
 
@@ -280,7 +280,7 @@ function get_config_value($config_name)
 	{
 		$convert_config = get_config();
 	}
-	
+
 	if (!isset($convert_config[$config_name]))
 	{
 		return false;
@@ -669,12 +669,12 @@ function import_avatar($source, $use_target = false, $user_id = false)
 	{
 		$convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'import_avatar()'), __LINE__, __FILE__);
 	}
-	
+
 	if ($use_target === false && $user_id !== false)
 	{
 		$use_target = $config['avatar_salt'] . '_' . $user_id . '.' . substr(strrchr($source, '.'), 1);
 	}
-	
+
 	$result = _import_check('avatar_path', $source, $use_target);
 
 	return ((!empty($user_id)) ? $user_id : $use_target) . '.' . substr(strrchr($source, '.'), 1);
@@ -946,7 +946,7 @@ function get_remote_avatar_dim($src, $axis)
 		unset($remote_avatar_cache);
 		return $retval;
 	}
-	
+
 	$url_info = @parse_url($src);
 	if (empty($url_info['host']))
 	{
@@ -962,19 +962,19 @@ function get_remote_avatar_dim($src, $axis)
 			case 'ftp':
 				$port = 21;
 				break;
-				
+
 			case 'https':
 				$port = 443;
 				break;
-			
+
 			default:
 				$port = 80;
 		}
 	}
-	
+
 	$timeout = @ini_get('default_socket_timeout');
 	@ini_set('default_socket_timeout', 2);
-	
+
 	// We're just trying to reach the server to avoid timeouts
 	$fp = @fsockopen($host, $port, $errno, $errstr, 1);
 	if ($fp)
@@ -982,11 +982,11 @@ function get_remote_avatar_dim($src, $axis)
 		$remote_avatar_cache[$src] = @getimagesize($src);
 		fclose($fp);
 	}
-	
+
 	$default_x 	= (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X;
 	$default_y 	= (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y;
 	$default 	= array($default_x, $default_y);
-	
+
 	if (empty($remote_avatar_cache[$src]) || empty($remote_avatar_cache[$src][0]) || empty($remote_avatar_cache[$src][1]))
 	{
 		$remote_avatar_cache[$src] = $default;
@@ -1002,7 +1002,7 @@ function get_remote_avatar_dim($src, $axis)
 			$remote_avatar_cache[$src][1] = (int)($remote_avatar_cache[$src][1] * $ratio);
 		}
 	}
-	
+
 	@ini_set('default_socket_timeout', $timeout);
 	return $remote_avatar_cache[$src][$axis];
 }
@@ -1112,7 +1112,7 @@ function words_unique(&$words)
 function add_user_group($group_id, $user_id, $group_leader=false)
 {
 	global $convert, $config, $user, $db;
-	
+
 	$sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array(
 		'group_id'		=> $group_id,
 		'user_id'		=> $user_id,
@@ -1282,7 +1282,7 @@ function restore_config($schema)
 			// Most are...
 			if (is_string($config_value))
 			{
-				$config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, false);
+				$config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, 255, false);
 			}
 
 			set_config($config_name, $config_value);
@@ -2440,7 +2440,7 @@ function get_smiley_display()
 function fill_dateformat($user_dateformat)
 {
 	global $config;
-	
+
 	return ((empty($user_dateformat)) ? $config['default_dateformat'] : $user_dateformat);
 }
 
diff --git a/includes/functions_posting.php b/includes/functions_posting.php
index d35cb44..e59ecca 100644
--- a/includes/functions_posting.php
+++ b/includes/functions_posting.php
@@ -360,7 +360,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
 	{
 		$upload->set_disallowed_content(explode('|', $config['mime_triggers']));
 	}
-	
+
 	if (!$local)
 	{
 		$filedata['post_attach'] = ($upload->is_valid($form_name)) ? true : false;
@@ -1340,7 +1340,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
 	else if ($data['topic_first_post_id'] == $post_id)
 	{
 		$post_mode = 'delete_first_post';
-	} 
+	}
 	else if ($data['topic_last_post_id'] == $post_id)
 	{
 		$post_mode = 'delete_last_post';
@@ -1646,7 +1646,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
 			// Display edit info if edit reason given or user is editing his post, which is not the last within the topic.
 			if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post')))
 			{
-				$data['post_edit_reason']		= truncate_string($data['post_edit_reason'], 255, false);
+				$data['post_edit_reason']		= truncate_string($data['post_edit_reason'], 255, 255, false);
 
 				$sql_data[POSTS_TABLE]['sql']	= array(
 					'post_edit_time'	=> $current_time,
diff --git a/includes/functions_user.php b/includes/functions_user.php
index 59fdc0a..ba77a56 100644
--- a/includes/functions_user.php
+++ b/includes/functions_user.php
@@ -733,70 +733,65 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
 		case 'user':
 			$type = 'ban_userid';
 
-			if (in_array('*', $ban_list))
-			{
-				// Ban all users (it's a good thing that you can exclude people)
-				$banlist_ary[] = '*';
-			}
-			else
-			{
-				// Select the relevant user_ids.
-				$sql_usernames = array();
+			// At the moment we do not support wildcard username banning
+
+			// Select the relevant user_ids.
+			$sql_usernames = array();
 
-				foreach ($ban_list as $username)
+			foreach ($ban_list as $username)
+			{
+				$username = trim($username);
+				if ($username != '')
 				{
-					$username = trim($username);
-					if ($username != '')
+					$clean_name = utf8_clean_string($username);
+					if ($clean_name == $user->data['username_clean'])
 					{
-						$clean_name = utf8_clean_string($username);
-						if ($clean_name == $user->data['username_clean'])
-						{
-							trigger_error('CANNOT_BAN_YOURSELF', E_USER_WARNING);
-						}
-						if (in_array($clean_name, $founder_names))
-						{
-							trigger_error('CANNOT_BAN_FOUNDER', E_USER_WARNING);
-						}
-						$sql_usernames[] = $clean_name;
+						trigger_error('CANNOT_BAN_YOURSELF', E_USER_WARNING);
+					}
+					if (in_array($clean_name, $founder_names))
+					{
+						trigger_error('CANNOT_BAN_FOUNDER', E_USER_WARNING);
 					}
+					$sql_usernames[] = $clean_name;
 				}
+			}
 
-				// Make sure we have been given someone to ban
-				if (!sizeof($sql_usernames))
-				{
-					trigger_error('NO_USER_SPECIFIED');
-				}
+			// Make sure we have been given someone to ban
+			if (!sizeof($sql_usernames))
+			{
+				trigger_error('NO_USER_SPECIFIED');
+			}
 
-				$sql = 'SELECT user_id
-					FROM ' . USERS_TABLE . '
-					WHERE ' . $db->sql_in_set('username_clean', $sql_usernames);
+			$sql = 'SELECT user_id
+				FROM ' . USERS_TABLE . '
+				WHERE ' . $db->sql_in_set('username_clean', $sql_usernames);
 
-				// Do not allow banning yourself
-				if (sizeof($founder))
-				{
-					$sql .= ' AND ' . $db->sql_in_set('user_id', array_merge(array_keys($founder), array($user->data['user_id'])), true);
-				}
-				else
-				{
-					$sql .= ' AND user_id <> ' . $user->data['user_id'];
-				}
+			// Do not allow banning yourself
+			if (sizeof($founder))
+			{
+				$sql .= ' AND ' . $db->sql_in_set('user_id', array_merge(array_keys($founder), array($user->data['user_id'])), true);
+			}
+			else
+			{
+				$sql .= ' AND user_id <> ' . $user->data['user_id'];
+			}
 
-				$result = $db->sql_query($sql);
+			$result = $db->sql_query($sql);
 
-				if ($row = $db->sql_fetchrow($result))
-				{
-					do
-					{
-						$banlist_ary[] = (int) $row['user_id'];
-					}
-					while ($row = $db->sql_fetchrow($result));
-				}
-				else
+			if ($row = $db->sql_fetchrow($result))
+			{
+				do
 				{
-					trigger_error('NO_USERS');
+					$banlist_ary[] = (int) $row['user_id'];
 				}
+				while ($row = $db->sql_fetchrow($result));
+			}
+			else
+			{
 				$db->sql_freeresult($result);
+				trigger_error('NO_USERS');
 			}
+			$db->sql_freeresult($result);
 		break;
 
 		case 'ip':
@@ -996,7 +991,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
 			switch ($mode)
 			{
 				case 'user':
-					$sql_where = (in_array('*', $banlist_ary)) ? '' : 'WHERE ' . $db->sql_in_set('session_user_id', $banlist_ary);
+					$sql_where = 'WHERE ' . $db->sql_in_set('session_user_id', $banlist_ary);
 				break;
 
 				case 'ip':
@@ -2850,7 +2845,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
 	{
 		case 'demote':
 		case 'promote':
-		
+
 			$sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . "
 				WHERE group_id = $group_id
 					AND user_pending = 1
@@ -2862,7 +2857,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
 			{
 				return 'NO_VALID_USERS';
 			}
-			
+
 			$sql = 'UPDATE ' . USER_GROUP_TABLE . '
 				SET group_leader = ' . (($action == 'promote') ? 1 : 0) . "
 				WHERE group_id = $group_id
diff --git a/includes/message_parser.php b/includes/message_parser.php
index d9c5dba..a31e7b0 100644
--- a/includes/message_parser.php
+++ b/includes/message_parser.php
@@ -400,7 +400,10 @@ class bbcode_firstpass extends bbcode
 			case 'php':
 
 				$remove_tags = false;
-				$code = str_replace(array('<', '>'), array('<', '>'), $code);
+
+				$str_from = array('<', '>', '&#91;', '&#93;', '&#46;', '&#58;', '&#058;');
+				$str_to = array('<', '>', '[', ']', '.', ':', ':');
+				$code = str_replace($str_from, $str_to, $code);
 
 				if (!preg_match('/\<\?.*?\?\>/is', $code))
 				{
diff --git a/includes/session.php b/includes/session.php
index a3a3a60..14c2171 100644
--- a/includes/session.php
+++ b/includes/session.php
@@ -1113,6 +1113,14 @@ class session
 			// To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again
 			$this->session_kill(false);
 
+			// A very special case... we are within the cron script which is not supposed to print out the ban message... show blank page
+			if (defined('IN_CRON'))
+			{
+				garbage_collection();
+				exit_handler();
+				exit;
+			}
+
 			trigger_error($message);
 		}
 
@@ -1582,6 +1590,7 @@ class user extends session
 				$localised_images = true;
 			}
 
+			$row['image_filename'] = rawurlencode($row['image_filename']);
 			$this->img_array[$row['image_name']] = $row;
 		}
 		$db->sql_freeresult($result);
diff --git a/install/database_update.php b/install/database_update.php
index 627049f..a98bb7e 100644
--- a/install/database_update.php
+++ b/install/database_update.php
@@ -8,7 +8,7 @@
 *
 */
 
-$updates_to_version = '3.1.0';
+$updates_to_version = '3.0.2-RC2';
 
 // Return if we "just include it" to find out for which version the database update is responsuble for
 if (defined('IN_PHPBB') && defined('IN_INSTALL'))
@@ -699,7 +699,7 @@ $cache->purge();
 		</div>
 		</div>
 	</div>
-	
+
 	<div id="page-footer">
 		Powered by phpBB &copy; 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>
 	</div>
diff --git a/install/schemas/schema_data.php b/install/schemas/schema_data.php
index 1383e91..53bd638 100644
--- a/install/schemas/schema_data.php
+++ b/install/schemas/schema_data.php
@@ -205,7 +205,7 @@ $schema_data['phpbb_drafts'] = array(
 		'topic_id'			=> array('UINT', 0),
 		'forum_id'			=> array('UINT', 0),
 		'save_time'			=> array('TIMESTAMP', 0),
-		'draft_subject'		=> array('XSTEXT_UNI', ''),
+		'draft_subject'		=> array('STEXT_UNI', ''),
 		'draft_message'		=> array('MTEXT_UNI', ''),
 	),
 	'PRIMARY_KEY'	=> 'draft_id',
@@ -267,7 +267,7 @@ $schema_data['phpbb_forums'] = array(
 		'forum_topics_real'		=> array('UINT', 0),
 		'forum_last_post_id'	=> array('UINT', 0),
 		'forum_last_poster_id'	=> array('UINT', 0),
-		'forum_last_post_subject' => array('XSTEXT_UNI', ''),
+		'forum_last_post_subject' => array('STEXT_UNI', ''),
 		'forum_last_post_time'	=> array('TIMESTAMP', 0),
 		'forum_last_poster_name'=> array('VCHAR_UNI', ''),
 		'forum_last_poster_colour'=> array('VCHAR:6', ''),
@@ -482,7 +482,7 @@ $schema_data['phpbb_posts'] = array(
 		'enable_magic_url'		=> array('BOOL', 1),
 		'enable_sig'			=> array('BOOL', 1),
 		'post_username'			=> array('VCHAR_UNI:255', ''),
-		'post_subject'			=> array('XSTEXT_UNI', '', 'true_sort'),
+		'post_subject'			=> array('STEXT_UNI', '', 'true_sort'),
 		'post_text'				=> array('MTEXT_UNI', ''),
 		'post_checksum'			=> array('VCHAR:32', ''),
 		'post_attachment'		=> array('BOOL', 0),
@@ -518,7 +518,7 @@ $schema_data['phpbb_privmsgs'] = array(
 		'enable_smilies'		=> array('BOOL', 1),
 		'enable_magic_url'		=> array('BOOL', 1),
 		'enable_sig'			=> array('BOOL', 1),
-		'message_subject'		=> array('XSTEXT_UNI', ''),
+		'message_subject'		=> array('STEXT_UNI', ''),
 		'message_text'			=> array('MTEXT_UNI', ''),
 		'message_edit_reason'	=> array('STEXT_UNI', ''),
 		'message_edit_user'		=> array('UINT', 0),
@@ -736,7 +736,8 @@ $schema_data['phpbb_sessions'] = array(
 	'PRIMARY_KEY'	=> 'session_id',
 	'KEYS'			=> array(
 		'session_time'		=> array('INDEX', 'session_time'),
-		'session_user_id'	=> array('INDEX', 'session_user_id'),
+		'session_uid'		=> array('INDEX', 'session_user_id'),
+		'session_fid'		=> array('INDEX', 'session_forum_id'),
 	),
 );
 
@@ -882,7 +883,7 @@ $schema_data['phpbb_topics'] = array(
 		'topic_attachment'			=> array('BOOL', 0),
 		'topic_approved'			=> array('BOOL', 1),
 		'topic_reported'			=> array('BOOL', 0),
-		'topic_title'				=> array('XSTEXT_UNI', '', 'true_sort'),
+		'topic_title'				=> array('STEXT_UNI', '', 'true_sort'),
 		'topic_poster'				=> array('UINT', 0),
 		'topic_time'				=> array('TIMESTAMP', 0),
 		'topic_time_limit'			=> array('TIMESTAMP', 0),
@@ -898,7 +899,7 @@ $schema_data['phpbb_topics'] = array(
 		'topic_last_poster_id'		=> array('UINT', 0),
 		'topic_last_poster_name'	=> array('VCHAR_UNI', ''),
 		'topic_last_poster_colour'	=> array('VCHAR:6', ''),
-		'topic_last_post_subject'	=> array('XSTEXT_UNI', ''),
+		'topic_last_post_subject'	=> array('STEXT_UNI', ''),
 		'topic_last_post_time'		=> array('TIMESTAMP', 0),
 		'topic_last_view_time'		=> array('TIMESTAMP', 0),
 		'topic_moved_id'			=> array('UINT', 0),
diff --git a/search.php b/search.php
index 825beac..13f82cf 100644
--- a/search.php
+++ b/search.php
@@ -88,7 +88,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
 	if ($search_id == 'egosearch')
 	{
 		$author_id = $user->data['user_id'];
-		
+
 		if ($user->data['user_id'] == ANONYMOUS)
 		{
 			login_box('', $user->lang['LOGIN_EXPLAIN_EGOSEARCH']);
@@ -466,6 +466,9 @@ if ($keywords || $author || $author_id || $search_id || $submit)
 
 	// define some vars for urls
 	$hilit = implode('|', explode(' ', preg_replace('#\s+#u', ' ', str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords))));
+	// Do not allow *only* wildcard being used for hilight
+	$hilit = (strspn($hilit, '*') === strlen($hilit)) ? '' : $hilit;
+
 	$u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit)));
 	$u_show_results = ($show_results != 'posts') ? '&sr=' . $show_results : '';
 	$u_search_forum = implode('&fid%5B%5D=', $search_forum);
@@ -600,18 +603,18 @@ if ($keywords || $author || $author_id || $search_id || $submit)
 					FROM ' . TOPICS_TABLE . '
 					WHERE ' . $db->sql_in_set('topic_id', array_keys($shadow_topic_list));
 				$result = $db->sql_query($sql);
-			
+
 				while ($row = $db->sql_fetchrow($result))
 				{
 					$orig_topic_id = $shadow_topic_list[$row['topic_id']];
-			
+
 					// We want to retain some values
 					$row = array_merge($row, array(
 						'topic_moved_id'	=> $rowset[$orig_topic_id]['topic_moved_id'],
 						'topic_status'		=> $rowset[$orig_topic_id]['topic_status'],
 						'forum_name'		=> $rowset[$orig_topic_id]['forum_name'])
 					);
-			
+
 					$rowset[$orig_topic_id] = $row;
 				}
 				$db->sql_freeresult($result);
@@ -627,7 +630,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
 				else if ($config['load_anon_lastread'] || $user->data['is_registered'])
 				{
 					$topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list'], ($forum_id) ? false : $forum['topic_list']);
-		
+
 					if (!$user->data['is_registered'])
 					{
 						$user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0;
@@ -708,7 +711,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
 						AND in_message = 0
 					ORDER BY filetime DESC, post_msg_id ASC';
 				$result = $db->sql_query($sql);
-		
+
 				while ($row = $db->sql_fetchrow($result))
 				{
 					$attachments[$row['post_msg_id']][] = $row;
@@ -742,12 +745,12 @@ if ($keywords || $author || $author_id || $search_id || $submit)
 				{
 					// Get a list of forums the user cannot read
 					$forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true)));
-	
+
 					// Determine first forum the user is able to read (must not be a category)
 					$sql = 'SELECT forum_id
 						FROM ' . FORUMS_TABLE . '
 						WHERE forum_type = ' . FORUM_POST;
-		
+
 					if (sizeof($forum_ary))
 					{
 						$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
@@ -856,7 +859,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
 					if (!empty($attachments[$row['post_id']]))
 					{
 						parse_attachments($forum_id, $row['post_text'], $attachments[$row['post_id']], $update_count);
-				
+
 						// we only display inline attachments
 						unset($attachments[$row['post_id']]);
 					}
@@ -874,7 +877,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
 					'POST_AUTHOR_COLOUR'	=> get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
 					'POST_AUTHOR'			=> get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
 					'U_POST_AUTHOR'			=> get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
-				
+
 					'POST_SUBJECT'		=> $row['post_subject'],
 					'POST_DATE'			=> (!empty($row['post_time'])) ? $user->format_date($row['post_time']) : '',
 					'MESSAGE'			=> $row['post_text']
diff --git a/styles/prosilver/template/message_body.html b/styles/prosilver/template/message_body.html
index eac7aeb..896f0b8 100644
--- a/styles/prosilver/template/message_body.html
+++ b/styles/prosilver/template/message_body.html
@@ -4,7 +4,7 @@
 	<div class="inner"><span class="corners-top"><span></span></span>
 	<h2>{MESSAGE_TITLE}</h2>
 	<p>{MESSAGE_TEXT}</p>
-	<!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH --><p><a href="{U_SEARCH}" class="{S_CONTENT_FLOW_BEGIN}">{L_RETURN_TO_SEARCH_ADV}</a></p><!-- ENDIF -->
+	<!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH and L_RETURN_TO_SEARCH_ADV --><p><a href="{U_SEARCH}" class="{S_CONTENT_FLOW_BEGIN}">{L_RETURN_TO_SEARCH_ADV}</a></p><!-- ENDIF -->
 	<span class="corners-bottom"><span></span></span></div>
 </div>
 
diff --git a/styles/subsilver2/template/search_results.html b/styles/subsilver2/template/search_results.html
index 7977665..d277b51 100644
--- a/styles/subsilver2/template/search_results.html
+++ b/styles/subsilver2/template/search_results.html
@@ -35,7 +35,7 @@
 			</td>
 			<td class="row1">
 				<!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF -->
-				{topicrow.ATTACH_ICON_IMG} <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a>
+				{searchresults.ATTACH_ICON_IMG} <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a>
 				<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED -->
 					<a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a>&nbsp;
 				<!-- ENDIF -->
@@ -94,7 +94,7 @@
 						<td class="gensmall">
 							<div style="float: {S_CONTENT_FLOW_BEGIN};">
 							<!-- IF searchresults.POST_SUBJECT neq "" -->
-								&nbsp;<b>{L_POST_SUBJECT}:</b> <a href="{searchresults.U_VIEW_POST}">{searchresults.POST_SUBJECT}</a> 
+								&nbsp;<b>{L_POST_SUBJECT}:</b> <a href="{searchresults.U_VIEW_POST}">{searchresults.POST_SUBJECT}</a>
 							<!-- ELSE -->
 								[ <a href="{searchresults.U_VIEW_POST}">{L_JUMP_TO_POST}</a> ]
 							<!-- ENDIF -->
if this format is not good enough, there is a very rich set of formatting options. i'm sure we can come out with something workable.

Acyd Burn wrote:Also... i said... go on with the discussion. ;) This was not meant as: "yes, sure, do it, you have the phpBB Groups approval, we will support you". ;)
as mentioned earlier, by virtue of the gpl license, "approval" is not really the issue here. you already gave it to anyone seeking to do something similar to what i did by releasing your code under gpl in the first place.
what i wanted was some input and feedback, and after some input and feedback, both positive and negative, and more thought, i decided that the proof of the pudding is in the eating: let's set such a repo, and see if it attracts any activity. if it shrinks and dries, then "no harm no foul". if there will be some activity... well we'll see. if it attracts enough activity to create a "critical mass", well, that would be great...
for now i think of it as an experiment, and am grateful to the phpbb group, (in addition to my being grateful for the software itself), for allowing me this opportunity to publish this newly created repo.
thanks.


[EDIT] However, i do want to ask your approval for one thing: I would like to publish this repo in the "mod writers" forum in phpbb.com, but i won't do it if you ask me not to. (if you ignore this request, i guess i'll have to decide for myself...)
thanks again.[/EDIT]

SamG
Registered User
Posts: 1241
Joined: Fri Aug 31, 2001 6:35 pm

Re: is "fork" a 4-letter word?

Post by SamG »

This will be interesting to watch. I don't have the open development "ax to grind" that code reader has pretty consistently advocated, so I'm admittedly going to have to be sold on the change just as an observer. I consider that the burden of proof in this case is on those who wish to change the current phpBB development model to something "modern," so code reader's stepping up to the plate is a good first step.

My experience with upstream contributions is pretty well confined to single "umbrella" projects with easily defined sub-components, like Ubuntu and its flavors, so (rightly or wrongly) I see this as a novelty to the development process of a limited scope software product like phpBB. On the whole my experience with upstream feeds is mixed, and I think that part of the mixed experience is due to the mixed nature of the upstream flow itself. Stuff gets into the repositories that doesn't last a half hour on my test box due to errors, crashes, etc. My ability to commit to Ubuntu as a production desktop replacement for Windows in the workplace (outside personal use) is directly related not so much to core Ubuntu but to the markedly uneven flow upstream in the various creeks that feed the rivers (KDE. GNOME, etc.). SInce enough maturity and stability have developed in the Ubuntu family almost to seriously consider it as a Windows alternative for basic production computing in SOHO environments, for the first time I've introduce it on a production machine in a limited pilot program.

This ongoing testing and evaluation just across a single Linux distro family is a lot of work from an end user point of view, IMHO. It differs from phpBB because it is more complex by several orders of magnitude. But because of that difference, upstream feeds seem to me significantly less crucial to phpBB's development process and introduce new risks, I think.

So I for one will be interested in seeing if this "modern" development model (which reminds me a lot of how things worked in the hardware-driven communities of the late '70s and early '80s and so "modern" in some sort of symbolic sense rather than strictly speaking) takes shape. And if it does, whether it will result in a better phpBB or in competing projects.
"I hate trolls!" - Willow Ufgood

User avatar
DavidMJ
Registered User
Posts: 932
Joined: Thu Jun 16, 2005 1:14 am
Location: Great Neck, NY

Re: is "fork" a 4-letter word?

Post by DavidMJ »

For starters, there is no chance of a core dev being handed a mere diff with no context around it. A huge diff is fine so long as it represents changes that reflect a certain goal, do not expect us to integrate giant patches without knowing to what end you were changing phpBB. Also, I think I am in favor of discouraging patches that reflect changes in different subsystems without adequate cause, patches should be oriented towards some objective or at least a group of common objectives, this makes it much more reasonable to review the code (in my opinion).

We just spent a fair share of time moving to SVN from CVS, do not expect us to migrate again for yet unproven reasons.
Freedom from fear

Post Reply