Esempio n. 1
0
 public static function format_long_text($text)
 {
     $ret = htmlspecialchars($text);
     $ret = str_replace("\n", '<br>', $ret);
     $ret = Utils_BBCodeCommon::parse($ret);
     return $ret;
 }
Esempio n. 2
0
<?php

/**
 * Simple RSS Feed applet
 * @author jtylek@telaxus.com
 * @copyright 2008 Telaxus LLC
 * @license MIT
 * @version 1.0
 * @package epesi-applets
 * @subpackage rssfeed
 */
if (!isset($_POST['feed']) || !isset($_POST['number']) || !isset($_POST['cid'])) {
    die('Invalid request');
}
define('CID', $_POST['cid']);
define('READ_ONLY_SESSION', 1);
require_once '../../../include.php';
ModuleManager::load_modules();
require_once "rsslib.php";
function handle_rss_error($type, $message, $errfile, $errline, $errcontext)
{
    die(__('Error getting RSS: %s', array($message)));
}
set_error_handler('handle_rss_error');
$feed = $_POST['feed'];
$num = $_POST['number'];
echo Utils_BBCodeCommon::parse(RSS_Display($feed, $num));
exit;
Esempio n. 3
0
 public function history($uid = null)
 {
     $th = $this->init_module(Base_Theme::module_name());
     $th->assign('header', __('Shoutbox History'));
     $qf = $this->init_module(Libs_QuickForm::module_name());
     if (ModuleManager::is_installed('CRM_Contacts') >= 0) {
         $emps = DB::GetAssoc('SELECT l.id,' . DB::ifelse('cd.f_last_name!=\'\'', DB::concat('cd.f_last_name', DB::qstr(' '), 'cd.f_first_name'), 'l.login') . ' as name FROM user_login l LEFT JOIN contact_data_1 cd ON (cd.f_login=l.id AND cd.active=1) WHERE l.active=1 ORDER BY name');
     } else {
         $emps = DB::GetAssoc('SELECT id,login FROM user_login WHERE active=1 ORDER BY login');
     }
     $qf->addElement('select', 'user', __('User'), array('all' => '[' . __('All') . ']') + $emps);
     $qf->addElement('datepicker', 'from_date', __('From'));
     $qf->addElement('datepicker', 'to_date', __('To'));
     $qf->addElement('text', 'search', __('Search for'));
     $qf->addElement('submit', 'submit_button', __('Filter'));
     $to_date =& $this->get_module_variable('to_date');
     $from_date =& $this->get_module_variable('from_date');
     $user =& $this->get_module_variable('to', "all");
     $qf->setDefaults(array('from_date' => $from_date, 'to_date' => $to_date, 'user' => $uid));
     //if submited
     if ($qf->validate()) {
         $from_date = $qf->exportValue('from_date');
         $to_date = $qf->exportValue('to_date');
         $user = $qf->exportValue('user');
         $search_word = $qf->exportValue('search');
     }
     $qf->assign_theme('form', $th);
     $uid = is_numeric($user) ? $user : null;
     $date_where = '';
     if ($from_date) {
         $date_where .= 'AND posted_on>=' . DB::DBDate($from_date);
     }
     if ($to_date) {
         $date_where .= 'AND posted_on<=' . DB::DBDate($to_date);
     }
     if (isset($search_word) && $search_word) {
         $search_word = explode(' ', $search_word);
         foreach ($search_word as $word) {
             if ($word) {
                 $date_where .= ' AND message ' . DB::like() . ' ' . DB::Concat(DB::qstr('%'), DB::qstr(htmlspecialchars($word, ENT_QUOTES, 'UTF-8')), DB::qstr('%'));
             }
         }
     }
     $gb = $this->init_module(Utils_GenericBrowser::module_name(), null, 'shoutbox_history');
     $gb->set_table_columns(array(array('name' => __('From'), 'width' => 10), array('name' => __('To'), 'width' => 10), array('name' => __('Message'), 'width' => 64), array('name' => __('Date'), 'width' => 16)));
     // $gb->set_default_order(array(__('Date')=>'DESC'));
     $myid = Base_AclCommon::get_user();
     $where = '(' . ($uid ? '(base_user_login_id=' . $myid . ' AND to_user_login_id=' . $uid . ') OR (base_user_login_id=' . $uid . ' AND to_user_login_id=' . $myid . ') OR (to_user_login_id is null AND base_user_login_id=' . $uid . ')' : 'to_user_login_id is null OR to_user_login_id=' . $myid . ' OR base_user_login_id=' . $myid) . ')' . $date_where;
     $query = 'SELECT base_user_login_id, to_user_login_id, message, posted_on FROM apps_shoutbox_messages WHERE ' . $where . ' ORDER BY posted_on DESC';
     $query_qty = 'SELECT count(id) FROM apps_shoutbox_messages WHERE ' . $where;
     $ret = $gb->query_order_limit($query, $query_qty);
     if ($ret) {
         while ($row = $ret->FetchRow()) {
             $ulogin = Base_UserCommon::get_user_label($row['base_user_login_id']);
             if ($row['to_user_login_id'] !== null) {
                 $tologin = Base_UserCommon::get_user_label($row['to_user_login_id']);
             } else {
                 $tologin = '******' . __('All') . ']';
             }
             $gb->add_row('<span class="author">' . $ulogin . '</span>', '<span class="author">' . $tologin . '</span>', array('value' => Utils_BBCodeCommon::parse($row['message']), 'overflow_box' => false), Base_RegionalSettingsCommon::time2reg($row['posted_on']));
         }
     }
     $gb->set_inline_display(true);
     $th->assign('messages', $this->get_html_of_module($gb));
     $th->display();
     return true;
 }
Esempio n. 4
0
//print it out
foreach ($arr as $row) {
    $daydiff = floor((time() - strtotime($row['posted_on'])) / 86400);
    switch (true) {
        case $daydiff < 1:
            $fcolor = '#000000';
            break;
        case $daydiff < 3:
            $fcolor = '#444444';
            break;
        case $daydiff < 7:
            $fcolor = '#888888';
            break;
        default:
            $fcolor = '#AAAAAA';
    }
    $user_label = Apps_ShoutboxCommon::create_write_to_link($row['from_login_id']);
    if ($row['to_login_id']) {
        $user_label .= ' -> ' . Apps_ShoutboxCommon::create_write_to_link($row['to_login_id']);
    }
    print '<span class="author border_radius_3px dark_blue_gradient">' . $user_label . '</span><span class="time"> [' . Base_RegionalSettingsCommon::time2reg($row['posted_on'], 2) . ']</span><br/><span class="shoutbox_textbox"style="color:' . $fcolor . ';">' . ($row['to_login_id'] == $myid && $uid === null ? '<b>' : '') . Utils_BBCodeCommon::parse($row['message']) . ($row['to_login_id'] == $myid && $uid === null ? '</b>' : '') . '</span><hr/>';
}
$content = ob_get_contents();
ob_end_clean();
require_once 'libs/minify/HTTP/Encoder.php';
$he = new HTTP_Encoder(array('content' => $content));
if (MINIFY_ENCODE) {
    $he->encode();
}
$he->sendAll();
exit;
Esempio n. 5
0
    public static function display_note($row, $nolink = false, $a=null,$view=false) {
        $inline_img = '';
        $link_href = '';
        $link_img = '';
        $icon = '';
        $crypted = Utils_RecordBrowserCommon::get_value('utils_attachment',$row['id'],'crypted');
        if(!$crypted || isset($_SESSION['client']['cp'.$row['id']])) {
            $files = DB::GetAll('SELECT id, created_by, created_on, original, (SELECT count(*) FROM utils_attachment_download uad WHERE uaf.id=uad.attach_file_id) as downloads FROM utils_attachment_file uaf WHERE uaf.attach_id=%d AND uaf.deleted=0', array($row['id']));
            foreach ($files as $f) {
                $f_filename = DATA_DIR.'/Utils_Attachment/'.$row['id'].'/'.$f['id'];
                if(file_exists($f_filename)) {
                    $filename = $f['original'];
                    $filetooltip = __('Filename: %s',array($filename)).'<br>'.__('File size: %s',array(filesize_hr($f_filename))).'<hr>'.
                        __('Last uploaded by %s', array(Base_UserCommon::get_user_label($f['created_by'], true))).'<br/>'.
                        __('On: %s',array(Base_RegionalSettingsCommon::time2reg($f['created_on']))).'<br/>'.
                        __('Number of downloads: %d',array($f['downloads']));
                    $view_link = '';
                    $lb = array();
                    $lb['aid'] = $row['id'];
                    $lb['crypted'] = $crypted;
                    $lb['original'] = $f['original'];
                    $lb['id'] = $f['id'];
                    $link_href = Utils_TooltipCommon::open_tag_attrs($filetooltip).' '.self::get_file_leightbox($lb,$view_link);
                    $link_img = Base_ThemeCommon::get_template_file('Utils_Attachment','z-attach.png');
                    if(Utils_AttachmentCommon::is_image($filename) && $view_link)
                        $inline_img .= '<hr><a href="'.$view_link.'" target="_blank"><img src="'.$view_link.'" style="max-width:700px" /></a><br>';
                } else {
                    $filename = __('Missing file: %s',array($f_filename));
                    $link_href = Utils_TooltipCommon::open_tag_attrs($filename);
                    $link_img = Base_ThemeCommon::get_template_file('Utils_Attachment','z-attach-off.png');
                }
                if ($link_href)
                    $icon .= '<div class="file_link"><a '.$link_href.'><img src="'.$link_img.'"><span class="file_name">'.$filename.'</span></a></div>';
            }
        }

        if($crypted) {
            $text = false;
            if(isset($_SESSION['client']['cp'.$row['id']])) {
                $note_pass = $_SESSION['client']['cp'.$row['id']];
                $decoded = Utils_AttachmentCommon::decrypt($row['note'],$note_pass);
                if($decoded!==false) {
                    $text = $decoded;
                    Utils_WatchdogCommon::notified('utils_attachment', $row['id']); // notified only when decrypted
                }
            }
            if($text===false) {
                $text = '<div id="note_value_'.$row['id'].'"><a href="javascript:void(0);" onclick="utils_attachment_password(\''.Epesi::escapeJS(__('Password').':').'\',\''.Epesi::escapeJS(__('OK')).'\','.$row['id'].')" style="color:red">'.__('Note encrypted').'</a></div>';
                $icon = '';
                $files = array();
            } else {
                $text = Utils_BBCodeCommon::parse($text);
            }
        } else {
            $text = $row['note'];
            $text = Utils_BBCodeCommon::parse($text);
            // mark as read all 'browsed' records
            foreach (self::$mark_as_read as $note_id) {
                Utils_WatchdogCommon::notified('utils_attachment', $note_id);
            }
            self::$mark_as_read = array();
        }

        $text = (!$view?'<b style="float:left;margin-right:30px;">'.$row['title'].'</b> ':'').$text.$icon.$inline_img;
        if($row['sticky']) $text = '<img src="'.Base_ThemeCommon::get_template_file('Utils_Attachment','sticky.png').'" hspace=3 align="left"> '.$text;

        return $text;
    }