本文整理汇总了PHP中bbcode函数的典型用法代码示例。如果您正苦于以下问题:PHP bbcode函数的具体用法?PHP bbcode怎么用?PHP bbcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbcode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowFleetsConfPage
function ShowFleetsConfPage()
{
global $LNG;
$CONF = Config::getAll(NULL, 1);
if (!empty($_POST)) {
$pay_before = array('fleetconf' => $CONF['fleetconf']);
$fleetconf = TIMESTAMP + $_POST['days'] * 24 * 60 * 60;
$pay_after = array('fleetconf' => $fleetconf);
Config::update($pay_after, 1);
$CONF = Config::getAll(NULL, 1);
$LOG = new Log(3);
$LOG->target = 1;
$LOG->old = $pay_before;
$LOG->new = $pay_after;
$LOG->save();
require_once 'includes/functions/BBCode.php';
$Time = TIMESTAMP;
$Message = '<span class="admin">All promotional fleets and defence have been unlocked until ' . date("d.m.Y - H:i:s", $CONF['fleetconf']) . '. - <a href="?page=shipyard&mode=fleet">Fleet</a> - <a href="?page=shipyard&mode=defence">Defence</a>';
$From = '<span class="admin">"Antimatter"</span>';
$pmSubject = '<span class="admin">"Purchase Bonus"</span>';
$pmMessage = '<span class="admin">' . bbcode($Message) . '</span>';
$USERS = $GLOBALS['DATABASE']->query("SELECT `id`, `username` FROM " . USERS . " WHERE `universe` = '1';");
while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
$sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
SendSimpleMessage($UserData['id'], $USER['id'], TIMESTAMP, 50, $From, $pmSubject, $sendMessage);
}
}
$template = new template();
$template->assign_vars(array('fleetconf' => $CONF['fleetconf'], 'bonus_next_active' => $CONF['fleetconf'] > TIMESTAMP ? $CONF['fleetconf'] - TIMESTAMP : 0, 'bonus_next_active_timer' => $CONF['fleetconf'] > TIMESTAMP ? date("d.m.Y H:i:s", $CONF['fleetconf']) : 0));
$template->show('fleetconf.tpl');
}
示例2: get
function get()
{
if (!get_config('system', 'hidden_version_siteinfo')) {
$version = sprintf(t('Version %s'), \Zotlabs\Lib\System::get_project_version());
if (@is_dir('.git') && function_exists('shell_exec')) {
$commit = @shell_exec('git log -1 --format="%h"');
$tag = \Zotlabs\Lib\System::get_std_version();
// @shell_exec('git describe --tags --abbrev=0');
}
if (!isset($commit) || strlen($commit) > 16) {
$commit = '';
}
} else {
$version = $commit = '';
}
$plugins_list = implode(', ', visible_plugin_list());
if ($plugins_list) {
$plugins_text = t('Installed plugins/addons/apps:');
} else {
$plugins_text = t('No installed plugins/addons/apps');
}
$txt = get_config('system', 'admininfo');
$admininfo = bbcode($txt);
if (file_exists('doc/site_donate.html')) {
$donate .= file_get_contents('doc/site_donate.html');
}
if (function_exists('sys_getloadavg')) {
$loadavg = sys_getloadavg();
}
$o = replace_macros(get_markup_template('siteinfo.tpl'), array('$title' => t('$Projectname'), '$description' => t('This is a hub of $Projectname - a global cooperative network of decentralized privacy enhanced websites.'), '$version' => $version, '$tag_txt' => t('Tag: '), '$tag' => $tag, '$polled' => t('Last background fetch: '), '$lastpoll' => get_poller_runtime(), '$load_average' => t('Current load average: '), '$loadavg_all' => $loadavg[0] . ', ' . $loadavg[1] . ', ' . $loadavg[2], '$commit' => $commit, '$web_location' => t('Running at web location') . ' ' . z_root(), '$visit' => t('Please visit <a href="http://hubzilla.org">hubzilla.org</a> to learn more about $Projectname.'), '$bug_text' => t('Bug reports and issues: please visit'), '$bug_link_url' => 'https://github.com/redmatrix/hubzilla/issues', '$bug_link_text' => t('$projectname issues'), '$contact' => t('Suggestions, praise, etc. - please email "redmatrix" at librelist - dot com'), '$donate' => $donate, '$adminlabel' => t('Site Administrators'), '$admininfo' => $admininfo, '$plugins_text' => $plugins_text, '$plugins_list' => $plugins_list));
call_hooks('about_hook', $o);
return $o;
}
示例3: menu_render
function menu_render($menu, $class = '', $edit = false, $var = array())
{
if (!$menu) {
return '';
}
$channel_id = is_array(App::$profile) ? App::$profile['profile_uid'] : 0;
if (!$channel_id && local_channel()) {
$channel_id = local_channel();
}
$menu_list = menu_list($channel_id);
$menu_names = array();
foreach ($menu_list as $menus) {
if ($menus['menu_name'] != $menu['menu']['menu_name']) {
$menu_names[] = $menus['menu_name'];
}
}
for ($x = 0; $x < count($menu['items']); $x++) {
if (in_array($menu['items'][$x]['mitem_link'], $menu_names)) {
$m = menu_fetch($menu['items'][$x]['mitem_link'], $channel_id, get_observer_hash());
$submenu = menu_render($m, 'dropdown-menu', $edit = false, array('wrap' => 'none'));
$menu['items'][$x]['submenu'] = $submenu;
}
if ($menu['items'][$x]['mitem_flags'] & MENU_ITEM_ZID) {
$menu['items'][$x]['mitem_link'] = zid($menu['items'][$x]['mitem_link']);
}
if ($menu['items'][$x]['mitem_flags'] & MENU_ITEM_NEWWIN) {
$menu['items'][$x]['newwin'] = '1';
}
$menu['items'][$x]['mitem_desc'] = bbcode($menu['items'][$x]['mitem_desc']);
}
$wrap = $var['wrap'] === 'none' ? false : true;
$ret = replace_macros(get_markup_template('usermenu.tpl'), array('$menu' => $menu['menu'], '$class' => $class, '$edit' => $edit ? t("Edit") : '', '$id' => $menu['menu']['menu_id'], '$items' => $menu['items'], '$wrap' => $wrap));
return $ret;
}
示例4: format_event_html
function format_event_html($ev)
{
if (!(is_array($ev) && count($ev))) {
return '';
}
$bd_format = t('l F d, Y \\@ g:i A');
// Friday January 18, 2011 @ 8 AM
$o = '<div class="vevent">' . "\r\n";
$o .= '<p class="summary event-summary">' . bbcode($ev['summary']) . '</p>' . "\r\n";
$o .= '<p class="description event-description">' . bbcode($ev['desc']) . '</p>' . "\r\n";
$o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="' . datetime_convert('UTC', 'UTC', $ev['start'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\\TH:i:s') . '" >' . ($ev['adjust'] ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $ev['start'], $bd_format)) : day_translate(datetime_convert('UTC', 'UTC', $ev['start'], $bd_format))) . '</abbr></p>' . "\r\n";
if (!$ev['nofinish']) {
$o .= '<p class="event-end" >' . t('Finishes:') . ' <abbr class="dtend" title="' . datetime_convert('UTC', 'UTC', $ev['finish'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\\TH:i:s') . '" >' . ($ev['adjust'] ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $ev['finish'], $bd_format)) : day_translate(datetime_convert('UTC', 'UTC', $ev['finish'], $bd_format))) . '</abbr></p>' . "\r\n";
}
if (strlen($ev['location'])) {
$o .= '<p class="event-location"> ' . t('Location:') . ' <span class="location">' . bbcode($ev['location']) . '</span></p>' . "\r\n";
if (strpos($ev['location'], "[map") === False) {
$map = generate_named_map($ev['location']);
if ($map !== $ev['location']) {
$o .= $map;
}
}
}
$o .= '</div>' . "\r\n";
return $o;
}
示例5: impressum_show
function impressum_show($a, &$b)
{
$b .= '<h3>' . t('Impressum') . '</h3>';
$owner = get_config('impressum', 'owner');
$owner_profile = get_config('impressum', 'ownerprofile');
$postal = bbcode(get_config('impressum', 'postal'), true);
$notes = bbcode(get_config('impressum', 'notes'), true);
$email = obfuscate_email(get_config('impressum', 'email'));
if (strlen($owner)) {
if (strlen($owner_profile)) {
$tmp = '<a href="' . $owner_profile . '">' . $owner . '</a>';
} else {
$tmp = $owner;
}
if (strlen($email)) {
$b .= '<p><strong>' . t('Site Owner') . '</strong>: ' . $tmp . '<br /><strong>' . t('Email Address') . '</strong>: ' . $email . '</p>';
} else {
$b .= '<p><strong>' . t('Site Owner') . '</strong>: ' . $tmp . '</p>';
}
if (strlen($postal)) {
$b .= '<p><strong>' . t('Postal Address') . '</strong><br />' . $postal . '</p>';
}
if (strlen($notes)) {
$b .= '<p>' . $notes . '</p>';
}
} else {
$b .= '<p>' . t('The impressum addon needs to be configured!<br />Please add at least the <tt>owner</tt> variable to your config file. For other variables please refer to the README file of the addon.') . '</p>';
}
}
示例6: ShowSendMessagesPage
function ShowSendMessagesPage()
{
global $USER, $LNG, $db;
if ($_GET['mode'] == 'send') {
switch ($USER['authlevel']) {
case AUTH_MOD:
$color = 'yellow';
break;
case AUTH_OPS:
$color = 'skyblue';
break;
case AUTH_ADM:
$color = 'red';
break;
}
$Subject = makebr(request_var('subject', '', true));
$Message = makebr(request_var('text', '', true));
if (!empty($Message) && !empty($Subject)) {
require_once ROOT_PATH . 'includes/functions/BBCode.php';
$Time = TIMESTAMP;
$From = '<span style="color:' . $color . ';">' . $LNG['user_level'][$USER['authlevel']] . ' ' . $USER['username'] . '</span>';
$Subject = '<span style="color:' . $color . ';">' . $Subject . '</span>';
$Message = '<span style="color:' . $color . ';font-weight:bold;">' . bbcode($Message) . '</span>';
SendSimpleMessage(0, $USER['id'], TIMESTAMP, 50, $From, $Subject, $Message, 0, $_SESSION['adminuni']);
$db->query("UPDATE " . USERS . " SET `new_gmessage` = `new_gmessage` + '1', `new_message` = `new_message` + '1' WHERE `universe` = '" . $_SESSION['adminuni'] . "';");
exit($LNG['ma_message_sended']);
} else {
exit($LNG['ma_subject_needed']);
}
}
$template = new template();
$template->assign_vars(array('mg_empty_text' => $LNG['mg_empty_text'], 'ma_subject' => $LNG['ma_subject'], 'ma_none' => $LNG['ma_none'], 'ma_message' => $LNG['ma_message'], 'ma_send_global_message' => $LNG['ma_send_global_message'], 'ma_characters' => $LNG['ma_characters'], 'button_submit' => $LNG['button_submit']));
$template->show('adm/SendMessagesPage.tpl');
}
示例7: hubwall_post
function hubwall_post(&$a)
{
if (!is_site_admin()) {
return;
}
$text = trim($_REQUEST['text']);
if (!$text) {
return;
}
$sender_name = sprintf(t('$1%s Administrator'), \Zotlabs\Lib\System::get_site_name());
$sender_email = $_REQUEST['sender'];
$subject = $_REQUEST['subject'];
$textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r", "\\n"), array("", "\n"), $text))), ENT_QUOTES, 'UTF-8'));
$htmlversion = bbcode(stripslashes(str_replace(array("\\r", "\\n"), array("", "<br />\n"), $text)));
$sql_extra = intval($_REQUEST['test']) ? sprintf(" and account_email = '%s' ", get_config('system', 'admin_email')) : '';
$recips = q("select account_email from account where account_flags = %d {$sql_extra}", intval(ACCOUNT_OK));
if (!$recips) {
notice(t('No recipients found.') . EOL);
return;
}
$total_recips = count($recips);
$total_delivered = 0;
foreach ($recips as $recip) {
$x = \Zotlabs\Lib\Enotify::send(array('fromName' => $sender_name, 'fromEmail' => $sender_email, 'replyTo' => $sender_email, 'toEmail' => $recip['account_email'], 'messageSubject' => $subject, 'htmlVersion' => $htmlversion, 'textVersion' => $textversion));
if ($x) {
$total_delivered++;
}
}
info(sprintf(t('%1$d of %2$d messages sent.'), $total_delivered, $total_recips) . EOL);
}
示例8: sala
function sala($room)
{
global $home;
requirelogin();
$room = protect($room);
$qry = mysql_query("SELECT * FROM chat WHERE `room`='{$room}' ORDER BY id DESC LIMIT 10");
if (mysql_numrows($qry) == 0) {
$chat = t("Nenhuma mensagem.");
} else {
$chat = null;
while ($row = mysql_fetch_array($qry)) {
$usr = mysql_fetch_array(mysql_query("SELECT * FROM accounts WHERE `id`='{$row['owner']}'"));
$usr = $usr['login'];
$chat .= '<p>' . url("user/profile/{$usr}", $usr) . ': ' . bbcode($row['text']) . '</p>';
}
}
section('<meta http-equiv="REFRESH" content="10;url=' . $home . '/chat/sala/' . $room . '">
<form method="post" action="' . $home . 'chat/falar">
<input type="hidden" name="sala" value="' . $room . '">
<input type="text" name="text">
<input type="submit" value="' . t("Falar") . '">
</form><hr size="1">
<div class="row">
' . $chat . '
</div>', t("Chat"));
}
示例9: tagrm_content
function tagrm_content(&$a)
{
$o = '';
if (!local_user()) {
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
// NOTREACHED
}
$item = $a->argc > 1 ? intval($a->argv[1]) : 0;
if (!$item) {
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
// NOTREACHED
}
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_user()));
if (!count($r)) {
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
}
$arr = explode(',', $r[0]['tag']);
if (!count($arr)) {
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
}
$o .= '<h3>' . t('Remove Item Tag') . '</h3>';
$o .= '<p id="tag-remove-desc">' . t('Select a tag to remove: ') . '</p>';
$o .= '<form id="tagrm" action="tagrm" method="post" >';
$o .= '<input type="hidden" name="item" value="' . $item . '" />';
$o .= '<ul>';
foreach ($arr as $x) {
$o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x) . '" >' . bbcode($x) . '</input></li>';
}
$o .= '</ul>';
$o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . t('Remove') . '" />';
$o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . t('Cancel') . '" />';
$o .= '</form>';
return $o;
}
示例10: ShowSendMessagesPage
function ShowSendMessagesPage()
{
global $USER, $LNG, $CONF;
$ACTION = HTTP::_GP('action', '');
if ($ACTION == 'send') {
switch ($USER['authlevel']) {
case AUTH_MOD:
$class = 'mod';
break;
case AUTH_OPS:
$class = 'ops';
break;
case AUTH_ADM:
$class = 'admin';
break;
}
$Subject = HTTP::_GP('subject', '', true);
$Message = HTTP::_GP('text', '', true);
$Mode = HTTP::_GP('mode', 0);
$Lang = HTTP::_GP('lang', '');
if (!empty($Message) && !empty($Subject)) {
require_once 'includes/functions/BBCode.php';
if ($Mode == 0 || $Mode == 2) {
$Time = TIMESTAMP;
$From = '<span class="' . $class . '">' . $LNG['user_level'][$USER['authlevel']] . ' ' . $USER['username'] . '</span>';
$pmSubject = '<span class="' . $class . '">' . $Subject . '</span>';
$pmMessage = '<span class="' . $class . '">' . bbcode($Message) . '</span>';
$USERS = $GLOBALS['DATABASE']->query("SELECT `id`, `username` FROM " . USERS . " WHERE `universe` = '1'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
$sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
SendSimpleMessage($UserData['id'], $USER['id'], TIMESTAMP, 50, $From, $pmSubject, $sendMessage);
}
}
if ($Mode == 1 || $Mode == 2) {
require 'includes/classes/Mail.class.php';
$userList = array();
$USERS = $GLOBALS['DATABASE']->query("SELECT `email`, `username` FROM " . USERS . " WHERE `universe` = '1'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
$userList[$UserData['email']] = array('username' => $UserData['username'], 'body' => bbcode(str_replace('{USERNAME}', $UserData['username'], $Message)));
}
Mail::multiSend($userList, strip_tags($Subject));
}
exit($LNG['ma_message_sended']);
} else {
exit($LNG['ma_subject_needed']);
}
}
$sendModes = $LNG['ma_modes'];
if (Config::get('mail_active') == 0) {
unset($sendModes[1]);
unset($sendModes[2]);
}
$template = new template();
$template->assign_vars(array('langSelector' => array_merge(array('' => $LNG['ma_all']), $LNG->getAllowedLangs(false)), 'modes' => $sendModes));
$template->show('SendMessagesPage.tpl');
}
示例11: _news
public function _news($news_id, $category_id, $user_id, $image_id, $date, $published, $views, $vote, $title, $introduction, $content, $tags, $category_name, $category_title, $image, $category_icon, $username, $admin, $online, $quote, $avatar, $sex)
{
$this->title($title);
$news = new Panel(array('title' => $title, 'icon' => 'fa-file-text-o', 'content' => $this->load->view('index', array('news_id' => $news_id, 'category_id' => $category_id, 'user_id' => $user_id, 'image_id' => $image_id, 'date' => $date, 'views' => $views, 'vote' => $vote, 'title' => $title, 'introduction' => bbcode($introduction) . '<br /><br />' . bbcode($content), 'content' => '', 'tags' => $tags, 'image' => $image, 'category_icon' => $category_icon, 'category_name' => $category_name, 'category_title' => $category_title, 'username' => $username, 'avatar' => $avatar, 'sex' => $sex))));
if ($user_id) {
return array(new Row(new Col($news)), new Row(new Col(new Panel(array('title' => $this('about_the_author'), 'icon' => 'fa-user', 'content' => $this->load->view('author', array('user_id' => $user_id, 'username' => $username, 'avatar' => $avatar, 'sex' => $sex, 'admin' => $admin, 'online' => $online, 'quote' => $quote)))), 'col-md-6'), new Col(new Panel(array('title' => $this('more_news_from_author'), 'icon' => 'fa-file-text-o', 'content' => $this->load->view('author_news', array('news' => $this->model()->get_news_by_user($user_id, $news_id))), 'body' => FALSE)), 'col-md-6')), $this->load->library('comments')->display('news', $news_id));
} else {
return array($news, $this->load->library('comments')->display('news', $news_id));
}
}
示例12: view
function view($group)
{
global $url, $home;
requirelogin();
$group = protect($group);
$group = resolvegroup($group);
$owner = mysql_query("SELECT `login` FROM accounts WHERE `id`='{$group['owner']}'");
$owner = mysql_fetch_array($owner);
$owner = $owner['login'];
$output = '<h3>' . $group['title'] . '</h3>
<p>' . bbcode($group['desc']) . '<hr size="1">
<b>' . t("Criado por") . '</b> ' . url("user/profile/{$owner}", $owner) . '</p>';
section($output, t("Grupo"));
$members = null;
if (estounogrupo($group['id'])) {
$members .= url("groups/participacao/{$group['url']}", t("[sair do grupo]")) . '<br>';
} else {
$members .= url("groups/participacao/{$group['url']}", t("[participar]")) . '<br>';
}
$qry = mysql_query("SELECT a.login AS l, a.foto AS f FROM groups_join g LEFT JOIN accounts a ON g.account=a.id WHERE g.group='{$group['id']}' LIMIT 100");
if (mysql_numrows($qry) != 0) {
while ($row = mysql_fetch_array($qry)) {
$members .= '<div class="row"><p>
' . url("user/profile/{$row['l']}", '<img src="' . $url . '/upload/' . thumb($row[f]) . '">') . '<br>
' . url("user/profile/{$row['l']}", $row[l]) . '
</p></div>';
}
} else {
$members .= t("Não há membros.");
}
section($members, t("Membros"));
if (estounogrupo($group['id'])) {
// show shoutbox
$output = '<form method="post" action="' . $home . 'groups/writesbpost">
<input type="hidden" name="group" value="' . $group['id'] . '">
<label for="content">Escrever</label><br/>
<textarea name="content" id="content" rows="5" cols="25"></textarea>
<br/><input type="submit" value="' . t("Enviar") . '"></form><br/>';
$qry = mysql_query("SELECT * FROM groups_shoutbox WHERE `id_group`='{$group['id']}' ORDER BY id DESC LIMIT 30");
if (mysql_numrows($qry) == 0) {
$output .= infobox(t("Não há itens na shoutbox deste grupo."), false);
} else {
while ($row = mysql_fetch_array($qry)) {
$user = mysql_fetch_array(mysql_query("SELECT login FROM accounts WHERE `id`='{$row['owner']}'"));
$output .= '<p>
' . url("user/profile/{$user['login']}", $user['login']) . ': ' . bbcode($row['text']);
if ($group['owner'] == $_SESSION['id'] or $row['owner'] == $_SESSION['id'] or is_admin()) {
$output .= '<br/>' . url("groups/remsb/{$row['id']}", t("[remover]"));
}
$output .= '</p><hr size="1">';
}
}
section($output, t("Shoutbox do grupo"));
}
}
示例13: quickinfo
function quickinfo()
{
global $db, $sql_prefix;
$get = db("SELECT * FROM " . $sql_prefix . "quickinfo WHERE status = '1' ORDER BY RAND()", false, true);
if ($get['more'] != "") {
$more = '<a href="' . $get['more'] . '">' . _quickinfo_more . '</a>';
} else {
$more = '';
}
$quickinfo = show("menu/quickinfo", array("title" => $get['title'], "content" => bbcode($get['content']), "more" => $more));
return empty($quickinfo) ? '' : '<table class="navContent" cellspacing="0">' . $quickinfo . '</table>';
}
示例14: get
function get()
{
$status = strip_tags($_REQUEST['status']);
$room_id = intval(\App::$data['chat']['room_id']);
$stopped = x($_REQUEST, 'stopped') && intval($_REQUEST['stopped']) ? true : false;
if ($status && $room_id) {
$x = q("select channel_address from channel where channel_id = %d limit 1", intval(\App::$data['chat']['uid']));
$r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'", dbesc($status), dbesc(datetime_convert()), intval($room_id), dbesc(get_observer_hash()), dbesc($_SERVER['REMOTE_ADDR']));
goaway(z_root() . '/chat/' . $x[0]['channel_address'] . '/' . $room_id);
}
if (!$stopped) {
$lastseen = intval($_REQUEST['last']);
$ret = array('success' => false);
$sql_extra = permissions_sql(\App::$data['chat']['uid']);
$r = q("select * from chatroom where cr_uid = %d and cr_id = %d {$sql_extra}", intval(\App::$data['chat']['uid']), intval(\App::$data['chat']['room_id']));
if (!$r) {
json_return_and_die($ret);
}
$inroom = array();
$r = q("select * from chatpresence left join xchan on xchan_hash = cp_xchan where cp_room = %d order by xchan_name", intval(\App::$data['chat']['room_id']));
if ($r) {
foreach ($r as $rr) {
switch ($rr['cp_status']) {
case 'away':
$status = t('Away');
$status_class = 'away';
break;
case 'online':
default:
$status = t('Online');
$status_class = 'online';
break;
}
$inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'], 'name' => $rr['xchan_name'], 'status' => $status, 'status_class' => $status_class);
}
}
$chats = array();
$r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d order by created", intval(\App::$data['chat']['room_id']), intval($lastseen));
if ($r) {
foreach ($r as $rr) {
$chats[] = array('id' => $rr['chat_id'], 'img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'], 'name' => $rr['xchan_name'], 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'r'), 'text' => smilies(bbcode($rr['chat_text'])), 'self' => get_observer_hash() == $rr['chat_xchan'] ? 'self' : '');
}
}
}
$r = q("update chatpresence set cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'", dbesc(datetime_convert()), intval(\App::$data['chat']['room_id']), dbesc(get_observer_hash()), dbesc($_SERVER['REMOTE_ADDR']));
$ret['success'] = true;
if (!$stopped) {
$ret['inroom'] = $inroom;
$ret['chats'] = $chats;
}
json_return_and_die($ret);
}
示例15: help_content
function help_content(&$a)
{
nav_set_selected('help');
global $lang;
$doctype = 'markdown';
require_once 'library/markdown.php';
$text = '';
if (argc() > 1) {
$text = load_doc_file('doc/' . $a->argv[1] . '.md');
$a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-', ' ', notags(argv(1))));
}
if (!$text) {
$text = load_doc_file('doc/' . $a->argv[1] . '.bb');
if ($text) {
$doctype = 'bbcode';
}
$a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_', ' ', notags(argv(1))));
}
if (!$text) {
$text = load_doc_file('doc/' . $a->argv[1] . '.html');
if ($text) {
$doctype = 'html';
}
$a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-', ' ', notags(argv(1))));
}
if (!$text) {
$text = load_doc_file('doc/Site.md');
$a->page['title'] = t('Help');
}
if (!$text) {
$doctype = 'bbcode';
$text = load_doc_file('doc/main.bb');
$a->page['title'] = t('Help');
}
if (!strlen($text)) {
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
$tpl = get_markup_template("404.tpl");
return replace_macros($tpl, array('$message' => t('Page not found.')));
}
$text = preg_replace_callback("/#include (.*?)\\;/ism", 'preg_callback_help_include', $text);
if ($doctype === 'html') {
$content = $text;
}
if ($doctype === 'markdown') {
$content = Markdown($text);
}
if ($doctype === 'bbcode') {
require_once 'include/bbcode.php';
$content = bbcode($text);
}
return replace_macros(get_markup_template("help.tpl"), array('$content' => $content));
}