SimplePortal

Customization => Blocks and Modifications => Topic started by: Chen Zhen on August 22, 2012, 12:42:13 AM

Title: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on August 22, 2012, 12:42:13 AM
[Plugin] SP - Extra Shoutbox Permissions/Options

This will install: 
The extra permissions can be enabled/disabled for any existing membergroup and the extra options can be specific to each shoutbox which will allow a forum administrator more control over shoutbox functions.   



      Simple Portal Extra Shoutbox Options v1.7
      Developed for SMF 2.0.X forums c/o Chen Zhen @ web-develop.ca (http://web-develop.ca)
      Copyright 2013, 2014, 2015, 2016 webdev@web-develop.ca
      This software package is distributed under the terms of the GNU General Public License
      http://www.gnu.org/licenses/gpl.txt



Constituents

New Features

These are additional features that are available within each shoutbox unique settings.

Permissions

These are site wide permissions meaning they affect all Simple Portal shoutboxes on your website.
Unique shoutbox permissions work in conjunction with these although the newer permission set has authority.
They are available in your membergroup permission settings.

General Features

These are general features that were added and/or changed from the shoutbox default behaviour.
They do not require any change of options as they are automatically applied.




Default behaviour relies on this setting:
Enable: Force Lowercase Text

Default regex for v1.5+
Code: [Select]
(?:^|[\.\!\?]\s+)\w|([^:]\b[i|o]\b)

Default callback for v1.5+
Code: [Select]
mb_strtoupper($m[0], $encoding)


Annotation:




CLICK TO DOWNLOAD v1.71 (https://web-develop.ca/index.php?action=downloads;area=stable_simple_portal_plugins;file=25)



If you are updating this modification, you will need to uninstall/delete the older version prior to installing the updated version.
The default regex may change with version updates so be sure to check them if you use the defaults.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: phantomm on August 22, 2012, 03:08:23 AM
awesome! :)
This permissions should be by default in SP package :)
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: Chen Zhen on June 26, 2013, 12:07:57 AM

SP-xtra_shout-perms_v1.1x.zip

Changes:

+ SMF 2.0x support only
+ Added ability to allow selected membergroups to delete their own shouts
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: inter on June 27, 2013, 07:54:05 AM
awesome! :)
This permissions should be by default in SP package :)
+ 1

thanks
Title: Shout Permission
Post by: PokemonS on August 04, 2013, 03:47:50 AM
SP 2.3.5

Hi,

There are two shoutbox in my forum. One is for member chat, and the other is for news.
Shoutbox for news should not be shoutted by members.

So, how to add shout permission for every shoutbox?
Yes, I have this plugin (http://simpleportal.net/index.php?topic=11714.0), and I still use it, but cannot add shout permission for every shoutbox.

Help?
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: Chen Zhen on August 05, 2013, 12:19:08 AM
PokemonS,

  I hope you do not mind that I merged your topic with this modification as I deemed it as a request for another feature to be added to it.

v1.2 now includes the feature you asked for. Edit your shoutbox via Admin -> Simple Portal -> Shoutbox -> Modify (wrench) -> Permissions -> Custom. You will now see another heading titled Read Only as R, simply select R for the membergroups you wish to allow read access only of your specific shoutbox. The regular members option will not do anything so just use any other membergroup there including post based groups and it will not allow them to post shouts but will allow them to view it.
 
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: PokemonS on August 05, 2013, 01:10:18 PM
Awesome! It works!! Thanks a lot!! ;D

But there is a bug,

While install, file SportalAdmin.english.php is not found.
The p should be uppercase, so it must be SPortalAdmin.english.php.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: Chen Zhen on August 05, 2013, 03:01:57 PM

PokemonS,

  The error has been fixed and I thank you for the report.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: player.samp on April 08, 2014, 12:28:28 PM
It seems to be an awesome plugin and I really want to install it but I get an error. :/

"2.   Replace   ./Sources/ManagePermissions.php   Test failed"

Code: (Find) [Select]
$context['non_guest_permissions'] = array(
'delete_replies',


Code: (Replace) [Select]
$context['non_guest_permissions'] = array(
'delete_replies',
'spshout_shout_perm',
'spshout_link_perm',
'spshout_delete_perm',
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: Chen Zhen on April 09, 2014, 12:13:50 AM
player.samp,

  I just tested this on a default SMF 2.0.7 with Simple Portal installed whereas it installs & works without issue.
Imo you must have some mod that edited that file in the same place this one is attempting to insert its edits.
The solution is for you to parse the edits it is attempting to add to ManagePermissions.php file.

Regards.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: AngelinaBelle on April 09, 2014, 12:38:20 PM
player.samp,

The easiest way I can think of to do this is to make careful note of the location of the failed test.  See how the lines in that part of the file might be different from what the installer is expecting to find there.  You might need to refer to a fresh copy of the SMF file to help you find the right place to make the change.

Then go ahead with the install.

Then manually make the necessary changes.
If you find you are confused about how to work around changes that another mod has made, please post your specific questions here.  Someone may be able to advise you.
Or you may need to just test it out for yourself, to see if the changes work.

For more on dealing with installation difficulties, please read the documentation here:
http://simpleportal.net/index.php?action=docs;area=solving_install_problems
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: player.samp on April 09, 2014, 06:22:58 PM
I have a big problem...

I cannot edit the SimplePortal package which I installed on the forum.

It's a winrar file and it does not let me edit it. >.<

Is there any way I can?
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: AngelinaBelle on April 10, 2014, 01:05:22 PM
Do not bother with the archive file.

Here is what to do:
1) Ignore errors and do entire install
2) Go to the file where you have the the install problem
3) Make changes to that single file by hand.

Does that make sense?
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: player.samp on April 10, 2014, 03:34:00 PM
Do not bother with the archive file.

Here is what to do:
1) Ignore errors and do entire install
2) Go to the file where you have the the install problem
3) Make changes to that single file by hand.

Does that make sense?

Maybe I was not clear enough... I have SimplePortal installed already. But I can't find an option how to edit the SimplePortal after I have already downloaded and installed. :/
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: AngelinaBelle on April 10, 2014, 03:46:11 PM
Yes.  If you need to edit files which are on your website, you act directly on those files.
For example -- package manager said it could not do the SimplePortal changes to  ./Sources/ManagePermissions.php

Therefore, you:
1) copy that file from your website to your desktop.  Use FTP to do this.
2) edit that file in your favorite editor (notepad ++ for example)
3) copy that file back up to where it came from on your website.

Or have I misunderstood you again?
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: player.samp on April 11, 2014, 09:28:40 AM
Yes.  If you need to edit files which are on your website, you act directly on those files.
For example -- package manager said it could not do the SimplePortal changes to  ./Sources/ManagePermissions.php

Therefore, you:
1) copy that file from your website to your desktop.  Use FTP to do this.
2) edit that file in your favorite editor (notepad ++ for example)
3) copy that file back up to where it came from on your website.

Or have I misunderstood you again?

Alright, I will try it as soon as I can. :)

Thank you.




UPDATE:

I tried to do it and changed everything by myself and I still got the same error, but I installed it even wih the error and everything works fine and I haven't found any bug on the forum yet. :P
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: AngelinaBelle on April 11, 2014, 11:21:03 AM
I am not sure what "changed everything by myself" means. 
There should only have been one line in one file you needed to change by hand.
If you
1) Did the install (ignoring the errors)
2) Found
Code: [Select]
$context['non_guest_permissions']=and add those 3 simpleportal things to the array
Code: [Select]
'spshout_shout_perm',
'spshout_link_perm',
'spshout_delete_perm',

Then everything should be fine.

If you did not do step 2, then you will run into some problem with the shoutbox at some point.

If everything is working, then congratulations!  you did it!
(but I hope you did it the easy way, instead of a totally manual installation)


Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: Chen Zhen on April 11, 2014, 12:02:00 PM
player.samp,

  I do not understand why there is such an issue here. SMF provides documentation on parsing file edits for such issues which gives good guidance. For this plugin you stated only one edit that needed parsing so what you do is install the mod and then do the edit that showed an error manually yourself using FTP.

  An easy way to do this is after installing the mod, you use the browser back button to go back to the mod installation screen and press the small arrows (left side) beside where it showed an editing error. This will allow you to open a popup that shows the edit it is trying to make so at that point you just do it manually yourself using FTP or ie. Cpanel file editor. Then you just close the browser without commencing installation a second time because you already installed it so don't make that mistake. You only go back to see the edit but do not install it again since it has already been installed prior.
 
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: player.samp on April 11, 2014, 12:07:41 PM
I am not sure what "changed everything by myself" means. 
There should only have been one line in one file you needed to change by hand.
If you
1) Did the install (ignoring the errors)
2) Found
Code: [Select]
$context['non_guest_permissions']=and add those 3 simpleportal things to the array
Code: [Select]
'spshout_shout_perm',
'spshout_link_perm',
'spshout_delete_perm',

Then everything should be fine.

If you did not do step 2, then you will run into some problem with the shoutbox at some point.

If everything is working, then congratulations!  you did it!
(but I hope you did it the easy way, instead of a totally manual installation)

That's what I did and as I have already said I have no bugs and everything seems to be working.

I had few more lines except from

'delete_replies'

So I didn't change it to

'delete_replies',
      'spshout_shout_perm',
      'spshout_link_perm',
      'spshout_delete_perm',

I just added these 3 things.

Does the order matter?
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: AngelinaBelle on April 14, 2014, 09:27:48 AM
player.samp,

Thanks for the careful explanation.
Sounds like you did just the right thing.  It seems you found the correct place in the file and made that one manual change.
I am sorry I did not understand you

I am glad you got it all working!
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: ♦ Ninja ZX-10RR ♦ on November 29, 2014, 11:06:34 PM
This plugin now needs manual edits to be plugged in (lol sorry for that words-game), at least in my installation. Will be trying and report it back later, going to bed now :P
Besides I am also bumping this, it's really interesting. Perhaps more permissions could have been added, such as edit messages (there isn't at all, not even for a moderator).
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: Chen Zhen on December 27, 2014, 11:09:07 PM
♦ Ninja ZX-10RR ♦,

  I apologize for overlooking the issue you posted here about a month ago  :0
I have updated the original post with v1.21 which fixes the issue you reported.
Thank you for letting me know of the issue.

Regards.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: ♦ Ninja ZX-10RR ♦ on January 02, 2015, 01:45:10 PM
Glad you got it to work then, sorry for the late reply as well, I'm on holiday ;)

Happy new year!
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: Chen Zhen on January 05, 2015, 01:58:37 AM
SP - Extra Shoutbox Permissions users,

This plug-in has been updated to version 1.32.
The newest option includes inputs and membergroup settings for filtering shoutbox text/input via a regex callback.
This will allow you to alter the filtering of specific membergroup text within the shoutbox.
Some knowledge of regular expressions may be required to use this feature.

Regards.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: PokemonS on January 07, 2015, 04:22:44 PM
Thanks for the release!

btw, It has been half of year since I ask about the read-only chatbox.
But I am still getting this error:

Quote
2: array_intersect() [<a href='function.array-intersect'>function.array-intersect</a>]: Argument #2 is not an array

The code is still original as v1.3

Code: [Select]
$read_only = (count(array_intersect($user_info['groups'], $context['SPortal']['shoutbox']['groups_read_only'])) > 0) ? true : false;
The problem seems doesn't impact anything,
but the error logs are filled continously.

(http://puu.sh/ecX0N.png)

Halp? 'w'
Title: Re: [Plugin] SP - Extra Shoutbox Permissions
Post by: ♦ Ninja ZX-10RR ♦ on January 07, 2015, 08:08:14 PM
Thanks for the release!

btw, It has been half of year since I ask about the read-only chatbox.
You can easily set it up by unchecking the post shouts permissions :)

As regards the other issue you gotta wait Chen Zhen, I'm not a coder :/
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on January 10, 2015, 10:00:15 PM

This plug-in has been updated to version 1.4.
It includes some fixes, new regex pattern + callback, updated copyright, slight name change, option of restricting the amount of consecutive shouts (by membergroup) and the option of allowing guests to post shouts.

PokemonS,
  The error you reported should not have been occurring as the variable in question is configured as an array but I put in some logic to fix that possible issue anyway. Please uninstall your current version + delete it, clear your error log and then install the newer version 1.4 of the plug-in. Please let me know if it solves the issue. Btw - the option of restricting the amount of consecutive shouts has been added as per your request in the other topic.

Regards.

 
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: ♦ Ninja ZX-10RR ♦ on January 11, 2015, 04:27:10 PM
Besides I am also bumping this, it's really interesting. Perhaps more permissions could have been added, such as edit messages (there isn't at all, not even for a moderator).
Anything about this? :/
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on January 11, 2015, 06:16:16 PM

You are requesting that one can edit their own shouts if they have the permission to do so?
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: ♦ Ninja ZX-10RR ♦ on January 12, 2015, 06:48:44 AM
2 different ones, edit own and edit any. It could be very useful for moderators instead of just blindly fully deleting a shout.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: PokemonS on January 13, 2015, 04:30:23 PM

This plug-in has been updated to version 1.4.
It includes some fixes, new regex pattern + callback, updated copyright, slight name change, option of restricting the amount of consecutive shouts (by membergroup) and the option of allowing guests to post shouts.

PokemonS,
  The error you reported should not have been occurring as the variable in question is configured as an array but I put in some logic to fix that possible issue anyway. Please uninstall your current version + delete it, clear your error log and then install the newer version 1.4 of the plug-in. Please let me know if it solves the issue. Btw - the option of restricting the amount of consecutive shouts has been added as per your request in the other topic.

Regards.

Thanks for the new feature and fixes! Works perfectly. 'w'

Just a little note, there are lots of error logs about ENT_XHTML in Subs-Portal.php.
Fix: change ENT_XHTML to 'ENT_XHTML'.

EDIT:
Oh also there are still minor errors:
(http://puu.sh/etF4f.png)
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on January 13, 2015, 05:02:06 PM

PokemonS,

  I do not see those errors on a live nor a local installation. Also the lines of code you speak of are off a bit compared to the default files (after my plug-in edits them). This gives me the inclination that you have some other plug-in or manual edits that you may not have mentioned.

Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Burke Knight on January 13, 2015, 10:51:25 PM

You are requesting that one can edit their own shouts if they have the permission to do so?

It sure would beat having to delete the post, then repost it, corrected.
Could add an edited message with time, if wanted to keep track of an edited post, so people would know.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on January 13, 2015, 11:47:28 PM
It sure would beat having to delete the post, then repost it, corrected.
Could add an edited message with time, if wanted to keep track of an edited post, so people would know.

  Yes I already thought of adding an edited msg of some sort similar to how posts are done.
You'll have to wait until I find the free time to work on the options you have requested but I will do them for the next update.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: ♦ Ninja ZX-10RR ♦ on January 14, 2015, 07:41:09 AM
That's awesome, thanks as always :)
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Burke Knight on January 14, 2015, 12:28:30 PM

(http://bkd.pw/bk_like.png)
 
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: PokemonS on January 17, 2015, 10:05:02 AM

PokemonS,

  I do not see those errors on a live nor a local installation. Also the lines of code you speak of are off a bit compared to the default files (after my plug-in edits them). This gives me the inclination that you have some other plug-in or manual edits that you may not have mentioned.

Okay,

When I look again Error Logs, there are bunch of undefined errors lol.

(http://puu.sh/eDRsN.png)

PortalShoutbox.php

- 8: Undefined index: warning (Line 70)
- 8: Undefined index: num_show (Line 168)
- 8: Undefined index: allowed_bbc (Line 169)
- 8: Undefined index: reverse (Line 170)
- 8: Undefined index: caching (Line 171)



Code: [Select]

50:
51: if ($m[0] === ':O')
52: return mb_strtolower($m[0], $encoding);
53: else
54: return mb_strtoupper($m[0], $encoding);
55: }
56: function sportal_shoutbox()
57: {
58: global $smcFunc, $context, $modSettings, $scripturl, $txt, $sourcedir, $user_info;
59:
60: $shoutbox_id = !empty($_REQUEST['shoutbox_id']) ? (int) $_REQUEST['shoutbox_id'] : 0;
61: $request_time = !empty($_REQUEST['time']) ? (int) $_REQUEST['time'] : 0;
62:
63: $context['SPortal']['shoutbox'] = sportal_get_shoutbox($shoutbox_id, true, true);
64: $context['SPortal']['shoutbox']['groups_read_only'] = (!empty($context['SPortal']['shoutbox']['groups_read_only'])) && is_array($context['SPortal']['shoutbox']['groups_read_only']) ? $context['SPortal']['shoutbox']['groups_read_only'] : (!empty($context['SPortal']['shoutbox']['groups_read_only']) ? (array)$context['SPortal']['shoutbox']['groups_read_only'] : array());
65: $read_only = (count(array_intersect($user_info['groups'], $context['SPortal']['shoutbox']['groups_read_only'])) > 0) ? true : false;
66:
67: if (empty($context['SPortal']['shoutbox']))
68: fatal_lang_error('error_sp_shoutbox_not_exist', false);
69:
==>70: $context['SPortal']['shoutbox']['warning'] = parse_bbc($context['SPortal']['shoutbox']['warning']);
71:
72: $can_moderate = allowedTo('sp_admin') || allowedTo('sp_manage_shoutbox');
73: if (!$can_moderate && !empty($context['SPortal']['shoutbox']['moderator_groups']))
74: $can_moderate = count(array_intersect($user_info['groups'], $context['SPortal']['shoutbox']['moderator_groups'])) > 0;
75:
76: if (!empty($_REQUEST['shout']))
77: {
78: if (!allowedTo('spshout_link_perm'))
79: {
80: $search = array('/\[url\](.*?)\[\/url\]/is'  . ($context['utf8'] ? 'u' : ''), '/\[url\=(.*?)\](.*?)\[\/url\]/is'  . ($context['utf8'] ? 'u' : ''), '/\<a(.*)\>(.*)\<\/a\>/iU'  . ($context['utf8'] ? 'u' : ''), "/(?i)\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))/"  . ($context['utf8'] ? 'u' : ''));
81: $newShout = preg_replace($search, "$2", $_REQUEST['shout']);
82: if ($newShout !== $_REQUEST['shout'])
83: $context['SPortal']['shoutbox']['warning'] = !empty($context['SPortal']['shoutbox']['nolinks_msg']) ? parse_bbc($context['SPortal']['shoutbox']['nolinks_msg']) : (!empty($txt['error_sp_shoutbox_nolinks_msg']) ? parse_bbc($txt['error_sp_shoutbox_nolinks_msg']) : parse_bbc($context['SPortal']['shoutbox']['warning']));
84:
85: $_REQUEST['shout'] = $newShout;
86: }
87: $exempt = !empty($context['SPortal']['shoutbox']['admin_exempt']) && $user_info['is_admin'] ? true : false;
88: $encoding = !empty($context['character_set']) ? $context['character_set'] : 'UTF-8';
89: if (allowedTo('spshout_regex_perm') && !empty($context['SPortal']['shoutbox']['lowercase']) && !$exempt)
90: {




150: if (!empty($_REQUEST['delete']))
151: {
152: checkSession('request');
153:
154: /* if (!$can_moderate)
155: fatal_lang_error('error_sp_cannot_shoutbox_moderate', false); */
156:
157: $_REQUEST['delete'] = (int) $_REQUEST['delete'];
158:
159: if (!empty($_REQUEST['delete']))
160: sportal_delete_shout($shoutbox_id, $_REQUEST['delete']);
161: }
162:
163: loadTemplate('PortalShoutbox');
164:
165: if (isset($_REQUEST['xml']))
166: {
167: $shout_parameters = array(
==>168: 'limit' => $context['SPortal']['shoutbox']['num_show'],
==>169: 'bbc' => $context['SPortal']['shoutbox']['allowed_bbc'],
==>170: 'reverse' => $context['SPortal']['shoutbox']['reverse'],
==>171: 'cache' => $context['SPortal']['shoutbox']['caching'],
172: 'can_moderate' => $can_moderate,
173: );
174: $context['SPortal']['shouts'] = sportal_get_shouts($shoutbox_id, $shout_parameters);
175:
176: $context['sub_template'] = 'shoutbox_xml';
177: $context['SPortal']['updated'] = empty($context['SPortal']['shoutbox']['last_update']) || $context['SPortal']['shoutbox']['last_update'] > $request_time;
178:
179: return;
180: }
181:
182: $request = $smcFunc['db_query']('', '
183: SELECT COUNT(*)
184: FROM {db_prefix}sp_shouts
185: WHERE id_shoutbox = {int:current}',
186: array(
187: 'current' => $shoutbox_id,
188: )
189: );
190: list ($total_shouts) = $smcFunc['db_fetch_row']($request);


PortalShoutbox.template.php

- 8: Undefined index: id (Line 204)

Code: [Select]
184: </div>
185: <div class="smalltext centertext">
186: <a href="javascript:window.close();">' . $txt['more_smileys_close_window'] . '</a>
187: </div>
188: </div>
189: </body>
190: </html>'), '
191: }';
192: }
193:
194: echo '
195: // ]]></script>';
196: }
197:
198: function template_shoutbox_xml()
199: {
200: global $context, $txt, $memberContext, $settings;
201:
202: echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
203: <smf>
==>204: <shoutbox>', $context['SPortal']['shoutbox']['id'], '</shoutbox>';
205:
206: if ($context['SPortal']['updated'])
207: {
208: echo '
209: <updated>1</updated>
210: <error>', empty($context['SPortal']['shouts']) ? $txt['sp_shoutbox_no_shout'] : 0, '</error>
211: <warning>', !empty($context['SPortal']['shoutbox']['warning']) ? htmlspecialchars($context['SPortal']['shoutbox']['warning']) : 0, '</warning>
212: <reverse>', !empty($context['SPortal']['shoutbox']['reverse']) ? 1 : 0, '</reverse>';
213:
214: foreach ($context['SPortal']['shouts'] as $shout)
215: {
216: loadMemberData($shout['author']['id']);
217: loadMemberContext($shout['author']['id']);
218: if (empty($memberContext[$shout['author']['id']]['avatar']['href']))
219: $avatarSB = 'http://pokemonstars.com/forum/avatars/Pikachu.png';
220: else
221: $avatarSB = $memberContext[$shout['author']['id']]['avatar']['href'];
222:
223: echo '
224: <shout>
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on January 17, 2015, 09:16:40 PM
PokemonS,

  I believe you misunderstood my statement. I did not say that I did not know which part of the code was causing the undefined errors but rather that I can tell by the differing line numbers that the file has been edited by you or another plug-in.

What other edits have been done to the file? Did you do manual edits to this file at some point or is there perhaps another plug-in (mod) that has edited the file. What was done to it or which plug-in was it that edited that file? If you take a default installation of Simple Portal & apply only this specific plug-on, the line numbers are not the same as what you are posting and that is how I can tell that the file has been edited outside what my plug-in applies.

There is no way the code should continue without showing the shoutbox does not exist error when no shoutbox id exists as your errors seem to imply.

I can suggest that you find (line 67 of your code?!):
Code: [Select]
if (empty($context['SPortal']['shoutbox']))

and change it to:
Code: [Select]
if (empty($context['SPortal']['shoutbox']['id']))

.. but this does not explain my questions.

Regards.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: PokemonS on January 22, 2015, 05:26:41 AM
PokemonS,

  I believe you misunderstood my statement. I did not say that I did not know which part of the code was causing the undefined errors but rather that I can tell by the differing line numbers that the file has been edited by you or another plug-in.

What other edits have been done to the file? Did you do manual edits to this file at some point or is there perhaps another plug-in (mod) that has edited the file. What was done to it or which plug-in was it that edited that file? If you take a default installation of Simple Portal & apply only this specific plug-on, the line numbers are not the same as what you are posting and that is how I can tell that the file has been edited outside what my plug-in applies.

There is no way the code should continue without showing the shoutbox does not exist error when no shoutbox id exists as your errors seem to imply.

I can suggest that you find (line 67 of your code?!):
Code: [Select]
if (empty($context['SPortal']['shoutbox']))

and change it to:
Code: [Select]
if (empty($context['SPortal']['shoutbox']['id']))

.. but this does not explain my questions.

Regards.

Ah, sorry for my misunderstood. =="

I didn't use any other SP's plug-ins than your mod, Extra Shoutbox Permissions.
I have manually edit some files to display avatar in shoutbox.
And also other minor edits, I don't remember.

Code: [Select]
if (empty($context['SPortal']['shoutbox']))

and change it to:
Code: [Select]
if (empty($context['SPortal']['shoutbox']['id']))

That code was completely fix the problem, tested for 3 days and no error logs about shoutbox.

Thanks! 'w'
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on January 22, 2015, 03:16:52 PM

PokemonS,

  Recently I had the same behaviour on a live installation therefore I will be applying that edit to this plug-in's next release.
Thank you for the report and glad to hear your issue has been resolved.

Regards.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on January 29, 2015, 06:43:08 PM

The mod has been updated to version 1.5 which includes some additional functions & fixes.
Please see the first post for details regarding what the plug-in adds to your Simple Portal shoutbox.
If you are updating from a previous version you must uninstall & delete the old version prior to installing the new one.



PokemonS,
  When applying this update please remember that you recently did a manual edit to one of the files which v1.5 now applies to the same line of code. Imo you may want to change the line back to what it was previous to that edit so the plug-in can install error free.



Ninja ZX-10RR,
  Your request for a shout editor has been added to version 1.5. Admins & shoutbox moderators will always have the option to edit any shout and there is an extra permission setting for membergroups to allow a user to edit their own shouts.

Regards.   
 
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: ♦ Ninja ZX-10RR ♦ on January 31, 2015, 01:06:28 PM
GREAT! Thanks an awesome LOT! Really appreciated mate, you rock as always at coding :D will test it in the following days, due to the fact that I had to reinstall SimplePortal I got to apply the other changes as well and this one is in queue of course. Very happy to read that!
Cheers!
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: PokemonS on February 27, 2015, 11:19:18 PM
Thanks for the update!

A little wish...
"disable whisper for a shoutbox"

Could you code it? Thanks!
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: br360 on March 03, 2015, 10:39:57 PM
Thanks Chen Zhen for the new features. If you have any thoughts or plans about adding even more features to the shoutbox, three that I personally would like to see would be:

1). Bannings. Being able to ban a user from the shoutbox; and being able to ban them for a specific time. (24 hours, one week, 30 days, etc.)

2). Being able to select text font and color permanently. From what I can see; members are allowed to choose different text and colors, but it is on a per chat basis. If they want to continue to use the same color for example, they have to continue to use the same color tags each time. It would be cool if once they chose a color or font, it would stay that way until they changed it again.

3). Being able to ignore members in the shoutbox. If let's say a member was on someone's ignore list, it would be really cool if when that member posted something in chat, you would see the same "you are ignoring this member" Click this link to see chat.

Just my personal opinion of course, but think they would be great feature additions if you were interested.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: ♦ Ninja ZX-10RR ♦ on March 04, 2015, 01:36:18 AM
Hi br360! I'll reply just to the first of your requests since it's possible already.
Create a new membergroup called "Banned from the Shoutbox" or something like that, then put anyone you want to be able to ban people as moderators of that group. In the shoutbox block setting set the permission to see the shoutbox as DENIED for that particular membergroup, you can also show another block just for that membergroup to tell them they had been banned (just the way I did).
Nice to see you here :)
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: br360 on March 04, 2015, 02:09:03 AM
Hey Ninja, good to see you here as well. 

Thanks for the tip, but the only issue I have with creating a new "banned from chat" usergroup is that I have chat moderators that mod the shoutbox- but I really don't want to give them permission to actually be able to change membergroups themselves- as although I trust them, there is specific criteria needed to be assigned specific groups, and I don't trust them that much. ;)

Ideally I would hope that there could be permissions that could be given to chat moderators themselves like there are in other shoutbox mods. For example:

Edit messages in Shoutbox   
Delete messages in Shoutbox   
Empty Shoutbox   
Ban users in Shoutbox





Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: ♦ Ninja ZX-10RR ♦ on March 04, 2015, 05:21:14 AM
I was thinking that as well, but the good thing is that if you set certain people to moderators of a membergroup then you don't need to give them the permission to assign membergroups :D Have a look, I was about asking the same thing a while ago but further testing discovered it's easy like this anyway :) basically if someone is moderator of a group it implies 2 things:
1) he doesn't need to be really part of the group to be a moderator for it
2) he can put people into that membergroup ONLY, even without the relative permission since the fact that they are moderating that particular membergroup makes SMF assume they can actually assign the relative membership as well (bear in mind, ONLY that membership, or remove it, not else), which works great for banning in SP.

And yeah I'm here, enjoying this place and the italian support forum (3rd major poster, turning 2nd :P) much more than sm.org :)
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: 420connect on April 03, 2015, 04:15:58 AM
I'm having trouble getting this to work again after rebuilding my forum from a copy of my database..

I'm finding when I install it, it essentially breaks the 'post' functionality of the shoutbox..

Any suggestions where things could be going wrong?
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on April 03, 2015, 07:59:17 PM
420connect,

  What do you mean by "post"? Are you referring to another plugin that is conflicting or are you referring to shouting in general?
Did you change the regex settings? Try adjusting it to the default value.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: 420connect on April 04, 2015, 05:35:53 AM
Yeah, - generally shouting/posting wouldn't work?
- No changes before or after to regex settings.

(For now I have opted to use the @PM mod in it's place but I'd love to eventually have a fully modded shoutbox with all of the fancy options in one mod but I know you will have other priorities!)
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Aquafan on August 01, 2015, 10:13:35 AM
thanks but i got this error

 Use of undefined constant ENT_XHTML - assumed 'ENT_XHTML

   

'regex' => isset($row['regex']) ? sportal_checkaddslashes($row['regex'], ENT_QUOTES | ENT_XHTML) : '(?:^|[\.\!\?]\s+)\w|([^:]\b[i|o]\b)',

and

   

$str = htmlspecialchars_decode($str, ENT_QUOTES | ENT_XHTML);

   

'nolinks_msg' => !empty($row['nolinks_msg']) ? sportal_checkaddslashes($row['nolinks_msg'], ENT_QUOTES | ENT_XHTML) : (!empty($txt['error_sp_shoutbox_nolinks_msg']) ? $smcFunc['htmlspecialchars']($txt['error_sp_shoutbox_nolinks_msg']) : ''),


   

'regex_callback' => isset($row['regex_callback']) ? sportal_checkaddslashes($row['regex_callback'], ENT_QUOTES | ENT_XHTML) : 'mb_strtoupper($m[0], $encoding)',
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: ♦ Ninja ZX-10RR ♦ on August 01, 2015, 11:37:48 AM
Aquafan,
Please explain your issue more clearly, as I have no idea about what you mean with that post :/

Regards
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: [SiNaN] on August 01, 2015, 11:48:17 AM
ENT_XHTML constant was added with PHP 5.4, so if you are running an older version of PHP, you'll get that undefined constant error. Chen Zhen would know better if that option is really necessary or find an alternative to support older PHP versions.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on August 03, 2015, 12:19:33 AM
Aquafan,

  Simply remove:
Code: [Select]
| ENT_XHTML from all the lines you referenced.

Regards.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: player.samp on August 08, 2015, 10:45:44 AM
I installed the mod successfully with one error which I fixed by myself for sure.

I get an error when I try to edit a shout of someone else, as a forum administrator.

"Parse error: syntax error, unexpected T_FUNCTION in /Sources/PortalEdit.php on line 151"

EDIT: I also cannot see the chat history and it seems like removing any shout is not possible too.

Error when I try to see the chat history:

"Parse error: syntax error, unexpected T_FUNCTION in /Sources/PortalShoutbox.php on line 81"
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: ♦ Ninja ZX-10RR ♦ on August 08, 2015, 10:52:53 AM
You forgot to attach the files ;)
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: player.samp on August 08, 2015, 11:02:35 AM
PortalEdit.php:

http://pastebin.com/VafF2nSS

PortalShoutbox.php:

http://pastebin.com/x3SEk4dJ
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on August 09, 2015, 12:21:55 AM
player.samp,

  Due to the use of anonymous functions (closures) & the ENT_XHTML constant, PHP 5.4 (+) is required to use this plug-in.
The current latest version is PHP 5.6 whereas your host should be updating beyond what you seem to have available.
Do you use a free host, shared host, VPS or dedicated? 

Regards.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Yahmez on October 12, 2015, 09:42:31 AM
Hello everyone,

I wanted to post an update to this plugin that was created by a friend. This update fixes an error where the time of the last edit is not calculated correctly for users with a time offset. It has been packaged up and we are using it currently. I was not sure if it was in good form to post another package here so here are a list of edits made to address the issue. If it is acceptable to attach the package here I can do that as well.

Quote
filename: add_db_columns.php:
Below the other db_add_column's:

$smcFunc['db_add_column'](
   '{db_prefix}sp_shouts',
   array(
       'name' => 'modified_time',
       'type' => 'int',
       'size' => 10,
       'default' => 0,
       'null' => false
   ),
   array(),
   'ignore',
   'fatal'
);

$smcFunc['db_add_column'](
   '{db_prefix}sp_shouts',
   array(
       'name' => 'modified_name',
       'type' => 'varchar',
       'size' => 255,
       'default' => '',
       'null' => false
   ),
   array(),
   'ignore',
   'fatal'
);



filename: install.xml
In the "<file name="$sourcedir/Subs-Portal.php">" section add:

   <operation>
      <search position="replace"><![CDATA[mg.online_color AS member_group_color, pg.online_color AS post_group_color
         FROM {db_prefix}sp_shouts AS sh]]></search>
      <add><![CDATA[mg.online_color AS member_group_color, pg.online_color AS post_group_color,
            sh.modified_time, sh.modified_name
         FROM {db_prefix}sp_shouts AS sh]]></add>
   </operation>
   <operation>
      <search position="before"><![CDATA['text' => parse_bbc($row['body'], true, '', $bbc),]]></search>
      <add><![CDATA[
            'modified_time' => $row['modified_time'],
            'modified_name' => $row['modified_name'],]]></add>
   </operation>
   <operation>
      <search position="before"><![CDATA[$shouts[$shout['id']]['text'] = censorText($shouts[$shout['id']]['text']);]]></search>
      <add><![CDATA[
      if ($shouts[$shout['id']]['modified_time'] != 0) {
         $logged_edit = str_replace('%$#@', timeformat($shouts[$shout['id']]['modified_time']), $txt['sp_shoutbox_who_edit_shout']) . $shouts[$shout['id']]['modified_name'];
         $shouts[$shout['id']]['text'] .= '<div id="edit_shout_' . $shout['id'] . '" style="display: inline;"><br /><span class="smalltext shoutbox_time" style="font-style: italic;">' . $logged_edit . '</span></div>';
      }]]></add>
   </operation>



filename: PortalEdit.php
Update the "UPDATE {db_prefix}sp_shouts" to look like this:

               UPDATE {db_prefix}sp_shouts
               SET body = {string:body},
               modified_time = {string:modified_time},
               modified_name = {string:modified_name}
               WHERE id_shout = {int:shout_id}',
               array(
                  'body' => $bodyShout,
                  'modified_time' => $shout_data['modified_time'],
                  'modified_name' => $shout_data['modified_name'],
                  'shout_id' => (int)$shout_id,
               )

Update the "$logged_edit = " to this:

   $modified_time = time();
   $modified_name = (!empty($user_info['name']) ? $user_info['name'] : $user_info['username']);
   $logged_edit = str_replace('%$#@', timeformat($modified_time), $txt['sp_shoutbox_who_edit_shout']) . $modified_name;

Update the return array of the "sportal_edit_shout" function to include these:

      'modified_time' => $modified_time,
      'modified_name' => $modified_name,

Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: ♦ Ninja ZX-10RR ♦ on October 12, 2015, 09:46:01 AM
Yahmez,

Thanks for posting that, I am sure Chen Zhen will look into it when he logs in ;)

Regards
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Yahmez on October 13, 2015, 12:53:34 PM
Yahmez,

Thanks for posting that, I am sure Chen Zhen will look into it when he logs in ;)

Regards

Actually I wonder if this is more of a SP shoutbox issue than a plugin issue. Adding the plugin just made it more obvious and easy to catch because we have members all over the globe and edit times seemed to all be based off of the person's time offset that edited their post.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on October 16, 2015, 04:07:04 PM
Yahmez,

  I can't say that I will use your specific edit but I do understand that the time should be recorded as GMT and then converted to the viewers offset. I actually noticed this issue in the past but forgot to include a fix in the latest release. This will be adjusted when I have time to do another update.

  Thank you for the report.

Regards.
Title: Use of undefined constant ENT_XHTML
Post by: Killerfisk on November 07, 2015, 12:13:26 PM
So basically I'm getting lots of these errors

78.69.???.232<??action=portal;sa=shoutbox;shoutbox_id=1;time=1444403468;xml<?8: Use of undefined constant ENT_XHTML - assumed 'ENT_XHTML'e82dd91550b8946538641227373f5f59undefined_vars 1/usr/share/nginx/html/sfr/Sources/Subs-Portal.phpÇ????ú?ØYÙV%?
78.69.???.232<??action=portal;sa=shoutbox;shoutbox_id=1;time=1444403468;xml<?8: Use of undefined constant ENT_XHTML - assumed 'ENT_XHTML'e82dd91550b8946538641227373f5f59undefined_vars 1/usr/share/nginx/html/sfr/Sources/Subs-Portal.phpÛ????ú?ØYÙV%?
78.69.???.232<??action=portal;sa=shoutbox;shoutbox_id=1;time=1444403468;xml<?8: Use of undefined constant ENT_XHTML - assumed 'ENT_XHTML'e82dd91550b8946538641227373f5f59undefined_vars 1/usr/share/nginx/html/sfr/Sources/Subs-Portal.phpÈ????ú?   ØYÙV%?

mostly those, some of these

151.80.??.115&㄀?action=profile;area=statistics;u=2246<㄀8: Use of undefined constant ENT_XHTML - assumed 'ENT_XHTML'92ca47db04d174ed1a97bdffa29aa35dundefined_vars 1/usr/share/nginx/html/sfr/Sources/Subs-Portal.phpÛ㄀㄀á ㄀ [ƒº´&V
151.80.??.115&㄀?action=profile;area=statistics;u=2246<㄀8: Use of undefined constant ENT_XHTML - assumed 'ENT_XHTML'92ca47db04d174ed1a97bdffa29aa35dundefined_vars 1/usr/share/nginx/html/sfr/Sources/Subs-Portal.phpÂ㄀㄀á ㄀ [ƒº´&V
151.80.??.115&㄀?action=profile;area=statistics;u=2246<㄀8: Use of undefined constant ENT_XHTML - assumed 'ENT_XHTML'92ca47db04d174ed1a97bdffa29aa35dundefined_vars 1/usr/share/nginx/html/sfr/Sources/Subs-Portal.phpÛ㄀㄀á ㄀

and variations thereof.

I'm completely illiterate when it comes to things like these, so not sure how to approach this. I'm currently also running this mod http://simpleportal.net/index.php?topic=11714.0 which could potentially be causing it?
Title: Re: Use of undefined constant ENT_XHTML
Post by: ♦ Ninja ZX-10RR ♦ on November 07, 2015, 01:16:41 PM
Hi Killerfisk and welcome to SimplePortal.

I approved and then merged your topic into that one because you rightfully mentioned that mod. You have 2 options:
1) Update your PHP version to at least 5.4 (suggested is latest stable 5.6 but 5.4 will work anyway).
or
2) http://simpleportal.net/index.php?topic=11714.msg69895#msg69895

Regards
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: aegersz on September 12, 2016, 05:33:53 AM
this wont install into my 2.3.6 system:

Replace   ./Themes/default/PortalShoutbox.template.php   Test failed:

Code: [Select]
<li class="smalltext">', !$shout['is_me'] ? '<strong>' . $shout['author']['link'] . ':</strong> ' : '', $shout['text'], '<br />', !empty($shout['delete_link_js']) ? '<span class="shoutbox_delete">' . $shout['delete_link_js'] . '</span>' : '' , '<span class="smalltext shoutbox_time">', $shout['time'], '</span></li>';
I downloaded V 1.6, is that the latest version of this mod or else, how can i get this to fit ? I have another error buts it's only an alignment issue.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: aegersz on September 12, 2016, 08:00:40 AM
I tested it on a vanilla system and it installs fine: I have these mods on:

4.   Staff Permissions For Simple Portal   1.2   September 06, 2016, 01:46:55 AM.   [ Uninstall ]
9.   Shoutbox PM button - SimplePortal 2.3.5   1.0   August 22, 2016, 12:34:13 PM.   [ Uninstall ]
10.   SP-Shoutbox Sounds   1.1   August 22, 2016, 11:30:05 AM.   [ Uninstall ]
11.   Shoutbox Color Selector - SimplePortal 2.3.5   1.1a   August 22, 2016, 11:29:29 AM.   [ Uninstall ]

There is conflict somewhere, can you help please ?
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: andy on September 13, 2016, 09:54:22 AM
Quote
There is conflict somewhere, can you help please ?

First you could try testing yourself. Install one by one and test for  your ' conflict' point.

Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: andy on September 18, 2016, 02:36:48 PM
Quote
Uninstalling them has also not going as well as I had hoped as I am getting errors.


There is your basic answer - the more you change the code, the more problems you will get. It is not a plugin system.
You yourself decide houw much trouble you are happy to deal with ad how much time you spend on these problems. I do not use modifications that require manual changes to code.

You can uninstall mods simple if you do so in the opposite order they were installed (except if manual changes were made). The order of install is given in the backup folder as each modification adds the time to the zip backup of files. You need to use a file manager from in your host management system, or get a file backup downloaded and look in that.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: aegersz on October 09, 2016, 11:39:33 PM
Thanks andy !

I FOUND the mods that were causing this, it was the Shoutbox PM button - SimplePortal 2.3.5 and SP-Shoutbox Sounds that introduced this conflict.

I tried leaving the Sounds mod on and it required an easy manual change but that rendered the Permissions mod uninstallable ! no idea why but your advice on avoiding manual changes is solid.

Anyway, removing those two, this mod can be installed and uninstalled without issue. It's too awkward to retro-fix the Sounds mod without better skills on my part.

BTW, I can use the PM function by enabling "whispering (http://simpleportal.net/index.php?topic=3568.0)" in Permissions
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: aegersz on October 14, 2018, 07:12:12 PM
cool. i have the 1.70 version so i will see if that works. thanks.
Title: Re: [Plugin] SP - Extra Shoutbox Permissions/Options
Post by: Chen Zhen on October 16, 2018, 11:02:36 PM
v.173 is the latest version.
ref.
https://web-develop.ca/index.php?action=downloads;area=stable_simple_portal_plugins;file=25
SimplePortal 2.3.8 © 2008-2024, SimplePortal