Skip to content

Commit

Permalink
Merge pull request #227 from WildcardSearch/maintenance
Browse files Browse the repository at this point in the history
3.2.6 Release
  • Loading branch information
Mark Vincent authored Aug 6, 2018
2 parents e13a566 + bc59b5e commit 2483300
Show file tree
Hide file tree
Showing 11 changed files with 290 additions and 100 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
## MentionMe 3.2.5
## MentionMe 3.2.6

A plugin for MyBB 1.8.x that allows Twitter-style tagging and integration with [MyAlerts](https://github.com/euantorano/MyAlerts)

While this plugin works with MyAlerts, it is not necessary for the tagging features to work. When MyAlerts is installed integration is enabled by default (in Admin CP).

MyBB Release Thread: http://community.mybb.com/thread-131448.html

Twitter Addons: https://github.com/Advanced-Sidebox/Twitter-Addons

#Features
* mention auto-completion while typing`*`
* supports standard textarea, SCEditor (default WYSIWYG), CKEditor (Rin Editor, etc.), MHEditor (doylecc)
* DVZ Shoutbox support
* full text search`*`
* displays avatars in autocomplete popup`*`
* uses a prioritizes users from the current thread, when applicable`*`
Expand Down
3 changes: 3 additions & 0 deletions Upload/inc/languages/english/admin/mention.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
$l['mention_max_items_title'] = 'Maximum Items In Popup';
$l['mention_max_items_description'] = 'If autocomplete is used, this setting will limit the size of the popup';

$l['mention_min_width_title'] = 'Minimum Width';
$l['mention_min_width_description'] = 'If autocomplete is used, this setting will provide a minimum width for the popup, in pixels';

$l['mention_cache_time_title'] = 'Cache Cut-off Time';
$l['mention_cache_time_description'] = 'The task caches usernames based on when they were last active. In days, specify how far back to go. (Large forums should stick with low numbers to reduce the size of the namecache)';

Expand Down
20 changes: 16 additions & 4 deletions Upload/inc/plugins/MentionMe/alerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function mentionMeMyAlertsDatahandlerPostUpdate($thisPost)
*/
if ($mentionedAlready[$uid] ||
$editUID == $uid ||
!mentionMeCheckPermissions($username, $uid, $editUID, $fid)) {
!mentionMeCheckPermissions($username, $uid, $editUID, $fid, $tid)) {
continue;
}
$mentionedAlready[$uid] = true;
Expand Down Expand Up @@ -196,7 +196,7 @@ function mentionMeMyAlertsDoNewReplyEnd()
*/
if ($mentionedAlready[$uid] ||
$fromUser == $uid ||
!mentionMeCheckPermissions($username, $uid, $fromUser, $fid)) {
!mentionMeCheckPermissions($username, $uid, $fromUser, $fid, $tid)) {
continue;
}

Expand Down Expand Up @@ -300,10 +300,10 @@ function mentionMeStripQuotes($message)
* @param int id of the forum in which the mention occurred
* @return bool true to allow, false to deny
*/
function mentionMeCheckPermissions($username, $uid, $fromUID, $fid)
function mentionMeCheckPermissions($username, $uid, $fromUID, $fid, $tid)
{
global $cache;
static $nameCache, $myCache;
static $nameCache, $myCache, $db;

// cache names to reduce queries
if ($myCache instanceof MentionMeCache == false) {
Expand Down Expand Up @@ -353,13 +353,25 @@ function mentionMeCheckPermissions($username, $uid, $fromUID, $fid)
return true;
}

// check if this is the user's thread
$query = $db->simple_select('thread', 'uid', "tid='{$tid}'");
$isOp = $uid > 0 && (int) $db->fetch_field($query, 'uid') == $uid;

// check for permissions in all the user's groups
foreach ($userGroups as $gid) {
// empty 'displaygroup' and 'additionalgroups' are 0 or blank, skip them
if ((int) $gid == 0) {
continue;
}

// if the user can only view their own threads and this thread isn't one of them...
if (isset($forum_permissions[$fid][$gid]) &&
$forum_permissions[$fid][$gid]['canonlyviewownthreads'] &&
!$isOp) {
// sorry charlie
return false;
}

// the first 'yes' we hear gets us out of the loop with a valid return
if (!isset($forum_permissions[$fid][$gid]) ||
$forum_permissions[$fid][$gid] == 0 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* plugin specific extension
*/

class MentionMeInstaller extends WildcardPluginInstaller010202
class MentionMeInstaller extends WildcardPluginInstaller010203
{
static public function getInstance()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
*
*/

class WildcardPluginInstaller010202 implements WildcardPluginInstallerInterface010000
class WildcardPluginInstaller010203 implements WildcardPluginInstallerInterface010000
{
/**
* @const version
*/
const VERSION = '1.2.2';
const VERSION = '1.2.3';

/**
* @var object a copy of the MyBB db object
Expand Down Expand Up @@ -551,7 +551,7 @@ protected function addStyleSheets()
// now cache the actual files
require_once MYBB_ROOT . "{$config['admin_dir']}/inc/functions_themes.php";

if(!cache_stylesheet(1, $data['cachefile'], $data['stylesheet']))
if(!cache_stylesheet(1, $styleSheet['cachefile'], $data['stylesheet']))
{
$this->db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
}
Expand Down Expand Up @@ -663,7 +663,7 @@ protected function addImages()
!mkdir("{$path}/images", 0777, true)) ||
($mainFolder &&
!is_dir("{$path}/images{$mainFolder}") &&
!mkdir("{$path}/images{$mainFolder}", 0777, true))) {
!$this->createContentFolder("{$path}/images{$mainFolder}"))) {
continue;
}

Expand Down Expand Up @@ -693,7 +693,7 @@ protected function addImages()
if (!is_dir($path) ||
($mainFolder &&
!is_dir("{$path}{$mainFolder}") &&
!mkdir("{$path}{$mainFolder}", 0777, true))) {
!$this->createContentFolder("{$path}{$mainFolder}"))) {
continue;
}

Expand Down Expand Up @@ -867,6 +867,52 @@ private function buildThemeList($acp = false)

return $folderList;
}

/**
* verify that path exists or can be created
*
* @param folder path
* @return bool
*/
private function createContentFolder($path)
{
if (mkdir($path, 0777, true)) {
file_put_contents($path . '/index.html', <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<title>forbidden</title>
<style type="text/css">
body {
background: #F0F0F0;
color: #010101;
font-family: verdana,arial;
font-size: 14px;
font-weight: bold;
}
#msg {
border: 1px solid #F08080;
background: #FFF0F0;
padding: 20px;
margin: 5px;
}
</style>
</head>
<body>
<div id="msg">you don't have permission to access this resource</div>
</body>
</html>
EOF
);

return true;
}

return false;
}
}

?>
3 changes: 3 additions & 0 deletions Upload/inc/plugins/MentionMe/forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ function mentionMeBuildPopup() {
$min = '.min';
}

$mybb->settings['mention_min_width'] = (int) $mybb->settings['mention_min_width'];

$mentionAutocomplete = <<<EOF
<!-- MentionMe Autocomplete Scripts -->
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/Caret.js/jquery.caret{$min}.js"></script>
Expand All @@ -541,6 +543,7 @@ function mentionMeBuildPopup() {
},
maxLength: '{$mybb->settings['maxnamelength']}',
maxItems: '{$mybb->settings['mention_max_items']}',
minWidth: '{$mybb->settings['mention_min_width']}',
tid: '{$mybb->input['tid']}',
fullText: '{$mybb->settings['mention_full_text_search']}',
showAvatars: '{$mybb->settings['mention_show_avatars']}',
Expand Down
2 changes: 1 addition & 1 deletion Upload/inc/plugins/MentionMe/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function mentionMeAddPeekers($peekers)
return;
}

$peekers[] = 'new Peeker($(".setting_mention_auto_complete"), $("#row_setting_mention_max_items, #row_setting_mention_get_thread_participants, #row_setting_mention_max_thread_participants, #row_setting_mention_full_text_search, #row_setting_mention_show_avatars, #row_setting_mention_lock_selection"), 1, true)';
$peekers[] = 'new Peeker($(".setting_mention_auto_complete"), $("#row_setting_mention_max_items, #row_setting_mention_min_width, #row_setting_mention_get_thread_participants, #row_setting_mention_max_thread_participants, #row_setting_mention_full_text_search, #row_setting_mention_show_avatars, #row_setting_mention_lock_selection"), 1, true)';

$peekers[] = 'new Peeker($(".setting_mention_add_postbit_button"), $("#row_setting_mention_multiple"), 1, true)';

Expand Down
33 changes: 21 additions & 12 deletions Upload/inc/plugins/MentionMe/install_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,23 @@
'value' => '5',
'disporder' => '20',
),
'mention_min_width' => array(
'sid' => '0',
'name' => 'mention_min_width',
'title' => $lang->mention_min_width_title,
'description' => $lang->mention_min_width_description,
'optionscode' => 'text',
'value' => '120',
'disporder' => '30',
),
'mention_get_thread_participants' => array(
'sid' => '0',
'name' => 'mention_get_thread_participants',
'title' => $lang->mention_get_thread_participants_title,
'description' => $lang->mention_get_thread_participants_description,
'optionscode' => 'yesno',
'value' => '1',
'disporder' => '30',
'disporder' => '40',
),
'mention_max_thread_participants' => array(
'sid' => '0',
Expand All @@ -51,7 +60,7 @@
'description' => $lang->mention_max_thread_participants_description,
'optionscode' => 'text',
'value' => '5',
'disporder' => '40',
'disporder' => '50',
),
'mention_full_text_search' => array(
'sid' => '0',
Expand All @@ -60,7 +69,7 @@
'description' => $lang->mention_full_text_search_description,
'optionscode' => 'yesno',
'value' => '0',
'disporder' => '50',
'disporder' => '60',
),
'mention_show_avatars' => array(
'sid' => '0',
Expand All @@ -69,7 +78,7 @@
'description' => $lang->mention_show_avatars_description,
'optionscode' => 'yesno',
'value' => '1',
'disporder' => '60',
'disporder' => '70',
),
'mention_lock_selection' => array(
'sid' => '0',
Expand All @@ -78,7 +87,7 @@
'description' => $lang->mention_lock_selection_description,
'optionscode' => 'yesno',
'value' => '1',
'disporder' => '70',
'disporder' => '80',
),
'mention_add_postbit_button' => array(
'sid' => '0',
Expand All @@ -87,7 +96,7 @@
'description' => $lang->mention_add_postbit_button_description,
'optionscode' => 'yesno',
'value' => '0',
'disporder' => '80',
'disporder' => '90',
),
'mention_multiple' => array(
'sid' => '0',
Expand All @@ -96,7 +105,7 @@
'description' => $lang->mention_multiple_description,
'optionscode' => 'yesno',
'value' => '0',
'disporder' => '90',
'disporder' => '100',
),
'mention_format_names' => array(
'sid' => '0',
Expand All @@ -105,7 +114,7 @@
'description' => $lang->mention_format_names_desc,
'optionscode' => 'yesno',
'value' => '1',
'disporder' => '100',
'disporder' => '110',
),
'mention_display_symbol' => array(
'sid' => '0',
Expand All @@ -114,7 +123,7 @@
'description' => $lang->mention_display_symbol_desc,
'optionscode' => 'text',
'value' => '@',
'disporder' => '110',
'disporder' => '120',
),
'mention_open_link_in_new_window' => array(
'sid' => '0',
Expand All @@ -123,7 +132,7 @@
'description' => $lang->mention_open_link_in_new_window_desc,
'optionscode' => 'yesno',
'value' => '0',
'disporder' => '120',
'disporder' => '130',
),
'mention_cache_time' => array(
'sid' => '0',
Expand All @@ -132,7 +141,7 @@
'description' => $lang->mention_cache_time_description,
'optionscode' => 'text',
'value' => '7',
'disporder' => '130',
'disporder' => '140',
),
'mention_minify_js' => array(
'sid' => '0',
Expand All @@ -141,7 +150,7 @@
'description' => $lang->mention_minify_js_desc,
'optionscode' => 'yesno',
'value' => '1',
'disporder' => '140',
'disporder' => '150',
),
)
)
Expand Down
2 changes: 1 addition & 1 deletion Upload/inc/plugins/mention.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// checked by other plugin files
define('IN_MENTIONME', true);
define('MENTIONME_VERSION', '3.2.5');
define('MENTIONME_VERSION', '3.2.6');

// register custom class autoloader
spl_autoload_register('mentionMeClassAutoLoad');
Expand Down
Loading

0 comments on commit 2483300

Please sign in to comment.