Пример #1
0
 function fbGetShowTime($time = null, $space = 'FB')
 {
     // converts internal (FB)|UTC representing time to display time
     // could consider user properties (zones) for future
     $kunena_db =& JFactory::getDBO();
     $fbConfig =& CKunenaConfig::getInstance();
     // Prevent zeroes
     if ($time === 0) {
         return 0;
     }
     if ($time === null) {
         $time = CKunenaTools::fbGetInternalTime();
         $space = 'FB';
     }
     if ($space == 'UTC') {
         return $time + $fbConfig->board_ofset * 3600;
     }
     return $time;
 }
Пример #2
0
 $userid = $mes->userid;
 //Check for a moderator or superadmin
 if ($is_Moderator) {
     $allowEdit = 1;
 }
 if ($fbConfig->useredit == 1 && $kunena_my->id != "") {
     //Now, if the author==viewer and the viewer is allowed to edit his/her own post the let them edit
     if ($kunena_my->id == $userid) {
         if ((int) $fbConfig->useredittime == 0) {
             $allowEdit = 1;
         } else {
             $modtime = $mes->modified_time;
             if (!$modtime) {
                 $modtime = $mes->time;
             }
             if ($modtime + (int) $fbConfig->useredittime + (int) $fbConfig->useredittimegrace >= CKunenaTools::fbGetInternalTime()) {
                 $allowEdit = 1;
             }
         }
     }
 }
 if ($allowEdit == 1) {
     if (is_array($attachfile) && $attachfile['error'] != UPLOAD_ERR_NO_FILE) {
         include KUNENA_PATH_LIB . DS . 'kunena.file.upload.php';
     }
     if (is_array($attachimage) && $attachimage['error'] != UPLOAD_ERR_NO_FILE) {
         include KUNENA_PATH_LIB . DS . 'kunena.image.upload.php';
     }
     //$message = trim(kunena_htmlspecialchars(addslashes($message)));
     $message = trim(addslashes($message));
     //parse the message for some preliminary bbcode and stripping of HTML
Пример #3
0
<table border = 0 cellspacing = 0 cellpadding = 0 width = "100%" align = "center">
    <tr>
        <td>
            <br>
            <center>
                <?php 
//I hope these are needed :)
$catid = (int) $catid;
$pid = (int) $pid;
//This checks:
// - if the karma function is activated by the admin
// - if a registered user submits the modify request
// - if he specifies an action related to the karma change
// - if he specifies the user that will have the karma modified
if ($fbConfig->showkarma && $kunena_my->id != "" && $kunena_my->id != 0 && $do != '' && $userid != '') {
    $time = CKunenaTools::fbGetInternalTime();
    if ($kunena_my->id != $userid) {
        // This checkes to see if it's not too soon for a new karma change
        if (!$is_Moderator) {
            $kunena_db->setQuery("SELECT karma_time FROM #__fb_users WHERE userid='{$kunena_my->id}'");
            $karma_time_old = $kunena_db->loadResult();
            $karma_time_diff = $time - $karma_time_old;
        }
        if ($is_Moderator || $karma_time_diff >= $karma_min_seconds) {
            if ($do == "increase") {
                $kunena_db->setQuery('UPDATE #__fb_users SET karma_time=' . $time . ' WHERE userid=' . $kunena_my->id . '');
                $kunena_db->query() or trigger_dberror("Unable to update karma.");
                $kunena_db->setQuery('UPDATE #__fb_users SET karma=karma+1 WHERE userid=' . $userid . '');
                $kunena_db->query() or trigger_dberror("Unable to update karma.");
                echo _KARMA_INCREASED . '<br /> <a href="' . JRoute::_(KUNENA_LIVEURLREL . '&amp;func=view&amp;catid=' . $catid . '&amp;id=' . $pid) . '">' . _POST_CLICK . '</a>.';
                if ($pid) {
Пример #4
0
function doprune($kunena_db, $option)
{
    $app =& JFactory::getApplication();
    $catid = intval(JRequest::getVar('prune_forum', -1));
    $deleted = 0;
    if ($catid == -1) {
        echo "<script> alert('" . _KUNENA_CHOOSEFORUMTOPRUNE . "'); window.history.go(-1); </script>\n";
        $app->close();
    }
    $prune_days = intval(JRequest::getVar('prune_days', 0));
    //get the thread list for this forum
    $kunena_db->setQuery("SELECT DISTINCT a.thread AS thread, max(a.time) AS lastpost, c.locked AS locked " . "\n FROM #__fb_messages AS a" . "\n JOIN #__fb_categories AS b ON a.catid=b.id " . "\n JOIN #__fb_messages   AS c ON a.thread=c.thread" . "\n where a.catid={$catid} " . "\n and b.locked != 1 " . "\n and a.locked != 1 " . "\n and c.locked != 1 " . "\n and c.parent = 0 " . "\n and c.ordering != 1 " . "\n group by thread");
    $threadlist = $kunena_db->loadObjectList();
    check_dberror("Unable to load thread list.");
    // Convert days to seconds for timestamp functions...
    $prune_date = CKunenaTools::fbGetInternalTime() - $prune_days * 86400;
    if (count($threadlist) > 0) {
        foreach ($threadlist as $tl) {
            //check if thread is eligible for pruning
            if ($tl->lastpost < $prune_date) {
                //get the id's for all posts belonging to this thread
                $kunena_db->setQuery("SELECT id from #__fb_messages WHERE thread={$tl->thread}");
                $idlist = $kunena_db->loadObjectList();
                check_dberror("Unable to load thread messages.");
                if (count($idlist) > 0) {
                    foreach ($idlist as $id) {
                        //prune all messages belonging to the thread
                        $kunena_db->setQuery("DELETE FROM #__fb_messages WHERE id={$id->id}");
                        $kunena_db->query() or trigger_dberror("Unable to delete messages.");
                        $kunena_db->setQuery("DELETE FROM #__fb_messages_text WHERE mesid={$id->id}");
                        $kunena_db->query() or trigger_dberror("Unable to delete message texts.");
                        //delete all attachments
                        $kunena_db->setQuery("SELECT filelocation FROM #__fb_attachments WHERE mesid={$id->id}");
                        $fileList = $kunena_db->loadObjectList();
                        check_dberror("Unable to load attachments.");
                        if (count($fileList) > 0) {
                            foreach ($fileList as $fl) {
                                unlink($fl->filelocation);
                            }
                            $kunena_db->setQuery("DELETE FROM #__fb_attachments WHERE mesid={$id->id}");
                            $kunena_db->query() or trigger_dberror("Unable to delete attachments.");
                        }
                        $deleted++;
                    }
                }
            }
            //clean all subscriptions to these deleted threads
            $kunena_db->setQuery("DELETE FROM #__fb_subscriptions WHERE thread={$tl->thread}");
            $kunena_db->query() or trigger_dberror("Unable to delete subscriptions.");
        }
    }
    $app->redirect(JURI::base() . "index2.php?option={$option}&task=pruneforum", "" . _KUNENA_FORUMPRUNEDFOR . " " . $prune_days . " " . _KUNENA_PRUNEDAYS . "; " . _KUNENA_PRUNEDELETED . $deleted . " " . _KUNENA_PRUNETHREADS);
}
Пример #5
0
"></a>
<?php 
echo CKunenaLink::GetSamePageAnkerLink($msg_id, '#' . $msg_id);
?>
            </th>
        </tr>

        <tr> <!-- -->

        <td class = "fb-msgview-right">
                <table width = "100%" border = "0" cellspacing = "0" cellpadding = "0">
                    <tr>
                        <td align = "left">
                            <?php 
$msg_time_since = _KUNENA_TIME_SINCE;
$msg_time_since = str_replace('%time%', time_since($fmessage->time, CKunenaTools::fbGetInternalTime()), $msg_time_since);
if ($prevCheck < $fmessage->time && !in_array($fmessage->thread, $read_topics)) {
    $msgtitle = 'msgtitle_new';
} else {
    $msgtitle = 'msgtitle';
}
?>
                            <span class = "<?php 
echo $msgtitle;
?>
"><?php 
echo $msg_subject;
?>
 </span> <span class = "msgdate" title="<?php 
echo $msg_date;
?>
Пример #6
0
function SendClexusPM($reporter, $subject, $message, $msglink, $mods, $admins)
{
    $kunena_db =& JFactory::getDBO();
    $time = JHTML::_('date', CKunenaTools::fbGetInternalTime(), '%Y-%m-%d %H:%M:%S');
    foreach ($admins as $admin) {
        $kunena_db->setQuery("INSERT INTO #__mypms" . "\n ( `userid` , `whofrom` , `time` , `readstate` , `subject` , `message` , `owner` , `folder` , `sent_id` , `replyid` , `ip` , `alert` , `flag` , `pm_notify` , `email_notify` )" . "\n VALUES ('{$admin->id}', '{$reporter}', '{$time}', '0', '{$subject}', '{$message}', '{$admin->id}', NULL , '0', '0', NULL , '0', '0', '0', '1'");
        $kunena_db->query();
    }
    foreach ($mods as $mod) {
        $kunena_db->setQuery("INSERT INTO #__mypms" . "\n ( `userid` , `whofrom` , `time` , `readstate` , `subject` , `message` , `owner` , `folder` , `sent_id` , `replyid` , `ip` , `alert` , `flag` , `pm_notify` , `email_notify` )" . "\n VALUES ('{$mod->id}', '{$reporter}', '{$time}', '0', '{$subject}', '{$message}', '{$mod->id}', NULL , '0', '0', NULL , '0', '0', '0', '1'");
        $kunena_db->query();
    }
}