Leider scheint von den Entwicklern keiner mehr die Newsgroup zu besuchen, deshalb poste ich meinen Newsgroup-Beitrag vom 28.07. hier nochmal - allerdings nicht übersetzt.
[quote]I'm not sure where to put those proposals best (better the forum, directly in bugtracker or here) - but I think the list is the best for now, as it is for the whole typo3 community and not only the german part.
I've installed mm_forum yesterday and tested it a bit as I plan to switch from phpBB to mm_forum. For importing the data I had to rewrite the import-tool a bit, as I had modified phpBB to work seamlessly with typo3, fe_users and fe_groups - so they didn't have to be importet. The import went surprisingly very good and everything is fine. I only had to skip the search-word tables, as they seemed to import forever and ever.
After "playing" around a bit and digging the code I have some proposals.
#### smilies #######################################
# 1. smilies don't get replaced as expected
------
Smilies only get replaced with the images if they are surrounded from whitespace. Not a bad concept, but smilies at the end of lines don't get replaced and smilies written directly one on another don't either. I suggest to either replace the pure smilie-matchcode or use a regular expression with some suitable rules.
# 2. images of replaced smilies are missing whitespaces around them
------
the replace-pattern for the smilies includes (as mentioned above) the whitespaces around the pattern - but the inserted images don't have them, so the smilies stuck ugly to the text.
# 3. handling of different smiley patterns for the same icon
------
I know it's common style to store every pattern with it's own icon in the db - even if the icon is several times the same. But this disallows for a sorted display of the smilies. The order of the smilies is sometimes a real pain and can not be influenced at all, despite of deleting all settings and create them from scratch in the desired order.
Therefore I propose to have only 1 DB-record for every smiley-icon and write all the replacement-codes divided with a separator in one single cell, like "🙂|:🙂:". I guess the typo3 common "|"-divider is quite suitable for that. This also allows for a little faster parsing as all patterns can be passed in one call as an array to str_replace.
# 4. alt-text of smilies
------
To get a little bit more correct in a semantic way - the alt-text of smilies should be the value of the field 'emoticon' which describes itself.
My modified parser-method would look like this:
------ class.tx_mmforum_postparser.php ------
function generate_smilies($text,$parent,$conf){
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'code,smile_url,emoticon',
'tx_mmforum_smilies',''
);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if(substr($conf['postparser.']['bb_code_path_smilie'],0,4) == 'EXT:') { // Is the Path includet with the EXT: Function ? $smiliepath = t3lib_div::getFileAbsFileName($conf['postparser.']['bb_code_path_smilie'].$row['smile_url'],1);
preg_match_all ( '/(typo3\/).*|(typo3conf\/).*/i', $smiliepath, $path);
$path = $path[0]; $smiliepath = $path[0]; }
else{
$smiliepath = $conf['postparser.']['bb_code_path_smilie'].$row['smile_url']; }
// here changed the alttext and added the possibility to add a special class to smilies for better alignment in text etc.
$smilieimage = '<img src="'.$smiliepath.'" alt="'.$row['emoticon'].'" class="'.$conf['postparser.']['bb_code_class_smilie'].'" />';
// here the change
$text = str_replace(explode('|',$row['code']),$smilieimage,$text);
}
return $text;
}
------------
#### BBCODE #######################################
# 1. a little much preg-calls in [quote]-substitution
-----
the method 'zitat' looks a little bit heavy in my eyes with a lot of 'preg_replace' calls, that could be done much simpler and more effective:
------ class.tx_mmforum_postparser.php -----
function zitat($text,$parent, $conf){
preg_match_all('/\[quote(:[a-zA-Z0-9]{10})?="([^\"]{1,30})"](.*?)\[\/quote(:[a-zA-Z0-9]{10})?\]/isS',$text,$quote_data);
if($matches = count($quote_data[0])) {
for($i = 0;$i < $matches;$i++){
$text = str_replace($quote_data[0][$i], '<blockquote class="'.$conf['postparser.']['quoteClass'].'">'.$quote_data[2][$i].' '.$parent->pi_getLL('quote_prefix').'<br />'.$quote_data[3][$i].'</blockquote>', $text);
}
}
$text = preg_replace('/\[\/quote(:[a-zA-Z0-9]{10})?]/isS', '</blockquote>', $text);
return $text;
}
-------------
As you can see, the whole method only needs 6 lines instead of about 30 like before 😉
# 2. semantics
-----
The BBcode '
' is currently replaced with a div - semantic more correct would be 'blockquote'. I also changed that in the code above.
#### HOOKS ####################################
The forum is missing some hooks for maybe some additional marker substitutions etc.
#### Messenger (PMs) ##########################
# 1. DB-layout
-----------------------------------------------I saw that messages are stored redundant - one for the sender - one for the reciever. Is that really necessary? The same functionality could be provided by simply adding two more fields to the db-table that hold the 'status' (inbox,outbox,archive,deleted) and the read_flag of the receiver.
Another possibility would be, to use a MM-table, that would also allow to send the same message to multiple recipients and maybe also allow to organize in userdefined folders.# 2. Formatting
-----------------------------------------------I guess BBCode support would also be nice for PMs. Shouldn't be hard to implement - right? At least quoting.
#### Flexibility ##############################
There is currently some flexibility in the rendering provided by some stdWraps etc. - but the flexibility is also quite limited. Let's take the method 'ident_user' of class.tx_mmforum_pi1. Here f.e. the real username is wrapped with a stdWrap, that currently allows to show or hide the realname by a TS-constant. But that's almost all it can, because the cObject that does the stdWrap doesn't have the data of the current user - so no user-related conditions can be made.
In my case - in the old forum the users had the possibility to decide them selfs if their username should be displayed or not. But this is currently not possible. The only thing that would have to be changed would be to use the $this->local_cObj instead $this->cObj and feed it with the userdata. Here the modified method that enables such flexiblity.
----- class.tx_mmforum_pi1.php ------------------ function ident_user($uid,$conf,$threadauthor=FALSE) { $imgInfo = array('border' => $conf['img_border'], 'alt' => '', 'src' => '', 'style' => ''); $user_array = tx_mmforum_tools::get_userdata($uid); $this->local_cObj->data = $user_array; $template = $this->cObj->fileResource($this->conf['template.']['list_post']); $template = $this->cObj->getSubpart($template, '###USERINFO###'); if($template) { if($user_array['tx_mmforum_avatar']) { $avatarConf = $this->conf['list_posts.']['userinfo.']['avatar_cObj.']; $avatarConf['file'] = $this->conf['path_avatar'].$user_array['tx_mmforum_avatar']; $avatar = $this->local_cObj->cObjGetSingle($this->conf['list_posts.']['userinfo.']['avatar_cObj'],$avatarConf); } else $avatar = ''; $marker = array( '###LLL_DELETED###' => $this->pi_getLL('user-deleted'), '###USERNAME###' => $this->local_cObj->stdWrap($user_array['username'],$this->conf['list_posts.']['userinfo.']['username_stdWrap.']), '###USERREALNAME###' => $this->local_cObj->stdWrap($user_array['name'],$this->conf['list_posts.']['userinfo.']['realname_stdWrap.']), '###USERRANKS###' => $this->get_userranking($uid,$conf), '###TOPICCREATOR###' => ($uid==$threadauthor)?$this->local_cObj->stdWrap($this->pi_getLL('topic-topicauthor'),$this->conf['list_posts.']['userinfo.']['creator_stdWrap.']):'', '###AVATAR###' => $avatar, '###LLL_REGSINCE###' => $this->pi_getLL('user-regSince'), '###LLL_POSTCOUNT###' => $this->pi_getLL('user-posts'), '###REGSINCE###' => date("d.m.Y",$user_array['crdate']), '###POSTCOUNT###' => intval($user_array['tx_mmforum_posts']) ); if($user_array === FALSE) $template = $this->cObj->substituteSubpart($template, '###USERINFO_REGULAR###', ''); else $template = $this->cObj->substituteSubpart($template, '###USERINFO_DELETED###', ''); $content .= $this->cObj->substituteMarkerArray($template, $marker); } else { if($user_array === FALSE) return '<strong>'.$this->pi_getLL('user.deleted').'</strong>'; $content = '<strong>'.$user_array['username'].'</strong><br />'; if($this->conf['list_posts.']['userinfo_realName'] && $user_array['name']) $content .= $this->local_cObj->wrap($user_array['name'], $this->conf['list_posts.']['userinfo_realName_wrap']); $userranking = $this->get_userranking($uid,$conf).'<br />'; if($uid == $threadauthor) $userranking .= $this->local_cObj->wrap($this->pi_getLL('topic.topicauthor'),$this->conf['list_posts.']['userinfo_topicauthor_wrap']); $content .= $userranking; if ($user_array['tx_mmforum_avatar']) { $content .= tx_mmforum_tools::res_img($conf['path_avatar'].$user_array['tx_mmforum_avatar'],$conf['avatar_height'],$conf['avatar_width']); } $content .= $this->local_cObj->wrap($this->pi_getLL('user.regSince').': '.date("d.m.Y",$user_array['crdate']).'<br />'.$this->pi_getLL('user.posts').': '.$user_array['tx_mmforum_posts'],$this->conf['list_posts.']['userinfo_content_wrap']); /* # Deactivated due to introduction of user ranking system IF($user_array['tx_mmforum_posts'] >= $conf['user_hotposts']) { // Special icon for users with more than a certain number posts defined in TypoScript $llMarker = array('###HOTPOSTS###' => $conf['user_hotposts']); $str = $this->cObj->substituteMarkerArray($this->pi_getLL('user.hot'),$llMarker); $imgInfo['src'] = $conf['path_img'].$conf['images.']['5kstar']; $imgInfo['alt'] = $str; $content .= $this->imgtag($imgInfo); } */ } return $content; } --------------------That's enough for the moment I think 🙂
Is there a way to support you guys directly, enhance the functionality and kill some bugs? Is it possible to get an account and contribute directly in the SVN?
Wäre schön mal eine Antwort darauf zu bekommen 🙂