(?:^|[\.\!\?]\s+)\w|([^:]\b[i|o]\b)
mb_strtoupper($m[0], $encoding)
awesome! :)+ 1
This permissions should be by default in SP package :)
$context['non_guest_permissions'] = array(
'delete_replies',
$context['non_guest_permissions'] = array(
'delete_replies',
'spshout_shout_perm',
'spshout_link_perm',
'spshout_delete_perm',
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?
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?
$context['non_guest_permissions']=
and add those 3 simpleportal things to the array 'spshout_shout_perm',
'spshout_link_perm',
'spshout_delete_perm',
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) FoundCode: [Select]$context['non_guest_permissions']=
and add those 3 simpleportal things to the arrayCode: [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)
2: array_intersect() [<a href='function.array-intersect'>function.array-intersect</a>]: Argument #2 is not an array
$read_only = (count(array_intersect($user_info['groups'], $context['SPortal']['shoutbox']['groups_read_only'])) > 0) ? true : false;
Thanks for the release!You can easily set it up by unchecking the post shouts permissions :)
btw, It has been half of year since I ask about the read-only chatbox.
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? :/
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.
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.
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.
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);
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>
if (empty($context['SPortal']['shoutbox']))
if (empty($context['SPortal']['shoutbox']['id']))
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.
Code: [Select]if (empty($context['SPortal']['shoutbox']))
and change it to:Code: [Select]if (empty($context['SPortal']['shoutbox']['id']))
| ENT_XHTML
from all the lines you referenced.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,
Yahmez,
Thanks for posting that, I am sure Chen Zhen will look into it when he logs in ;)
Regards
<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>';
There is conflict somewhere, can you help please ?
Uninstalling them has also not going as well as I had hoped as I am getting errors.