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');
}
Example #2
0
 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;
 }
Example #3
0
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;
}
Example #4
0
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;
}
Example #5
0
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>';
    }
}
Example #6
0
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');
}
Example #7
0
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);
}
Example #8
0
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"));
}
Example #9
0
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;
}
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');
}
Example #11
0
 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));
     }
 }
Example #12
0
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"));
    }
}
Example #13
0
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>';
}
Example #14
0
 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);
 }
Example #15
0
File: help.php Project: Mauru/red
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));
}
Example #16
0
function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true)
{
    $a = get_app();
    $OriginalText = $Text;
    // Since Diaspora is creating a summary for links, this function removes them before posting
    if ($fordiaspora) {
        $Text = bb_remove_share_information($Text);
    }
    /**
     * Transform #tags, strip off the [url] and replace spaces with underscore
     */
    $URLSearchString = "^\\[\\]";
    $Text = preg_replace_callback("/#\\[url\\=([{$URLSearchString}]*)\\](.*?)\\[\\/url\\]/i", create_function('$match', 'return \'#\'. str_replace(\' \', \'_\', $match[2]);'), $Text);
    // Converting images with size parameters to simple images. Markdown doesn't know it.
    $Text = preg_replace("/\\[img\\=([0-9]*)x([0-9]*)\\](.*?)\\[\\/img\\]/ism", '[img]$3[/img]', $Text);
    // Convert it to HTML - don't try oembed
    if ($fordiaspora) {
        $Text = bbcode($Text, $preserve_nl, false, 3);
        // Add all tags that maybe were removed
        if (preg_match_all("/#\\[url\\=([{$URLSearchString}]*)\\](.*?)\\[\\/url\\]/ism", $OriginalText, $tags)) {
            $tagline = "";
            foreach ($tags[2] as $tag) {
                $tag = html_entity_decode($tag, ENT_QUOTES, 'UTF-8');
                if (!strpos(html_entity_decode($Text, ENT_QUOTES, 'UTF-8'), "#" . $tag)) {
                    $tagline .= "#" . $tag . " ";
                }
            }
            $Text = $Text . " " . $tagline;
        }
    } else {
        $Text = bbcode($Text, $preserve_nl, false, 4);
    }
    // mask some special HTML chars from conversation to markdown
    $Text = str_replace(array('&lt;', '&gt;', '&amp;'), array('&_lt_;', '&_gt_;', '&_amp_;'), $Text);
    // If a link is followed by a quote then there should be a newline before it
    // Maybe we should make this newline at every time before a quote.
    $Text = str_replace(array("</a><blockquote>"), array("</a><br><blockquote>"), $Text);
    $stamp1 = microtime(true);
    // Now convert HTML to Markdown
    $Text = new HTML_To_Markdown($Text);
    // unmask the special chars back to HTML
    $Text = str_replace(array('&_lt_;', '&_gt_;', '&_amp_;'), array('&lt;', '&gt;', '&amp;'), $Text);
    $a->save_timestamp($stamp1, "parser");
    // Libertree has a problem with escaped hashtags.
    $Text = str_replace(array('\\#'), array('#'), $Text);
    // Remove any leading or trailing whitespace, as this will mess up
    // the Diaspora signature verification and cause the item to disappear
    $Text = trim($Text);
    call_hooks('bb2diaspora', $Text);
    return $Text;
}
 function show()
 {
     global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist, $UNI;
     if ($USER['authlevel'] < 3) {
         $this->printMessage("your dont have enough permissions!", true, array('game.php?page=Overview', 2));
         die;
     }
     if ($_POST) {
         $mode = HTTP::_GP('textArea', '');
         $mode1 = HTTP::_GP('subject', '');
         $mode2 = HTTP::_GP('type', '');
         $news = HTTP::_GP('news', 0);
         switch ($mode2) {
             case '1':
                 require_once 'includes/functions/BBCode.php';
                 $pmMessage = bbcode($mode);
                 $USERS = $GLOBALS['DATABASE']->query("SELECT `id`, `username` FROM " . USERS . " WHERE `universe` = " . $UNI . "");
                 while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
                     $sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
                     $sendMessage = '<span class="admin">' . $sendMessage . '</span>';
                     SendSimpleMessage($UserData['id'], $USER['id'], TIMESTAMP, 50, 'Game Info', $mode1, $sendMessage);
                 }
                 if ($news == 1) {
                     $GLOBALS['DATABASE']->query("INSERT INTO " . NEWS . " (`id` ,`user` ,`date` ,`title` ,`text`, `catID`) VALUES ( NULL , 'Thisishowwedoit', '" . TIMESTAMP . "', '" . $mode1 . "', '" . $pmMessage . "', '4') ;");
                 }
                 $this->printMessage("Message Send!", true, array('game.php?page=SendMessage', 2));
                 break;
             case '2':
                 require_once 'includes/functions/BBCode.php';
                 require 'includes/classes/Mail.class.php';
                 $pmMessage = bbcode($mode);
                 $USERS = $GLOBALS['DATABASE']->query("SELECT `email` FROM emails");
                 while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
                     // Dans le cas où nos lignes comportent plus de 70 caractères, nous les coupons en utilisant wordwrap()
                     $to = $UserData['email'];
                     $headers = 'MIME-Version: 1.0' . "\r\n";
                     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                     $headers .= 'From: no-reply@dark-space.org' . "\r\n";
                     $headers .= 'Reply-To: no-reply@dark-space.org' . "\r\n";
                     mail($to, $mode1, $pmMessage, $headers);
                 }
                 if ($news == 1) {
                     $GLOBALS['DATABASE']->query("INSERT INTO " . NEWS . " (`id` ,`user` ,`date` ,`title` ,`text`, `catID`) VALUES ( NULL , 'Thisishowwedoit', '" . TIMESTAMP . "', '" . $mode1 . "', '" . $pmMessage . "', '4') ;");
                 }
                 $this->printMessage("Mail Send!", true, array('game.php?page=SendMessage', 2));
                 break;
         }
     }
     $this->tplObj->assign_vars(array());
     $this->display('page.sendmes.default.tpl');
 }
Example #18
0
function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true)
{
    // Since Diaspora is creating a summary for links, this function removes them before posting
    if ($fordiaspora) {
        $Text = bb_remove_share_information($Text);
    }
    /**
     * Transform #tags, strip off the [url] and replace spaces with underscore
     */
    $URLSearchString = "^\\[\\]";
    $Text = preg_replace_callback("/#\\[url\\=([{$URLSearchString}]*)\\](.*?)\\[\\/url\\]/i", create_function('$match', 'return \'#\'. str_replace(\' \', \'_\', $match[2]);'), $Text);
    // Converting images with size parameters to simple images. Markdown doesn't know it.
    $Text = preg_replace("/\\[img\\=([0-9]*)x([0-9]*)\\](.*?)\\[\\/img\\]/ism", '[img]$3[/img]', $Text);
    // Convert it to HTML - don't try oembed
    if ($fordiaspora) {
        $Text = bbcode($Text, $preserve_nl, false, 3);
    } else {
        $Text = bbcode($Text, $preserve_nl, false, 4);
        // Libertree doesn't convert a harizontal rule if there isn't a linefeed
        $Text = str_replace("<hr />", "<br /><hr />", $Text);
    }
    // Now convert HTML to Markdown
    $md = new Markdownify(false, false, false);
    $Text = $md->parseString($Text);
    // The Markdownify converter converts underscores '_' in URLs to '\_', which
    // messes up the URL. Manually fix these
    $count = 1;
    $pos = bb_find_open_close($Text, '[', ']', $count);
    while ($pos !== false) {
        $start = substr($Text, 0, $pos['start']);
        $subject = substr($Text, $pos['start'], $pos['end'] - $pos['start'] + 1);
        $end = substr($Text, $pos['end'] + 1);
        $subject = str_replace('\\_', '_', $subject);
        $Text = $start . $subject . $end;
        $count++;
        $pos = bb_find_open_close($Text, '[', ']', $count);
    }
    // If the text going into bbcode() has a plain URL in it, i.e.
    // with no [url] tags around it, it will come out of parseString()
    // looking like: <http://url.com>, which gets removed by strip_tags().
    // So take off the angle brackets of any such URL
    $Text = preg_replace("/<http(.*?)>/is", "http\$1", $Text);
    // Remove all unconverted tags
    $Text = strip_tags($Text);
    // Remove any leading or trailing whitespace, as this will mess up
    // the Diaspora signature verification and cause the item to disappear
    $Text = trim($Text);
    call_hooks('bb2diaspora', $Text);
    return $Text;
}
Example #19
0
/** @file */
function format_notification($item)
{
    $ret = '';
    require_once 'include/conversation.php';
    // Call localize_item with the "brief" flag to get a one line status for activities.
    // This should set $item['localized'] to indicate we have a brief summary.
    localize_item($item);
    if ($item_localize) {
        $itemem_text = $item['localize'];
    } else {
        $itemem_text = $item['item_thread_top'] ? t('created a new post') : sprintf(t('commented on %s\'s post'), $item['owner']['xchan_name']);
    }
    // convert this logic into a json array just like the system notifications
    return array('notify_link' => $item['llink'], 'name' => $item['author']['xchan_name'], 'url' => $item['author']['xchan_url'], 'photo' => $item['author']['xchan_photo_s'], 'when' => relative_date($item['created']), 'class' => intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen', 'message' => strip_tags(bbcode($itemem_text)));
}
Example #20
0
function preg_callback_help_include($matches)
{
    if ($matches[1]) {
        $include = str_replace($matches[0], load_doc_file($matches[1]), $matches[0]);
        if (preg_match('/\\.bb$/', $matches[1]) || preg_match('/\\.txt$/', $matches[1])) {
            require_once 'include/bbcode.php';
            $include = bbcode($include);
            $include = str_replace(' target="_blank"', '', $include);
        } elseif (preg_match('/\\.md$/', $matches[1])) {
            require_once 'library/markdown.php';
            $include = Markdown($include);
        }
        return $include;
    }
}
Example #21
0
function siteinfo_content(&$a)
{
    if (!get_config('system', 'hidden_version_siteinfo')) {
        $version = sprintf(t('Version %s'), RED_VERSION);
        if (@is_dir('.git') && function_exists('shell_exec')) {
            $commit = @shell_exec('git log -1 --format="%h"');
        }
        if (!isset($commit) || strlen($commit) > 16) {
            $commit = '';
        }
    } else {
        $version = $commit = '';
    }
    $visible_plugins = array();
    if (is_array($a->plugins) && count($a->plugins)) {
        $r = q("select * from addon where hidden = 0");
        if (count($r)) {
            foreach ($r as $rr) {
                $visible_plugins[] = $rr['name'];
            }
        }
    }
    $plugins_list = '';
    if (count($visible_plugins)) {
        $plugins_text = t('Installed plugins/addons/apps:');
        $sorted = $visible_plugins;
        $s = '';
        sort($sorted);
        foreach ($sorted as $p) {
            if (strlen($p)) {
                if (strlen($s)) {
                    $s .= ', ';
                }
                $s .= $p;
            }
        }
        $plugins_list .= $s;
    } else {
        $plugins_text = t('No installed plugins/addons/apps');
    }
    $admininfo = bbcode(get_config('system', 'admininfo'));
    if (file_exists('doc/site_donate.html')) {
        $donate .= file_get_contents('doc/site_donate.html');
    }
    $o = replace_macros(get_markup_template('siteinfo.tpl'), array('$title' => t('Red'), '$description' => t('This is a hub of the Red Matrix - a global cooperative network of decentralized privacy enhanced websites.'), '$version' => $version, '$commit' => $commit, '$web_location' => t('Running at web location') . ' ' . z_root(), '$visit' => t('Please visit <a href="http://getzot.com">GetZot.com</a> to learn more about the Red Matrix.'), '$bug_text' => t('Bug reports and issues: please visit'), '$bug_link_url' => 'https://github.com/friendica/red/issues', '$bug_link_text' => 'redmatrix 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;
}
Example #22
0
File: menu.php Project: Mauru/red
function menu_render($menu, $class = '', $edit = false)
{
    if (!$menu) {
        return '';
    }
    for ($x = 0; $x < count($menu['items']); $x++) {
        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']);
    }
    return replace_macros(get_markup_template('usermenu.tpl'), array('$menu' => $menu['menu'], '$class' => $class, '$edit' => $edit ? t("Edit") : '', '$items' => $menu['items']));
}
Example #23
0
function babel_content(&$a)
{
    $o .= '<h1>Babel Diagnostic</h1>';
    $o .= '<form action="babel" method="post">';
    $o .= t('Source (bbcode) text:') . EOL . '<textarea name="text" >' . htmlspecialchars($_REQUEST['text']) . '</textarea>' . EOL;
    $o .= '<input type="submit" name="submit" value="Submit" /></form>';
    $o .= '<br /><br />';
    $o .= '<form action="babel" method="post">';
    $o .= t('Source (Diaspora) text to convert to BBcode:') . EOL . '<textarea name="d2bbtext" >' . htmlspecialchars($_REQUEST['d2bbtext']) . '</textarea>' . EOL;
    $o .= '<input type="submit" name="submit" value="Submit" /></form>';
    $o .= '<br /><br />';
    if (x($_REQUEST, 'text')) {
        $text = trim($_REQUEST['text']);
        $o .= "<h2>" . t("Source input: ") . "</h2>" . EOL . EOL;
        $o .= visible_lf($text) . EOL . EOL;
        $html = bbcode($text);
        $o .= "<h2>" . t("bb2html (raw HTML): ") . "</h2>" . EOL . EOL;
        $o .= htmlspecialchars($html) . EOL . EOL;
        //$html = bbcode($text);
        $o .= "<h2>" . t("bb2html: ") . "</h2>" . EOL . EOL;
        $o .= $html . EOL . EOL;
        $bbcode = html2bbcode($html);
        $o .= "<h2>" . t("bb2html2bb: ") . "</h2>" . EOL . EOL;
        $o .= visible_lf($bbcode) . EOL . EOL;
        $diaspora = bb2diaspora($text);
        $o .= "<h2>" . t("bb2md: ") . "</h2>" . EOL . EOL;
        $o .= visible_lf($diaspora) . EOL . EOL;
        $html = Markdown($diaspora);
        $o .= "<h2>" . t("bb2md2html: ") . "</h2>" . EOL . EOL;
        $o .= $html . EOL . EOL;
        $bbcode = diaspora2bb($diaspora);
        $o .= "<h2>" . t("bb2dia2bb: ") . "</h2>" . EOL . EOL;
        $o .= visible_lf($bbcode) . EOL . EOL;
        $bbcode = html2bbcode($html);
        $o .= "<h2>" . t("bb2md2html2bb: ") . "</h2>" . EOL . EOL;
        $o .= visible_lf($bbcode) . EOL . EOL;
    }
    if (x($_REQUEST, 'd2bbtext')) {
        $d2bbtext = trim($_REQUEST['d2bbtext']);
        $o .= "<h2>" . t("Source input (Diaspora format): ") . "</h2>" . EOL . EOL;
        $o .= visible_lf($d2bbtext) . EOL . EOL;
        $bb = diaspora2bb($d2bbtext);
        $o .= "<h2>" . t("diaspora2bb: ") . "</h2>" . EOL . EOL;
        $o .= visible_lf($bb) . EOL . EOL;
    }
    return $o;
}
Example #24
0
 public function index()
 {
     $rules = array();
     if (!$this->user()) {
         $rules['email'] = array('label' => $this('email'), 'type' => 'email', 'rules' => 'required');
     }
     $rules['subject'] = array('label' => $this('subject'), 'rules' => 'required');
     $rules['message'] = array('label' => $this('message'), 'type' => 'editor', 'rules' => 'required');
     $this->title($this('contact_us'))->load->library('form')->display_required(FALSE)->add_rules($rules)->add_captcha()->add_submit(icon('fa-envelope-o') . ' ' . $this('send'))->add_back('index.html');
     if ($this->form->is_valid($post)) {
         $this->load->library('email')->from($this->user() ? $this->user('email') : $post['email'])->to($this->config->nf_contact)->subject($this('contact') . ' :: ' . $post['subject'])->message('default', array('content' => function () use($post) {
             return bbcode($post['message']) . ($this->user() ? '<br /><br /><br />' . $this->user->link() : '');
         }))->send();
         redirect();
     }
     return new Panel(array('title' => $this('contact_us'), 'icon' => 'fa-envelope-o', 'content' => $this->form->display()));
 }
Example #25
0
function l_artikel()
{
    global $db, $maxlartikel, $lartikel, $allowHover;
    $qry = db("SELECT id,titel,text,autor,datum,kat,public FROM " . $db['artikel'] . "\n\t\t\t   WHERE public = 1\n               ORDER BY id DESC\n               LIMIT " . $maxlartikel . "");
    if (_rows($qry)) {
        while ($get = _fetch($qry)) {
            $qrykat = db("SELECT kategorie FROM " . $db['newskat'] . "\n                      WHERE id = '" . $get['kat'] . "'");
            $getkat = _fetch($qrykat);
            $text = strip_tags($get['text']);
            if ($allowHover == 1) {
                $info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . jsconvert(re($get['titel'])) . '</td></tr><tr><td><b>' . _datum . ':</b></td><td>' . date("d.m.Y H:i", $get['datum']) . _uhr . '</td></tr><tr><td><b>' . _autor . ':</b></td><td>' . rawautor($get['autor']) . '</td></tr><tr><td><b>' . _news_admin_kat . ':</b></td><td>' . jsconvert(re($getkat['kategorie'])) . '</td></tr><tr><td><b>' . _comments_head . ':</b></td><td>' . cnt($db['acomments'], "WHERE artikel = '" . $get['id'] . "'") . '</td></tr>\')" onmouseout="DZCP.hideInfo()"';
            }
            $l_articles .= show("menu/last_artikel", array("id" => $get['id'], "titel" => re(cut($get['titel'], $lartikel)), "text" => cut(bbcode($text), 260), "datum" => date("d.m.Y", $get['datum']), "info" => $info));
        }
    }
    return empty($l_articles) ? '' : '<table class="navContent" cellspacing="0">' . $l_articles . '</table>';
}
Example #26
0
function message_content(&$a)
{
    $o = '';
    nav_set_selected('messages');
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
        return login();
    }
    $channel = $a->get_channel();
    head_set_icon($channel['xchan_photo_s']);
    $cipher = get_pconfig(local_channel(), 'system', 'default_cipher');
    if (!$cipher) {
        $cipher = 'aes256';
    }
    $tpl = get_markup_template('mail_head.tpl');
    $header = replace_macros($tpl, array('$messages' => t('Messages'), '$tab_content' => $tab_content));
    if (argc() == 3 && argv(1) === 'dropconv') {
        if (!intval(argv(2))) {
            return;
        }
        $cmd = argv(1);
        $r = private_messages_drop(local_channel(), argv(2), true);
        if ($r) {
            info(t('Conversation removed.') . EOL);
        }
        goaway($a->get_baseurl(true) . '/message');
    }
    if (argc() == 1) {
        // list messages
        $o .= $header;
        // private_messages_list() can do other more complicated stuff, for now keep it simple
        $r = private_messages_list(local_channel(), '', $a->pager['start'], $a->pager['itemspage']);
        if (!$r) {
            info(t('No messages.') . EOL);
            return $o;
        }
        $tpl = get_markup_template('mail_list.tpl');
        foreach ($r as $rr) {
            $o .= replace_macros($tpl, array('$id' => $rr['id'], '$from_name' => $rr['from']['xchan_name'], '$from_url' => chanlink_hash($rr['from_xchan']), '$from_photo' => $rr['from']['xchan_photo_s'], '$to_name' => $rr['to']['xchan_name'], '$to_url' => chanlink_hash($rr['to_xchan']), '$to_photo' => $rr['to']['xchan_photo_s'], '$subject' => $rr['seen'] ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>', '$delete' => t('Delete conversation'), '$body' => smilies(bbcode($rr['body'])), '$date' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], t('D, d M Y - g:i A')), '$seen' => $rr['seen']));
        }
        $o .= alt_pager($a, count($r));
        return $o;
    }
}
Example #27
0
function share_init(&$a)
{
    $post_id = $a->argc > 1 ? intval($a->argv[1]) : 0;
    if (!$post_id || !local_user()) {
        killme();
    }
    $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", intval($post_id));
    if (!count($r) || $r[0]['private']) {
        killme();
    }
    $o = '';
    $o .= '&#x2672; <a href="' . $r[0]['author-link'] . '">' . $r[0]['author-name'] . '</a><br />';
    if ($r[0]['title']) {
        $o .= '<strong>' . $r[0]['title'] . '</strong><br />';
    }
    $o .= bbcode($r[0]['body'], true);
    echo $o . '<br />';
    killme();
}
Example #28
0
function notify_content(&$a)
{
    if (!local_user()) {
        return login();
    }
    $notif_tpl = get_markup_template('notifications.tpl');
    $not_tpl = get_markup_template('notify.tpl');
    require_once 'include/bbcode.php';
    $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", intval(local_user()));
    if (count($r) > 0) {
        foreach ($r as $it) {
            $notif_content .= replace_macros($not_tpl, array('$item_link' => $a->get_baseurl(true) . '/notify/view/' . $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date'])));
        }
    } else {
        $notif_content .= t('No more system notifications.');
    }
    $o .= replace_macros($notif_tpl, array('$notif_header' => t('System Notifications'), '$tabs' => '', '$notif_content' => $notif_content));
    return $o;
}
function newmemberwidget_network_mod_init($a, $b)
{
    if (x($_SESSION['new_member'])) {
        $t = '<div id="newmember_widget" class="widget">' . EOL;
        $t .= '<h3>' . t('New Member') . '</h3>' . EOL;
        $t .= '<a href="newmember" id="newmemberwidget-tips">' . t('Tips for New Members') . '</a><br />' . EOL;
        if (get_config('newmemberwidget', 'linkglobalsupport') == 1) {
            $t .= '<a href="https://helpers.pyxis.uberspace.de/profile/helpers" target="_new">' . t('Global Support Forum') . '</a><br />' . EOL;
        }
        if (get_config('newmemberwidget', 'linklocalsupport') == 1) {
            $t .= '<a href="' . $a->get_baseurl() . '/profile/' . get_config('newmemberwidget', 'localsupport') . '" target="_new">' . t('Local Support Forum') . '</a><br />' . EOL;
        }
        $ft = get_config('newmemberwidget', 'freetext');
        if (!trim($ft) == "") {
            $t .= '<p>' . bbcode(trim($ft)) . '</p>';
        }
        $t .= '</div><div class="clear"></div>';
        $a->page['aside'] = $t . $a->page['aside'];
    }
}
Example #30
0
    public function _team($team_id, $name, $title, $image_id, $icon_id, $description, $game_id, $game, $game_icon)
    {
        $this->title($title)->load->library('table')->add_columns(array(array('content' => function ($data) {
            return '<img class="img-avatar-members" style="max-height: 40px; max-width: 40px;" src="' . NeoFrag::loader()->user->avatar($data['avatar'], $data['sex']) . '" title="' . $data['username'] . '" alt="" />';
        }, 'size' => TRUE), array('content' => function ($data, $loader) {
            return '<div>' . NeoFrag::loader()->user->link($data['user_id'], $data['username']) . '</div><small>' . icon('fa-circle ' . ($data['online'] ? 'text-green' : 'text-gray')) . ' ' . $loader->lang($data['admin'] ? 'admin' : 'member') . ' ' . $loader->lang($data['online'] ? 'online' : 'offline') . '</small>';
        }), array('content' => function ($data) {
            return $data['title'];
        })))->data($this->model()->get_players($team_id))->no_data($this('no_players_on_team'));
        $panel = array('title' => '	<div class="pull-right">
								<span class="label label-default">' . $game . '</span>
							</div>
							<a href="' . url('teams/' . $team_id . '/' . $name . '.html') . '">' . $title . '</a>', 'body' => FALSE);
        $panel['content'] = $this->load->view('index', array('team_id' => $team_id, 'name' => $name, 'title' => $title, 'image_id' => $image_id, 'description' => bbcode($description), 'users' => $this->table->display()));
        if ($icon_id || $game_icon) {
            $panel['title'] = '<img src="' . path($icon_id ?: $game_icon) . '" alt="" /> ' . $panel['title'];
        } else {
            $panel['icon'] = 'fa-gamepad';
        }
        return array(new Panel($panel), new Button_back('teams.html'));
    }