Exemple #1
0
 function stripBBCode($txt, $len = 0)
 {
     if (!$txt) {
         return;
     }
     if (!self::$emoticons) {
         self::$emoticons = smile::getEmoticons(0);
     }
     $txt = smile::purify($txt);
     if ($len && JString::strlen($txt) > $len) {
         $txt = JString::substr($txt, 0, $len) . '...';
     }
     $txt = self::escape($txt);
     $txt = self::prepareContent($txt);
     return $txt;
 }
Exemple #2
0
 }
 unset($result);
 $kunena_db->setQuery("SELECT COUNT(*) AS totalmessages FROM #__fb_messages WHERE thread='{$querythread}'");
 $result = $kunena_db->loadObject();
 check_dberror("Unable to load messages.");
 $threadPages = ceil($result->totalmessages / $fbConfig->messages_per_page);
 //construct a useable URL (for plaintext - so no & encoding!)
 jimport('joomla.environment.uri');
 $uri =& JURI::getInstance(JURI::base());
 $LastPostUrl = $uri->toString(array('scheme', 'host', 'port')) . str_replace('&', '&', CKunenaLink::GetThreadPageURL($fbConfig, 'view', $catid, $querythread, $threadPages, $fbConfig->messages_per_page, $pid));
 //Now manage the subscriptions (only if subscriptions are allowed)
 if ($fbConfig->allowsubscriptions == 1 && $holdPost == 0) {
     //they're allowed
     //get the proper user credentials for each subscription to this topic
     //clean up the message
     $mailmessage = smile::purify($message);
     $kunena_db->setQuery("SELECT * FROM #__fb_subscriptions AS a" . " LEFT JOIN #__users AS u ON a.userid=u.id " . " WHERE u.block='0' AND a.thread='{$querythread}'");
     $subsList = $kunena_db->loadObjectList();
     check_dberror("Unable to load subscriptions.");
     if (count($subsList) > 0) {
         //we got more than 0 subscriptions
         require_once KUNENA_PATH_LIB . DS . 'kunena.mail.php';
         // include fbMail class for mailing
         $_catobj = new jbCategory($kunena_db, $catid);
         foreach ($subsList as $subs) {
             //check for permission
             if ($subs->id) {
                 $_arogrp = $kunena_acl->getAroGroup($subs->id);
                 $_arogrp->group_id = $_arogrp->id;
                 $_isadm = strtolower($_arogrp->name) == 'super administrator' || strtolower($_arogrp->name) == 'administrator';
             }
    /**
     * Display results
     * @param string actionstring
     */
    function show()
    {
        $fbConfig =& CKunenaConfig::getInstance();
        extract($this->params);
        $q = implode(" ", $this->get_searchstrings());
        $searchuser = $this->get_searchusername();
        $limitstart = $this->get_limitstart();
        $limit = $this->get_limit();
        $selected = ' selected="selected"';
        $checked = ' checked="checked"';
        $fb_advsearch_hide = 1;
        if ($this->int_kunena_errornr) {
            $q = $this->searchword;
            $fb_advsearch_hide = 0;
        }
        if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/advancedsearch/advsearch.php')) {
            include KUNENA_ABSTMPLTPATH . '/plugin/advancedsearch/advsearch.php';
        } else {
            include KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'plugin/advancedsearch/advsearch.php';
        }
        $results = $this->get_results();
        $totalRows = $this->total;
        $pagination = KunenaSearchPagination($this->func, $q, $this->getUrlParams(), floor($limitstart / $limit) + 1, $limit, floor($totalRows / $limit) + 1, 7);
        if (defined('KUNENA_DEBUG')) {
            echo '<p style="background-color:#FFFFCC;border:1px solid red;">' . $this->str_kunena_errormsg . '</p>';
        }
        ?>

<?php 
        if (empty($q) && empty($searchuser)) {
            return;
        }
        $boardclass = 'fb_';
        ?>
<div class="<?php 
        echo $boardclass;
        ?>
_bt_cvr1">
<div class="<?php 
        echo $boardclass;
        ?>
_bt_cvr2">
<div class="<?php 
        echo $boardclass;
        ?>
_bt_cvr3">
<div class="<?php 
        echo $boardclass;
        ?>
_bt_cvr4">
<div class="<?php 
        echo $boardclass;
        ?>
_bt_cvr5">
        <table  class = "fb_blocktable" id ="fb_forumsearch"  border = "0" cellspacing = "0" cellpadding = "0" width="100%">
            <thead>
                <tr>
                    <th colspan = "3">
                        <div class = "fb_title_cover">
                            <span class="fb_title fbl"><?php 
        echo _KUNENA_SEARCH_RESULTS;
        ?>
</span>
                            <b><?php 
        printf(_FORUM_SEARCH, $q);
        ?>
</b>
                        </div>
                    </th>
                </tr>
            </thead>

            <tbody>
                <tr class = "fb_sth">
                    <th class = "th-1 <?php 
        echo $boardclass;
        ?>
sectiontableheader">
<?php 
        echo _GEN_SUBJECT;
        ?>
                    </th>

                    <th class = "th-2 <?php 
        echo $boardclass;
        ?>
sectiontableheader">
<?php 
        echo _GEN_AUTHOR;
        ?>
                    </th>

                    <th class = "th-3 <?php 
        echo $boardclass;
        ?>
sectiontableheader">
<?php 
        echo _GEN_DATE;
        ?>
                    </th>
                </tr>

                <?php 
        $tabclass = array("sectiontableentry1", "sectiontableentry2");
        $k = 0;
        if ($totalRows == 0 && $this->int_kunena_errornr) {
            echo '<tr class="' . $boardclass . '' . $tabclass[$k] . '" ><td colspan="3"  style="text-align:center;font-weight:bold">' . $this->str_kunena_errormsg . '</td></tr>';
        }
        // Cleanup incoming searchword; international chars can cause garbage at the end
        // real problem might lie with search box form and how we post and receive the data
        // However, this works for now
        $q = trim($q);
        // JJ Add different color
        $searchlist = $this->get_searchstrings();
        foreach ($results as $result) {
            $k = 1 - $k;
            $ressubject = $result->subject;
            // Clean up subject
            $ressubject = stripslashes(smile::purify($ressubject));
            $resmessage = stripslashes($result->message);
            // Strip smiles and bbcode out of search results; they look ugly
            $resmessage = CKunenaTools::prepareContent($resmessage);
            $resmessage = smile::purify($resmessage);
            $resmessage = kn_mb_substr(kunena_htmlspecialchars($resmessage), 0, 300);
            $utf8 = KUNENA_CHARSET == 'UTF-8' ? "u" : "";
            foreach ($searchlist as $searchword) {
                if (empty($searchword)) {
                    continue;
                }
                $ressubject = preg_replace("/" . preg_quote($searchword, '/') . "/i" . $utf8, '<span  class="searchword" >' . $searchword . '</span>', $ressubject);
                $resmessage = preg_replace("/" . preg_quote($searchword, '/') . "/i" . $utf8, '<span  class="searchword" >' . $searchword . '</span>', $resmessage);
            }
            echo '<tr class="' . $boardclass . '' . $tabclass[$k] . '">';
            echo '<td  class = "td-1" ><a href="' . JRoute::_(KUNENA_LIVEURL . '&amp;func=view&amp;id=' . $result->id . '&amp;catid=' . $result->catid) . '#' . $result->id . '" >' . $ressubject . '</a><br />' . $resmessage . '<br /><br /></td>';
            echo '<td class = "td-2" >' . kunena_htmlspecialchars(stripslashes($result->name)) . '</td>';
            echo '<td class = "td-3" >' . date(_DATETIME, $result->time) . '</td></tr>';
            echo "\n";
        }
        ?>

                <?php 
        if ($totalRows > $limit) {
            ?>

                    <tr  class = "fb_sth" >
                        <th colspan = "3" style = "text-align:center" class = "th-1 <?php 
            echo $boardclass;
            ?>
sectiontableheader">
                            <?php 
            echo $pagination;
            ?>
                        </th>
                    </tr>

                <?php 
        }
        ?>

                <tr  class = "fb_sth" >
                   <th colspan = "3" style = "text-align:center" class = "th-1 <?php 
        echo $boardclass;
        ?>
sectiontableheader">
                        <?php 
        $resStart = $limitstart + 1;
        $resStop = $limitstart + count($results);
        if ($resStart < $resStop) {
            $resStartStop = (string) $resStart . ' - ' . (string) $resStop;
        } else {
            $resStartStop = '0';
        }
        printf(_FORUM_SEARCHRESULTS, $resStartStop, $totalRows);
        ?>
                    </th>
                </tr>
            </tbody>
        </table>
</div>
</div>
</div>
</div>
</div>
<?php 
    }
Exemple #4
0
$kunena_db->setQuery($query, $offset, $threads_per_page);
$threadids = $kunena_db->loadResultArray();
check_dberror("Unable to load thread list.");
$idstr = @join(",", $threadids);
$favthread = array();
$thread_counts = array();
$messages = array();
$messages[0] = array();
if (count($threadids) > 0) {
    $query = "SELECT a.*, j.id AS userid, t.message AS messagetext, l.myfavorite, l.favcount, l.attachmesid, l.msgcount, l.lastid, u.avatar, c.id AS catid, c.name AS catname\n\tFROM (\n\t\tSELECT m.thread, (f.userid IS NOT null AND f.userid='{$kunena_my->id}') AS myfavorite, COUNT(DISTINCT f.userid) AS favcount, COUNT(a.mesid) AS attachmesid,\n\t\t\tCOUNT(DISTINCT m.id) AS msgcount, MAX(m.id) AS lastid, MAX(m.time) AS lasttime\n\t\tFROM #__fb_messages AS m\n\t\tLEFT JOIN #__fb_favorites AS f ON f.thread = m.thread\n\t\tLEFT JOIN #__fb_attachments AS a ON a.mesid = m.thread\n\t\tWHERE m.hold='0' AND m.moved='0' AND m.thread IN ({$idstr})\n\t\tGROUP BY thread\n\t) AS l\n\tINNER JOIN #__fb_messages AS a ON a.thread = l.thread\n\tINNER JOIN #__fb_messages_text AS t ON a.thread = t.mesid\n\tLEFT JOIN #__users AS j ON j.id = a.userid\n\tLEFT JOIN #__fb_users AS u ON u.userid = j.id\n\tLEFT JOIN #__fb_categories AS c ON c.id = a.catid\n\tWHERE (a.parent='0' OR a.id=l.lastid)\n\tORDER BY {$order}";
    $kunena_db->setQuery($query);
    $messagelist = $kunena_db->loadObjectList();
    check_dberror("Unable to load messages.");
    foreach ($messagelist as $message) {
        $messages[$message->parent][] = $message;
        $messagetext[$message->id] = substr(smile::purify($message->messagetext), 0, 500);
        if ($message->parent == 0) {
            $hits[$message->id] = $message->hits;
            $thread_counts[$message->id] = $message->msgcount - 1;
            $last_read[$message->id]->unread = 0;
            if ($message->favcount) {
                $favthread[$message->id] = $message->favcount;
            }
            if ($message->id == $message->lastid) {
                $last_read[$message->id]->lastread = $last_reply[$message->id] = $message;
            }
        } else {
            $last_read[$message->thread]->lastread = $last_reply[$message->thread] = $message;
        }
    }
    $kunena_db->setQuery("SELECT thread, MIN(id) AS lastread, SUM(1) AS unread FROM #__fb_messages " . "WHERE hold='0' AND moved='0' AND thread IN ({$idstr}) AND time>'{$prevCheck}' GROUP BY thread");
Exemple #5
0
        <image>
	        <url><?php 
echo KUNENA_URLEMOTIONSPATH;
?>
rss.gif</url>
	        <title>Powered by Kunena</title>
	        <link><?php 
echo JURI::root();
?>
</link>
	        <description>Kunena Site Syndication</description>
        </image>
<?php 
foreach ($rows as $row) {
    echo "        <item>\n";
    echo "            <title>" . _GEN_SUBJECT . ": " . stripslashes(kunena_htmlspecialchars($row->subject)) . " - " . _GEN_BY . ": " . stripslashes(kunena_htmlspecialchars($row->lastpostname)) . "</title>" . "\n";
    echo "            <link>";
    $uri =& JURI::getInstance(JURI::base());
    $itemlink = $uri->toString(array('scheme', 'host', 'port')) . CKunenaLink::GetThreadPageURL($fbConfig, 'view', $row->catid, $row->thread, ceil($row->numberposts / $fbConfig->messages_per_page), $fbConfig->messages_per_page, $row->lastpostid);
    echo $itemlink;
    echo "</link>\n";
    $words = $row->lastpostmessage;
    $words = smile::purify($words);
    echo "            <description>" . kunena_htmlspecialchars($words) . "</description>" . "\n";
    echo "            <pubDate>" . date('r', $row->lastposttime) . "</pubDate>" . "\n";
    echo "        </item>\n";
}
?>
    </channel>
</rss>
Exemple #6
0
             if ($fbConfig->alphauserpointsnumchars > 0) {
                 // use if limit chars for a response
                 if (strlen($message) > $fbConfig->alphauserpointsnumchars) {
                     AlphaUserPointsHelper::newpoints('plgaup_reply_kunena', '', $pid, $datareference);
                 } else {
                     $app->enqueueMessage(_KUNENA_AUP_MESSAGE_TOO_SHORT);
                 }
             } else {
                 AlphaUserPointsHelper::newpoints('plgaup_reply_kunena', '', $pid, $datareference);
             }
         }
     }
 }
 // end insertion AlphaUserPoints
 //clean up the message for review
 $mailmessage = smile::purify(stripslashes($message));
 //get all subscriptions and moderators
 $emailToList = CKunenaTools::getEMailToList($catid, $querythread, $fbConfig->allowsubscriptions && !$holdPost, $fbConfig->mailmod, $fbConfig->mailadmin, $kunena_my->id);
 //Now manage the subscriptions (only if subscriptions are allowed)
 if (count($emailToList)) {
     jimport('joomla.mail.helper');
     if (!$fbConfig->email || !JMailHelper::isEmailAddress($fbConfig->email)) {
         $app->enqueueMessage(_KUNENA_EMAIL_INVALID, 'error');
     } else {
         $mailsender = JMailHelper::cleanAddress(stripslashes($board_title) . " " . _GEN_FORUM);
         $mailsubject = JMailHelper::cleanSubject("[" . stripslashes($board_title) . " " . _GEN_FORUM . "] " . stripslashes($messagesubject) . " (" . stripslashes($catName) . ")");
         foreach ($emailToList as $emailTo) {
             if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
                 continue;
             }
             if ($emailTo->subscription) {