https://simplemachines.org, SMF
https://web-develop.ca, WebDev
array(
'tag' => 'test',
'type' => 'unparsed_content',
'before' => '[test]',
'after' => '[/test]',
'validate' => function(&$tag, $url) {
if (preg_match('%([^"&?/ ])%i', $url, $match)) {
$f = fopen('./list.txt', 'r');
list($lines, $value) = array(array(), array());
if (!empty($f)) {
while (!feof($f)) {
$lines[] = fgets($f);
}
$lineValue = !empty($match[1]) && abs($match[1]) > 0 ? abs($match[1]) - 1 : 0;
if (!empty($lines[$lineValue])) {
$value = explode(',', $lines[$lineValue]);
$tag['content'] = !empty($value) && count($value) > 1 ? '<a href="' . $value[0] . '">' . $value[1] . '</a>' : '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>';
}
}
if (count($value) < 2)
$tag['content'] = '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>';
}
else
$tag['content'] = '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>';
},
'trim' => 'both',
'quoted' => 'optional',
),
https://simplemachines.org, SMF
https://web-develop.ca, WebDev
array(
'tag' => 'test',
'type' => 'unparsed_content',
'before' => '[test]',
'after' => '[/test]',
'validate' => function(&$tag, $url) {
if (preg_match('%([^"&?/ ])%i', $url, $match)) {
$rows = array_map('str_getcsv', file('./list.csv'));
$csv = array();
foreach ($rows as $row) {
$csv[] = $row;
}
$value = !empty($match[1]) && abs($match[1]) > 0 ? abs($match[1]) - 1 : 0;
$tag['content'] = !empty($csv[$value]) ? '<a href="'. $csv[$value][0] .'">' . $csv[$value][1] . '</a>' : '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>';
}
else
$tag['content'] = '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>';
},
'trim' => 'both',
'quoted' => 'optional',
),
Quote[test]1[/test]
array(
'tag' => 'test',
'type' => 'unparsed_content',
'before' => '[test]',
'after' => '[/test]',
'validate' => function(&$tag, $url)
{
if (preg_match('%([^"&?/ ])%i', $url, $match)) {$file = file_get_contents("./list.txt"); $match = explode(PHP_EOL,$file); $array = array_filter($m); $value = $match[1];
$tag['content'] = '<a="'. $value .'">Test Link</a>';
}
else
$tag['content'] = '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>';
},
'trim' => 'both',
'quoted' => 'optional',
),
$admin_group_id = 0;
$admin_ids = array(1);
$board_ids = array(1);
$board_profile = 4;
//$query_where = 'mem.id_member IN ({array_int:admin_ids}) AND FIND_IN_SET({int:groupid}, b.member_groups) != 0 AND b.id_profile = {int:read_only} AND m.id_board IN ({array_int:board_ids})';
$query_where = 'mem.id_member IN ({array_int:admin_ids}) AND FIND_IN_SET({int:groupid}, b.member_groups) != 0 AND b.id_profile = {int:read_only}';
$query_where_params = array('groupid' => $admin_group_id, 'admin_ids' => $admin_ids, 'board_ids' => $board_ids, 'read_only' => $board_profile);
$query_limit = 10;
$query_order = 'm.id_msg DESC';
$limit_body = true;
$override_permissions = false;
$queryPosts = ehPortal_queryPosts($query_where, $query_where_params, $query_limit, $query_order, $output_method, $limit_body, $override_permissions);
function ehPortal_queryPosts($query_where, $query_where_params, $query_limit, $query_order, $limit_body, $override_permissions)
{
global $scripturl, $txt, $user_info;
global $modSettings, $smcFunc, $context;
if (!empty($modSettings['enable_likes']))
$context['can_like'] = allowedTo('likes_like');
// Find all the posts. Newer ones will have higher IDs.
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg, m.id_board, m.likes, b.name AS board_name, b.member_groups, b.id_profile,
COALESCE(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
COALESCE(lt.id_msg, lmr.id_msg, 0) >= m.id_msg_modified AS is_read,
COALESCE(lt.id_msg, lmr.id_msg, -1) + 1 AS new_from') . ', ' . ($limit_body ? 'SUBSTRING(m.body, 1, 384) AS body' : 'm.body') . ', m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)' . ($modSettings['postmod_active'] ? '
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)' : '') . '
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = m.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = m.id_board AND lmr.id_member = {int:current_member})' : '') . '
WHERE 1=1 ' . ($override_permissions ? '' : '
AND {query_wanna_see_board}') . ($modSettings['postmod_active'] ? '
AND m.approved = {int:is_approved}
AND t.approved = {int:is_approved}' : '') . '
' . (empty($query_where) ? '' : 'AND ' . $query_where) . '
ORDER BY ' . $query_order . '
' . ($query_limit == '' ? '' : 'LIMIT ' . $query_limit),
array_merge($query_where_params, array(
'current_member' => $user_info['id'],
'is_approved' => 1,
))
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
// Censor it!
censorText($row['subject']);
censorText($row['body']);
$preview = strip_tags(strtr($row['body'], array('<br>' => ' ')));
// Build the array.
$posts[$row['id_msg']] = array(
'id' => $row['id_msg'],
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $smcFunc['strlen']($preview) > 128 ? $smcFunc['substr']($preview, 0, 128) . '...' : $preview,
'body' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => $row['poster_time'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '" rel="nofollow">' . $row['subject'] . '</a>',
'new' => !empty($row['is_read']),
'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],
);
// Get the likes for each message.
if (!empty($modSettings['enable_likes']))
$posts[$row['id_msg']]['likes'] = array(
'count' => $row['likes'],
'you' => in_array($row['id_msg'], prepareLikesContext($row['id_topic'])),
'can_like' => !$context['user']['is_guest'] && $row['id_member'] != $context['user']['id'] && !empty($context['can_like']),
);
}
$smcFunc['db_free_result']($request);
echo '
<div style="width: 100%;overflow: hidden;">
<div style="width: 100%;text-align: center;margin: 0 auto;color: blue;font-size: 1.5em;text-decoration: underline;padding: 1em;">IMPORTANT POSTS</div>';
foreach ($posts as $post) {
$date = date('Y-m-d', $post['timestamp']);
echo '
<div>Board: ' . $post['board']['link'] . '</div>
<div>Topic: ' . $post['link'] . '</div>
<div>Author: ' . $post['poster']['link'] . '</div>
<div>Date: ' . $date . '</div>
<hr />';
}
echo '
</div>';
}