예제 #1
0
 /**
  * adds the link for the connect param
  * @since 1.7.3
  * @param  $user pass-by-reference
  * @return void
  */
 private function getUserLink(&$user)
 {
     $username = KunenaFactory::getUser($user['userid'])->getName();
     if ($user['leapcorrection'] == $this->timeo->format('z', true) + 1) {
         $subject = getSubject($username);
         $db = JFactory::getDBO();
         $query = "SELECT id,catid,subject,time as year FROM #__kunena_messages WHERE subject='{$subject}'";
         $db->setQuery($query, 0, 1);
         $post = $db->loadAssoc();
         if ($db->getErrorMsg()) {
             KunenaError::checkDatabaseError();
         }
         $catid = $this->params->get('bcatid');
         $postyear = new JDate($post['year'], $this->soffset);
         if (empty($post) && !empty($catid) || !empty($post) && !empty($catid) && $postyear->format('Y', true) < $this->timeo->format('Y', true)) {
             $botname = $this->params->get('swkbbotname', JText::_('SW_KBIRTHDAY_FORUMPOST_BOTNAME_DEF'));
             $botid = $this->params->get('swkbotid');
             $time = CKunenaTimeformat::internalTime();
             //Insert the birthday thread into DB
             $query = "INSERT INTO #__kunena_messages (catid,name,userid,email,subject,time, ip)\n\t\t    \t\tVALUES({$catid},'{$botname}',{$botid}, '','{$subject}', {$time}, '')";
             $db->setQuery($query);
             $db->query();
             if ($db->getErrorMsg()) {
                 KunenaError::checkDatabaseError();
             }
             //What ID get our thread?
             $messid = (int) $db->insertID();
             //Insert the thread message into DB
             $message = getMessage($username);
             $query = "INSERT INTO #__kunena_messages_text (mesid,message)\n                    VALUES({$messid},'{$message}')";
             $db->setQuery($query);
             $db->query();
             if ($db->getErrorMsg()) {
                 KunenaError::checkDatabaseError();
             }
             //We know the thread ID so we can update the parent thread id with it's own ID because we know it's
             //the first post
             $query = "UPDATE #__kunena_messages SET thread={$messid} WHERE id={$messid}";
             $db->setQuery($query);
             $db->query();
             if ($db->getErrorMsg()) {
                 KunenaError::checkDatabaseError();
             }
             // now increase the #s in categories
             CKunenaTools::modifyCategoryStats($messid, 0, $time, $catid);
             $user['link'] = CKunenaLink::GetViewLink('view', $messid, $catid, '', $username);
             $uri = JFactory::getURI();
             if ($uri->getVar('option') == 'com_kunena') {
                 $app =& JFactory::getApplication();
                 $app->redirect($uri->toString());
             }
         } elseif (!empty($post)) {
             $user['link'] = CKunenaLink::GetViewLink('view', $post['id'], $post['catid'], '', $username);
         }
     } else {
         $user['link'] = CKunenaLink::GetProfileLink($user['userid']);
     }
 }
예제 #2
0
 /**
  * @static
  * @access public
  * @return obj CKunenaLatestX resultlist
  */
 static function fetch($type, $incl_cat, $excl_cat, $limit, $timelimit)
 {
     // Verify all query options and get a similar array returned into $options
     $options = self::getVerifiedOptions(array('type' => $type, 'incl_cat' => $incl_cat, 'excl_cat' => $excl_cat, 'limit' => $limit, 'timelimit' => $timelimit));
     // Apply admin restrictions
     foreach ($options['incl_cat'] as $key => $catid) {
         if (in_array($catid, $options['excl_cat'])) {
             // forbidden - remove category
             // note: if only one category was wanted (and now removed), incl_cat is empty and all categories will be selected
             unset($options['incl_cat'][$key]);
         }
     }
     KunenaSession::getInstance(true, 0);
     $model = new CKunenaLatestX('', 0);
     $model->threads_per_page = $options['limit'];
     $model->querytime = CKunenaTimeformat::internalTime() - $options['timelimit'];
     $model->latestcategory = $options['incl_cat'];
     $model->latestcategory_in = 1;
     if (count($options['incl_cat']) == 0) {
         // If incl_cat is empty everything will be included by CKunenalatestX, therefore we need to specific which categories NOT to load
         $model->latestcategory = $options['excl_cat'];
         $model->latestcategory_in = 0;
     }
     switch ($options['type']) {
         case 'topic':
             $model->getLatestTopics();
             $result = $model->threads;
             break;
         case 'recent':
             $model->getLatest();
             $result = $model->lastreply;
             foreach ($result as $message) {
                 $message->subject = $model->threads[$message->thread]->subject;
             }
             break;
         case 'post':
         default:
             $model->getLatestPosts();
             $result = $model->customreply;
     }
     return (array) $result;
 }
예제 #3
0
		<?php 
$k = 0;
if (!empty($this->announcements)) {
    foreach ($this->announcements as $ann) {
        $k = 1 - $k;
        ?>
		<tr class="krow<?php 
        echo $k;
        ?>
">
			<td class="kcol-first kcol-annid"><?php 
        echo intval($ann->id);
        ?>
</td>
			<td class="kcol-mid kcol-anndate"><?php 
        echo CKunenaTimeformat::showDate($ann->created, 'date_today');
        ?>
</td>
			<td class="kcol-mid kcol-anntitle">
				<div class="overflow"><?php 
        echo CKunenaLink::GetAnnouncementLink('read', intval($ann->id), KunenaParser::parseText($ann->title), KunenaParser::parseText($ann->title), 'follow');
        ?>
</div>
			</td>
			<?php 
        if ($this->canEdit) {
            ?>
			<td class="kcol-mid kcol-annpublish">
				<?php 
            if ($ann->published > 0) {
                echo JText::_('COM_KUNENA_ANN_PUBLISHED');
예제 #4
0
파일: posts.php 프로젝트: redigy/Kunena-1.6
					<?php 
                echo CKunenaLink::GetProfileLink(intval($this->messages[$message->id]->userid), $useravatar);
                ?>
					</span>
					<?php 
            }
        }
        ?>
					<!-- /Avatar -->
					<!-- By -->
					<span class="ktopic-posted-time" title="<?php 
        echo CKunenaTimeformat::showDate($message->time, 'config_post_dateformat_hover');
        ?>
">
						<?php 
        echo JText::_('COM_KUNENA_POSTED_AT') . ' ' . CKunenaTimeformat::showDate($message->time, 'config_post_dateformat');
        ?>
&nbsp;
					</span>

					<?php 
        if ($message->name) {
            ?>
					<br />
					<span class="ktopic-by"><?php 
            echo JText::_('COM_KUNENA_GEN_BY') . ' ' . CKunenaLink::GetProfileLink(intval($message->userid), $this->escape($message->name));
            ?>
</span>
					<?php 
        }
        ?>
예제 #5
0
function doprune($kunena_db, $option)
{
    require_once KUNENA_PATH_LIB . '/kunena.timeformat.class.php';
    $kunena_app =& JFactory::getApplication();
    if (!JRequest::checkToken()) {
        $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
        while (@ob_end_clean()) {
        }
        $kunena_app->redirect(JURI::base() . "index.php?option={$option}&task=pruneforum");
        return;
    }
    $catid = JRequest::getInt('prune_forum', -1);
    $deleted = 0;
    if ($catid == -1) {
        echo "<script> alert('" . JText::_('COM_KUNENA_CHOOSEFORUMTOPRUNE') . "'); window.history.go(-1); </script>\n";
        $kunena_app->close();
    }
    // Convert days to seconds for timestamp functions...
    $prune_days = intval(JRequest::getVar('prune_days', 36500));
    $prune_date = CKunenaTimeformat::internalTime() - $prune_days * 86400;
    //get the thread list for this forum
    $kunena_db->setQuery("SELECT t.thread, MAX(m.time) AS lasttime\n\t\tFROM #__kunena_messages AS m\n\t\tLEFT JOIN #__kunena_messages AS t ON m.thread=t.thread AND t.parent=0\n\t\tWHERE m.catid={$catid} AND t.ordering = 0\n\t\tGROUP BY thread\n\t\tHAVING lasttime < {$prune_date}");
    $threadlist = $kunena_db->loadResultArray();
    if (KunenaError::checkDatabaseError()) {
        return;
    }
    require_once KUNENA_PATH_LIB . '/kunena.attachments.class.php';
    foreach ($threadlist as $thread) {
        //get the id's for all posts belonging to this thread
        $kunena_db->setQuery("SELECT id FROM #__kunena_messages WHERE thread={$thread}");
        $idlist = $kunena_db->loadResultArray();
        if (KunenaError::checkDatabaseError()) {
            return;
        }
        if (count($idlist) > 0) {
            //prune all messages belonging to the thread
            $deleted += count($idlist);
            $idlist = implode(',', $idlist);
            $attachments = CKunenaAttachments::getInstance();
            $attachments->deleteMessage($idlist);
            $kunena_db->setQuery("DELETE m, t FROM #__kunena_messages AS m INNER JOIN #__kunena_messages_text AS t ON m.id=t.mesid WHERE m.thread={$thread}");
            $kunena_db->query();
            if (KunenaError::checkDatabaseError()) {
                return;
            }
        }
        unset($idlist);
    }
    if (!empty($threadlist)) {
        $threadlist = implode(',', $threadlist);
        //clean all subscriptions to these deleted threads
        $kunena_db->setQuery("DELETE FROM #__kunena_subscriptions WHERE thread IN ({$threadlist})");
        $kunena_db->query();
        if (KunenaError::checkDatabaseError()) {
            return;
        }
        //clean all favorites to these deleted threads
        $kunena_db->setQuery("DELETE FROM #__kunena_favorites WHERE thread IN ({$threadlist})");
        $kunena_db->query();
        if (KunenaError::checkDatabaseError()) {
            return;
        }
    }
    while (@ob_end_clean()) {
    }
    $kunena_app->redirect(JURI::base() . "index.php?option={$option}&task=pruneforum", "" . JText::_('COM_KUNENA_FORUMPRUNEDFOR') . " " . $prune_days . " " . JText::_('COM_KUNENA_PRUNEDAYS') . "; " . JText::_('COM_KUNENA_PRUNEDELETED') . $deleted . " " . JText::_('COM_KUNENA_PRUNETHREADS'));
}
예제 #6
0
 protected function isAlreadyPosted()
 {
     // Ignore identical messages (posted within 5 minutes)
     $duplicatetimewindow = CKunenaTimeformat::internalTime() - 5 * 60;
     $this->_db->setQuery("SELECT m.id FROM #__kunena_messages AS m JOIN #__kunena_messages_text AS t ON m.id=t.mesid\n\t\t\tWHERE m.userid={$this->_db->quote($this->message['userid'])}\n\t\t\tAND m.name={$this->_db->quote($this->message['name'])}\n\t\t\tAND m.subject={$this->_db->quote($this->message['subject'])}\n\t\t\tAND m.ip={$this->_db->quote($this->message['ip'])}\n\t\t\tAND t.message={$this->_db->quote($this->message['message'])}\n\t\t\tAND m.time>={$this->_db->quote($duplicatetimewindow)}");
     $id = $this->_db->loadResult();
     $dberror = $this->checkDatabaseError();
     if ($dberror) {
         return $this->setError('-duplicate-', JText::_('COM_KUNENA_POST_ERROR_SAVE'));
     }
     return (bool) $id;
 }
예제 #7
0
function dofreePDF()
{
    $kunena_app =& JFactory::getApplication();
    $kunena_db =& JFactory::getDBO();
    $kunena_acl =& JFactory::getACL();
    $kunena_my =& JFactory::getUser();
    $kunena_config = KunenaFactory::getConfig();
    $catid = JRequest::getInt('catid', 0);
    $id = JRequest::getInt('id', 0);
    $limit = JRequest::getInt('limit', 0);
    $limitstart = JRequest::getInt('limitstart', 0);
    if ($limit < 1) {
        $limit = $kunena_config->messages_per_page - 1;
    }
    require_once KUNENA_PATH_LIB . '/kunena.timeformat.class.php';
    $kunena_session = KunenaFactory::getSession(true);
    $kunena_session->updateAllowedForums();
    $allow_forum = $kunena_session->allowed != '' ? explode(',', $kunena_session->allowed) : array();
    if (in_array($catid, $allow_forum) && $id) {
        //first get the thread id for the current post to later on determine the parent post
        $kunena_db->setQuery("SELECT thread FROM #__kunena_messages WHERE id={$kunena_db->Quote($id)} AND catid={$kunena_db->Quote($catid)}");
        $threadid = $kunena_db->loadResult();
        if (KunenaError::checkDatabaseError()) {
            return;
        }
        //load topic post and details
        $kunena_db->setQuery("SELECT a.*, b.* FROM #__kunena_messages AS a, #__kunena_messages_text AS b WHERE a.thread={$kunena_db->Quote($threadid)} AND a.catid={$kunena_db->Quote($catid)} AND a.parent='0' AND a.id=b.mesid");
        $row = $kunena_db->loadObjectList();
        if (KunenaError::checkDatabaseError()) {
            return;
        }
        if (file_exists(KUNENA_ROOT_PATH . '/includes/class.ezpdf.php')) {
            include KUNENA_ROOT_PATH . '/includes/class.ezpdf.php';
            $pdf = new Cezpdf('a4', 'P');
            //A4 Portrait
        } elseif (class_exists('JDocument')) {
            $pdf = new fbpdfwrapper();
        } else {
            echo 'No supported pdf class found!';
            exit;
        }
        if (empty($row)) {
            //if the messages doesn't exist don't need to continue
            echo '<br /><br /><div align="center">' . JText::_('COM_KUNENA_PDF_NOT_GENERATED_MESSAGE_DELETED') . '</div><br /><br />';
            echo CKunenaLink::GetAutoRedirectHTML(KunenaRoute::_(KUNENA_LIVEURLREL . '&func=showcat&catid=' . $catid), 3500);
        } else {
            $mes_text = $row[0]->message;
            filterHTML($mes_text);
            $pdf->ezSetCmMargins(2, 1.5, 1, 1);
            $pdf->selectFont('./fonts/Helvetica.afm');
            //choose font
            $all = $pdf->openObject();
            $pdf->saveState();
            $pdf->setStrokeColor(0, 0, 0, 1);
            // footer
            $pdf->line(10, 40, 578, 40);
            $pdf->line(10, 822, 578, 822);
            $pdf->addText(30, 34, 6, $kunena_config->board_title . ' - ' . $kunena_app->getCfg('sitename'));
            $strtmp = JText::_('COM_KUNENA_PDF_VERSION');
            $strtmp = str_replace('%version%', "NEW VERSION GOES HERE", $strtmp);
            // TODO: fxstein - Need to change version handling
            $pdf->addText(250, 34, 6, $strtmp);
            $strtmp = JText::_('COM_KUNENA_PDF_DATE');
            $strtmp = str_replace('%date%', date('j F, Y, H:i', CKunenaTimeformat::internalTime()), $strtmp);
            $pdf->addText(450, 34, 6, $strtmp);
            $pdf->restoreState();
            $pdf->closeObject();
            $pdf->addObject($all, 'all');
            $pdf->ezSetDy(30);
            $txt0 = $row[0]->subject;
            $pdf->ezText($txt0, 14);
            $pdf->ezText(JText::_('COM_KUNENA_VIEW_POSTED') . " " . $row[0]->name . " - " . CKunenaTimeformat::showDate($row[0]->time), 8);
            $pdf->ezText("_____________________________________", 8);
            //$pdf->line( 10, 780, 578, 780 );
            $txt3 = "\n";
            $txt3 .= $mes_text;
            $pdf->ezText($txt3, 10);
            $pdf->ezText("\n============================================================================\n\n", 8);
            //now let's try to see if there's more...
            $query = "SELECT a.*, b.* FROM #__kunena_messages AS a, #__kunena_messages_text AS b WHERE a.catid={$kunena_db->Quote($catid)} AND a.thread={$kunena_db->Quote($threadid)} AND a.id=b.mesid AND a.parent!='0' ORDER BY a.time ASC";
            $kunena_db->setQuery($query, $limitstart, $limit);
            $replies = $kunena_db->loadObjectList();
            if (KunenaError::checkDatabaseError()) {
                return;
            }
            $countReplies = count($replies);
            if ($countReplies > 0) {
                foreach ($replies as $reply) {
                    $mes_text = $reply->message;
                    filterHTML($mes_text);
                    $txt0 = $reply->subject;
                    $pdf->ezText($txt0, 14);
                    $pdf->ezText(JText::_('COM_KUNENA_VIEW_POSTED') . " " . $reply->name . " - " . CKunenaTimeformat::showDate($reply->time), 8);
                    $pdf->ezText("_____________________________________", 8);
                    $txt3 = "\n";
                    $txt3 .= $mes_text;
                    $pdf->ezText($txt3, 10);
                    $pdf->ezText("\n============================================================================\n\n", 8);
                }
            }
            $pdf->ezStream();
        }
    } else {
        echo "You don't have access to this resource.";
    }
}
예제 #8
0
/**
 * @version $Id$
 * Kunena Component
 * @package Kunena
 *
 * @Copyright (C) 2008 - 2011 Kunena Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link http://www.kunena.org
 *
 **/
// Dont allow direct linking
defined('_JEXEC') or die;
$dateshown = $datehover = '';
if ($this->msg->modified_time) {
    $datehover = 'title="' . CKunenaTimeformat::showDate($this->msg->modified_time, 'config_post_dateformat_hover') . '"';
    $dateshown = CKunenaTimeformat::showDate($this->msg->modified_time, 'config_post_dateformat') . ' ';
}
?>
<div>
	<?php 
if ($this->signatureHtml) {
    ?>
	<div class="kmsgsignature">
		<?php 
    echo $this->signatureHtml;
    ?>
	</div>
	<?php 
}
?>
</div>
예제 #9
0
			<?php 
    echo CKunenaLink::GetAnnouncementLink('show', NULL, JText::_('COM_KUNENA_ANN_CPANEL'), JText::_('COM_KUNENA_ANN_CPANEL'));
    ?>
		</div>
		<?php 
}
?>
		<div class="kbody">
			<div class="kanndesc">
				<?php 
if ($this->announcement->showdate > 0) {
    ?>
				<div class="anncreated" title="<?php 
    echo CKunenaTimeformat::showDate($this->announcement->created, 'ago');
    ?>
">
					<?php 
    echo CKunenaTimeformat::showDate($this->announcement->created, 'date_today');
    ?>
				</div>
				<?php 
}
?>
				<div class="anndesc"><?php 
echo !empty($this->announcement->description) ? KunenaParser::parseBBCode($this->announcement->description) : KunenaParser::parseBBCode($this->announcement->sdescription);
?>
</div>
			</div>
		</div>
	</div>
</div>
예제 #10
0
파일: user.php 프로젝트: redigy/Kunena-1.6
 public function profileIcon($name)
 {
     switch ($name) {
         case 'gender':
             switch ($this->gender) {
                 case 1:
                     $gender = 'male';
                     break;
                 case 2:
                     $gender = 'female';
                     break;
                 default:
                     $gender = 'unknown';
             }
             $title = JText::_('COM_KUNENA_MYPROFILE_GENDER') . ': ' . JText::_('COM_KUNENA_MYPROFILE_GENDER_' . $gender);
             return '<span class="kicon-profile kicon-profile-gender-' . $gender . '" title="' . $title . '"></span>';
             break;
         case 'birthdate':
             if ($this->birthdate) {
                 jimport('joomla.utilities.date');
                 $date = new JDate($this->birthdate, 0);
                 if ($date->toFormat('%Y') < 1902) {
                     break;
                 }
                 return '<span class="kicon-profile kicon-profile-birthdate" title="' . JText::_('COM_KUNENA_MYPROFILE_BIRTHDATE') . ': ' . CKunenaTimeformat::showDate($this->birthdate, 'date', 'utc', 0) . '"></span>';
             }
             break;
         case 'location':
             if ($this->location) {
                 return '<span class="kicon-profile kicon-profile-location" title="' . JText::_('COM_KUNENA_MYPROFILE_LOCATION') . ': ' . kunena_htmlspecialchars($this->location) . '"></span>';
             }
             break;
         case 'website':
             $url = 'http://' . $this->websiteurl;
             if (!$this->websitename) {
                 $websitename = $this->websiteurl;
             } else {
                 $websitename = $this->websitename;
             }
             if ($this->websiteurl) {
                 return '<a href="' . kunena_htmlspecialchars($url) . '" target="_blank"><span class="kicon-profile kicon-profile-website" title="' . JText::_('COM_KUNENA_MYPROFILE_WEBSITE') . ': ' . kunena_htmlspecialchars($websitename) . '"></span></a>';
             }
             break;
         case 'private':
             $pms = KunenaFactory::getPrivateMessaging();
             return $pms->showIcon($this->userid);
             break;
         case 'email':
             // TODO: show email
             return;
             // '<span class="email" title="'. JText::_('COM_KUNENA_MYPROFILE_EMAIL').'"></span>';
             break;
         case 'profile':
             if (!$this->userid) {
                 return;
             }
             return CKunenaLink::GetProfileLink($this->userid, '<span class="profile" title="' . JText::_('COM_KUNENA_VIEW_PROFILE') . '"></span>');
             break;
     }
 }
예제 #11
0
		<?php 
        if ($this->params->get('sh_author')) {
            ?>
			<li class="klatest-author"><?php 
            echo JText::_('MOD_KUNENALATEST_LAST_POST_BY') . ' ' . CKunenaLink::GetProfileLink($item->userid, $item->name);
            ?>
</li>
		<?php 
        }
        ?>
		<?php 
        if ($this->params->get('sh_time')) {
            ?>
			<li class="klatest-posttime"><?php 
            $override = $this->params->get('dateformat');
            echo CKunenaTimeformat::showDate($this->params->get('choosemodel') == 'latestposts' ? $item->time : $item->lasttime, $override ? $override : 'config_post_dateformat');
            ?>
</li>
		<?php 
        }
        ?>
	</ul>
</li>
<?php 
    }
    //end foreach
    ?>
</ul>
<?php 
    if ($this->params->get('sh_morelink')) {
        ?>
예제 #12
0
    }
    ?>
				<?php 
    if ($this->params->get('lastlog')) {
        ?>
					<li>
						<span class="klogin-lasttext"><?php 
        echo JText::_('MOD_KUNENALOGIN_LASTVISIT');
        ?>
</span>
						<span class="klogin-lastdate" title="<?php 
        echo CKunenaTimeformat::showDate($this->my->lastvisitDate, 'date_today', 'utc');
        ?>
">
							<?php 
        echo CKunenaTimeformat::showDate($this->my->lastvisitDate, 'ago', 'utc');
        ?>
						</span>
					</li>
				<?php 
    }
    ?>
					<li class="klogin-logout-button">
						<input type="submit" name="Submit" class="kbutton" value="<?php 
    echo JText::_('MOD_KUNENALOGIN_BUTTON_LOGOUT');
    ?>
" />
					</li>
				</ul>
			</div>
			<div class="klogin-links">
예제 #13
0
                ?>
			<div class="klatest-subject ks">
				<?php 
                echo JText::_('COM_KUNENA_GEN_LAST_POST') . ': ' . CKunenaLink::GetThreadPageLink('view', intval($category->catid), intval($category->thread), intval($category->page), intval($this->config->messages_per_page), KunenaParser::parseText($category->subject, 30), intval($category->id_last_msg));
                ?>
			</div>

			<div class="klatest-subject-by ks">
			<?php 
                echo JText::_('COM_KUNENA_BY') . ' ';
                if (!empty($category->userid)) {
                    echo CKunenaLink::GetProfileLink(intval($category->userid), $this->escape($this->config->username ? $category->username : $category->uname));
                } else {
                    echo CKunenaLink::GetProfileLink(intval($category->userid), $this->escape($category->mname));
                }
                echo '<br /><span class="nowrap" title="' . CKunenaTimeformat::showDate($category->time_last_msg, 'config_post_dateformat_hover') . '">' . CKunenaTimeformat::showDate($category->time_last_msg, 'config_post_dateformat') . '</span>';
                ?>
			</div>
			</td>

			<?php 
            } else {
                ?>
			<td class="kcol-mid kcol-knoposts"><?php 
                echo JText::_('COM_KUNENA_NO_POSTS');
                ?>
</td>
			<?php 
            }
            ?>
		</tr>
예제 #14
0
    ?>
:</div>
	<div class="kmoderate-message">
		<h4><?php 
    echo $this->escape($this->message->subject);
    ?>
</h4>
		<div class="kmessage-timeby"><span class="kmessage-time" title="<?php 
    echo CKunenaTimeformat::showDate($this->message->time, 'config_post_dateformat_hover');
    ?>
">
		<?php 
    echo JText::_('COM_KUNENA_POSTED_AT');
    ?>
 <?php 
    echo CKunenaTimeformat::showDate($this->message->time, 'config_post_dateformat');
    ?>
</span>
		<span class="kmessage-by"><?php 
    echo JText::_('COM_KUNENA_GEN_BY') . ' ' . CKunenaLink::GetProfileLink(intval($this->message->userid), $this->escape($this->message->name));
    ?>
</span></div>
		<div class="kmessage-avatar"><?php 
    echo $this->user->getAvatarLink('', 'list');
    ?>
</div>
		<div class="kmessage-msgtext"><?php 
    echo KunenaParser::stripBBCode($this->message->message, 300);
    ?>
</div>
	</div>
예제 #15
0
    ?>
</span></li><?php 
}
?>
								<li><strong><?php 
echo JText::_('COM_KUNENA_MYPROFILE_TIMEZONE');
?>
:</strong> GMT <?php 
echo CKunenaTimeformat::showTimezone($this->timezone);
?>
</li>
								<li><strong><?php 
echo JText::_('COM_KUNENA_MYPROFILE_LOCAL_TIME');
?>
:</strong> <?php 
echo CKunenaTimeformat::showDate('now', 'time', 'utc', $this->timezone);
?>
</li>
								<?php 
if (!empty($this->posts)) {
    ?>
<li><strong><?php 
    echo JText::_('COM_KUNENA_MYPROFILE_POSTS');
    ?>
:</strong> <?php 
    echo intval($this->posts);
    ?>
</li><?php 
}
?>
								<?php 
예제 #16
0
?>
"></span><strong><?php 
echo JText::_('COM_KUNENA_MYPROFILE_GENDER');
?>
:</strong> <?php 
echo $this->gender;
?>
</li>
			<li class="bd"><span class="kicon-profile kicon-profile-birthdate"></span><strong><?php 
echo JText::_('COM_KUNENA_MYPROFILE_BIRTHDATE');
?>
:</strong> <span title="<?php 
echo CKunenaTimeformat::showDate($this->profile->birthdate, 'ago', 'utc', 0);
?>
"><?php 
echo CKunenaTimeformat::showDate($this->profile->birthdate, 'date', 'utc', 0);
?>
</span>
			<!--  <a href="#" title=""><span class="bday-remind"></span></a> -->
			</li>
		</ul>
	</div>
</div>

<div class="clrline"></div>
<div id="kprofile-rightcolbot">
	<div class="kprofile-rightcol2">
		<ul>
			<?php 
if ($this->config->showemail && (!$this->profile->hideEmail || CKunenaTools::isModerator($this->my->id))) {
    ?>
예제 #17
0
	<div class="kcontainer" id="ksearchresult">
		<div class="kbody">
<table>
	<tbody>
		<tr>
			<td>
				<?php 
foreach ($this->results as $result) {
    ?>
					<table>
						<thead>
							<tr class="ksth">
								<th colspan="2">
									<span class="kmsgdate">
										<?php 
    echo CKunenaTimeformat::showDate($result->time);
    ?>
									</span>
								</th>
							</tr>
						</thead>
						<tbody>
							<?php 
    $k = 0;
    if ($this->total == 0 && $this->int_kunena_errornr) {
        ?>
							<tr class="k<?php 
        echo $this->tabclass[$k];
        ?>
" >
								<td>
예제 #18
0
    function __construct()
    {
        ob_start();
        // Display time it took to create the entire page in the footer
        jimport('joomla.error.profiler');
        $__kstarttime = JProfiler::getmicrotime();
        $kunena_config = KunenaFactory::getConfig();
        kimport('error');
        KunenaError::initialize();
        // First of all take a profiling information snapshot for JFirePHP
        if (JDEBUG) {
            require_once JPATH_COMPONENT . '/lib/kunena.profiler.php';
            $__profiler = KProfiler::GetInstance();
            $__profiler->mark('Start');
        }
        $func = JString::strtolower(JRequest::getCmd('func', JRequest::getCmd('view', '')));
        $do = JRequest::getCmd('do', '');
        $task = JRequest::getCmd('task', '');
        $format = JRequest::getCmd('format', 'html');
        JRequest::setVar('func', $func);
        // Workaround for Joomla 1.7.3 login bug, see: https://github.com/joomla/joomla-platform/pull/740
        if ($func == 'profile' && ($task == 'login' || $task == 'logout')) {
            require_once KUNENA_PATH_FUNCS . '/profile.php';
            $page = new CKunenaProfile(JFactory::getUser()->id, $task);
        }
        require_once KUNENA_PATH . '/router.php';
        if ($func && !isset(KunenaRouter::$functions[$func])) {
            // If func is not legal, raise joomla error
            return JError::raiseError(404, 'Kunena function "' . $func . '" not found');
        }
        $kunena_app = JFactory::getApplication();
        if (empty($_POST) && $format == 'html') {
            $me = KunenaFactory::getUser();
            $menu = JSite::getMenu();
            $active = $menu->getActive();
            // Joomla 1.6+ multi-language support
            if (isset($active->language) && $active->language != '*') {
                $language = JFactory::getDocument()->getLanguage();
                if (strtolower($active->language) != strtolower($language)) {
                    $this->redirect(KunenaRoute::_(null, false));
                }
            }
            // Legacy menu item and Itemid=0 support with redirect and notice
            if (empty($active->query['view'])) {
                $new = $menu->getItem(KunenaRoute::getItemID());
                if ($new) {
                    if ($active) {
                        if ($active->route == $new->route) {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_CONFLICT', $active->route, $active->id, $new->id), 'menu');
                            $menu->setActive($new->id);
                            $active = $new;
                        } else {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_LEGACY', $active->route, $active->id, $new->route, $new->id), 'menu');
                            $this->redirect(KunenaRoute::_(null, false));
                        }
                    } else {
                        KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NO_ITEM_REDIRECT', $new->route, $new->id));
                        $this->redirect(KunenaRoute::_(null, false));
                    }
                } elseif (!$active) {
                    KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NO_ITEM'));
                }
            }
            if (!$func || $func == 'entrypage') {
                // If we are currently in entry page, we need to show and highlight default menu item
                if (!empty($active->query['defaultmenu'])) {
                    $defaultitem = $active->query['defaultmenu'];
                    if ($defaultitem > 0) {
                        $newitem = $menu->getItem($defaultitem);
                        if (!$newitem) {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_EXISTS'), 'menu');
                        } elseif (empty($newitem->component) || $newitem->component != 'com_kunena') {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_KUNENA'), 'menu');
                        } elseif ($active->route == $newitem->route) {
                            // Special case: we are using Entry Page instead of menu alias and we have identical menu alias
                            if ($active->id != $newitem->id) {
                                $defaultitem = !empty($newitem->query['defaultmenu']) ? $newitem->query['defaultmenu'] : $newitem->id;
                                $newitem2 = $menu->getItem($defaultitem);
                                if (empty($newitem2->component) || $newitem2->component != 'com_kunena') {
                                    $defaultitem = $newitem->id;
                                }
                                if ($defaultitem) {
                                    $menu->setActive($defaultitem);
                                    $active = $menu->getActive();
                                }
                            }
                        } else {
                            $oldlocation = KunenaRoute::getCurrentMenu();
                            $menu->setActive($defaultitem);
                            $active = $menu->getActive();
                            $newlocation = KunenaRoute::getCurrentMenu();
                            if (!$oldlocation || $oldlocation->id != $newlocation->id) {
                                // Follow Default Menu Item if it's not in the same menu
                                $this->redirect(KunenaRoute::_($defaultitem, false));
                            }
                        }
                        if (is_object($active)) {
                            foreach ($active->query as $var => $value) {
                                if ($var == 'view') {
                                    $var = 'func';
                                }
                                if ($var == 'func' && $value == 'entrypage') {
                                    $value = $func;
                                }
                                JRequest::setVar($var, $value);
                            }
                            $func = JRequest::getCmd('func');
                        }
                    }
                }
            }
            $newItemid = KunenaRoute::getItemid();
            if ($active && $newItemid && !KunenaRoute::getCurrentMenu() && $active->id != $newItemid) {
                $newroute = KunenaRoute::_($newItemid, false);
                if (strpos('/' . $active->route, $newroute) === 0) {
                    $menu->setActive($newItemid);
                    $active = $menu->getActive();
                } else {
                    $this->redirect(KunenaRoute::_(null, false));
                }
            }
        }
        global $message;
        global $kunena_this_cat;
        // Get all the variables we need and strip them in case
        $action = JRequest::getCmd('action', '');
        $catid = JRequest::getInt('catid', 0);
        $contentURL = JRequest::getVar('contentURL', '');
        $email = JRequest::getVar('email', '');
        $favoriteMe = JRequest::getVar('favoriteMe', '');
        $fb_authorname = JRequest::getVar('fb_authorname', '');
        $fb_thread = JRequest::getInt('fb_thread', 0);
        $id = JRequest::getInt('id', 0);
        $mesid = JRequest::getInt('mesid', 0);
        $limit = JRequest::getInt('limit', 0);
        $limitstart = JRequest::getInt('limitstart', 0);
        $markaction = JRequest::getVar('markaction', '');
        $message = JRequest::getVar('message', '');
        $page = JRequest::getInt('page', 0);
        $parentid = JRequest::getInt('parentid', 0);
        $pid = JRequest::getInt('pid', 0);
        $replyto = JRequest::getInt('replyto', 0);
        $resubject = JRequest::getVar('resubject', '');
        $rowid = JRequest::getInt('rowid', 0);
        $rowItemid = JRequest::getInt('rowItemid', 0);
        $subject = JRequest::getVar('subject', '');
        $subscribeMe = JRequest::getVar('subscribeMe', '');
        $thread = JRequest::getInt('thread', 0);
        $topic_emoticon = JRequest::getVar('topic_emoticon', '');
        $userid = JRequest::getInt('userid', 0);
        $no_html = JRequest::getBool('no_html', 0);
        // If JFirePHP is installed and enabled, leave a trace of the Kunena startup
        if (JDEBUG == 1 && defined('JFIREPHP')) {
            // FB::trace("Kunena Startup");
        }
        // Redirect Forum Jump
        if (isset($_POST['func']) && $func == "showcat") {
            header("HTTP/1.1 303 See Other");
            header("Location: " . KunenaRoute::_('index.php?option=com_kunena&func=showcat&catid=' . $catid, false));
            $kunena_app->close();
        }
        $kunena_my =& JFactory::getUser();
        $kunena_db =& JFactory::getDBO();
        $document = JFactory::getDocument();
        $document->addScriptDeclaration('// <![CDATA[
var kunena_toggler_close = "' . JText::_('COM_KUNENA_TOGGLER_COLLAPSE') . '";
var kunena_toggler_open = "' . JText::_('COM_KUNENA_TOGGLER_EXPAND') . '";
// ]]>');
        global $lang, $topic_emoticons;
        // Class structure should be used after this and all the common task should be moved to this class
        require_once JPATH_COMPONENT . '/class.kunena.php';
        // Central Location for all internal links
        require_once JPATH_COMPONENT . '/lib/kunena.link.class.php';
        require_once JPATH_COMPONENT . '/lib/kunena.smile.class.php';
        // Redirect profile (menu item) to the right component
        if ($func == 'profile' && !$do && empty($_POST)) {
            $redirect = 1;
            if (!empty($active)) {
                $params = new JParameter($active->params);
                $redirect = $params->get('integration', 1);
            }
            if ($redirect) {
                $profileIntegration = KunenaFactory::getProfile();
                if (!$profileIntegration instanceof KunenaProfileKunena) {
                    $url = CKunenaLink::GetProfileURL($kunena_my->id, false);
                    if ($url) {
                        $this->redirect($url);
                    }
                }
            }
        }
        // Check for JSON request
        if ($func == "json") {
            if (JDEBUG == 1 && defined('JFIREPHP')) {
                FB::log('Kunena JSON request');
            }
            // URL format for JSON requests: e.g: index.php?option=com_kunena&func=json&action=autocomplete&do=getcat
            require_once JPATH_COMPONENT . '/lib/kunena.ajax.helper.php';
            $ajaxHelper =& CKunenaAjaxHelper::getInstance();
            // Get the document object.
            $document =& JFactory::getDocument();
            // Set the MIME type for JSON output.
            $document->setMimeEncoding('application/json');
            // Change the suggested filename.
            if ($action != 'uploadfile') {
                JResponse::setHeader('Content-Disposition', 'attachment; filename="kunena.json"');
            }
            $value = JRequest::getVar('value', '');
            JResponse::sendHeaders();
            if ($kunena_config->board_offline && !CKunenaTools::isAdmin()) {
                // when the forum is offline, we don't entertain json requests
                json_encode(array('status' => '0', 'error' => @sprintf(_KUNENA_FORUM_OFFLINE)));
            } else {
                // Generate reponse
                echo $ajaxHelper->generateJsonResponse($action, $do, $value);
            }
            $kunena_app->close();
        }
        if ($kunena_config->board_offline && !CKunenaTools::isAdmin()) {
            // if the board is offline
            echo $kunena_config->offline_message;
        } else {
            if ($kunena_config->regonly && !$kunena_my->id) {
                // if we only allow registered users
                if (file_exists(KUNENA_JTEMPLATEPATH . '/css/kunena.forum-min.css')) {
                    CKunenaTools::addStyleSheet(KUNENA_JTEMPLATEURL . '/css/kunena.forum-min.css');
                } else {
                    CKunenaTools::addStyleSheet(KUNENA_TMPLTCSSURL);
                }
                echo '<div id="Kunena">';
                $this->header = JText::_('COM_KUNENA_LOGIN_NOTIFICATION');
                $this->body = JText::_('COM_KUNENA_LOGIN_FORUM');
                CKunenaTools::loadTemplate('/login.php');
                echo '</div>';
            } else {
                // =======================================================================================
                // Forum is online:
                //intercept the RSS request; we should stop afterwards
                if ($func == 'rss') {
                    require_once JPATH_COMPONENT . '/funcs/rss.php';
                    $feed = new CKunenaRSSView($catid);
                    $feed->display();
                    $kunena_app->close();
                }
                if ($func == 'fb_pdf' || $func == 'pdf') {
                    $httpReferer = JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server');
                    if (KUNENA_JOOMLA_COMPAT == '1.5') {
                        include JPATH_COMPONENT . '/lib/kunena.pdf.php';
                        $kunena_app->close();
                    }
                }
                $format = JRequest::getCmd('format', 'html');
                if ($format != 'html') {
                    echo "Kunena: Unsupported output format {$format}, please use only format=html or .html";
                    $kunena_app->close();
                }
                $integration = KunenaFactory::getProfile();
                $integration->open();
                //time format
                include_once JPATH_COMPONENT . '/lib/kunena.timeformat.class.php';
                $document =& JFactory::getDocument();
                if (file_exists(KUNENA_ABSTMPLTPATH . '/initialize.php')) {
                    require_once KUNENA_ABSTMPLTPATH . '/initialize.php';
                } else {
                    require_once KPATH_SITE . '/template/default/initialize.php';
                }
                // Insert WhoIsOnlineDatas
                require_once KUNENA_PATH_LIB . '/kunena.who.class.php';
                $who =& CKunenaWhoIsOnline::getInstance();
                $who->insertOnlineDatas();
                // include required libraries
                jimport('joomla.template.template');
                // Kunena Current Template Icons Pack
                if (file_exists(KUNENA_ABSTMPLTPATH . '/icons.php')) {
                    include KUNENA_ABSTMPLTPATH . '/icons.php';
                } else {
                    include KUNENA_PATH_TEMPLATE_DEFAULT . '/icons.php';
                }
                if (JDEBUG) {
                    $__profiler->mark('Session Start');
                }
                // We only save session for registered users
                $kunena_session = KunenaFactory::getSession(true);
                if ($kunena_my->id > 0) {
                    // new indicator handling
                    if ($markaction == "allread") {
                        if (!JRequest::checkToken()) {
                            $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                            while (@ob_end_clean()) {
                            }
                            $kunena_app->redirect(CKunenaLink::GetCategoryURL('listcat', $catid, false));
                        }
                        $kunena_session->markAllCategoriesRead();
                    }
                    if (!$kunena_session->save()) {
                        $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_SESSION_SAVE_FAILED'), 'error');
                    }
                    if ($markaction == "allread") {
                        while (@ob_end_clean()) {
                        }
                        $kunena_app->redirect(CKunenaLink::GetCategoryURL('listcat', $catid, false), JText::_('COM_KUNENA_GEN_ALL_MARKED'));
                    }
                    $userprofile = KunenaFactory::getUser();
                    if (!$userprofile->exists()) {
                        $userprofile->save();
                    }
                    // Assign previous visit without user offset to variable for templates to decide
                    $this->prevCheck = $kunena_session->lasttime;
                } else {
                    // For guests we don't show new posts
                    $this->prevCheck = CKunenaTimeformat::internalTime() + 60;
                }
                if (JDEBUG) {
                    $__profiler->mark('Session End');
                }
                //Get the topics this user has already read this session from #__kunena_sessions
                $this->read_topics = explode(',', $kunena_session->readtopics);
                /*       _\|/_
                             (o o)
                     +----oOO-{_}-OOo--------------------------------+
                     |    Until this section we have included the    |
                     |   necessary files and gathered the required   |
                     |     variables. Now let's start processing     |
                     |                     them                      |
                     +----------------------------------------------*/
                //Check if the catid requested is a parent category, because if it is
                //the only thing we can do with it is 'listcat' and nothing else
                if ($func == "showcat") {
                    if ($catid != 0) {
                        $kunena_db->setQuery("SELECT parent FROM #__kunena_categories WHERE id='{$catid}'");
                        $catParent = intval($kunena_db->loadResult());
                        if (KunenaError::checkDatabaseError()) {
                            return;
                        }
                    }
                    if ($catid == 0 || $catParent == 0) {
                        $this->redirect(CKunenaLink::GetCategoryURL('listcat', $catid, false));
                    }
                }
                $kunena_app->setUserState('com_kunena.redirect', null);
                ?>

<div id="Kunena"><?php 
                if ($kunena_config->board_offline) {
                    ?>
<span id="fbOffline"><?php 
                    echo JText::_('COM_KUNENA_FORUM_IS_OFFLINE');
                    ?>
</span> <?php 
                }
                ?>
 <?php 
                if (JDEBUG) {
                    $__profiler->mark('Profilebox Start');
                }
                CKunenaTools::loadTemplate('/menu.php');
                CKunenaTools::displayLoginBox();
                if (JDEBUG) {
                    $__profiler->mark('Profilebox End');
                }
                // Handle help / rules menuitems
                if ($func == 'article') {
                    $func = $do;
                }
                if (JDEBUG) {
                    $__profiler->mark('$func Start');
                }
                switch ($func) {
                    case 'who':
                        require_once KUNENA_PATH_LIB . '/kunena.who.class.php';
                        $online =& CKunenaWhoIsOnline::getInstance();
                        $online->displayWho();
                        break;
                    case 'announcement':
                        require_once KUNENA_PATH_LIB . '/kunena.announcement.class.php';
                        $ann = CKunenaAnnouncement::getInstance();
                        $ann->display();
                        break;
                    case 'poll':
                        require_once KUNENA_PATH_LIB . '/kunena.poll.class.php';
                        $kunena_polls =& CKunenaPolls::getInstance();
                        $kunena_polls->display();
                        break;
                    case 'polls':
                        require_once KUNENA_PATH_LIB . '/kunena.poll.class.php';
                        $kunena_polls =& CKunenaPolls::getInstance();
                        $kunena_polls->polldo();
                        break;
                    case 'stats':
                        require_once KUNENA_PATH_LIB . '/kunena.stats.class.php';
                        $kunena_stats = new CKunenaStats();
                        $kunena_stats->showStats();
                        break;
                    case 'myprofile':
                    case 'userprofile':
                    case 'fbprofile':
                    case 'profile':
                    case 'moderateuser':
                        require_once KUNENA_PATH_FUNCS . '/profile.php';
                        $page = new CKunenaProfile($userid, $task ? $task : $do);
                        $page->display();
                        break;
                    case 'userlist':
                        require_once KUNENA_PATH_FUNCS . '/userlist.php';
                        $page = new CKunenaUserlist();
                        $page->display();
                        break;
                    case 'post':
                        require_once KUNENA_PATH_FUNCS . '/post.php';
                        $page = new CKunenaPost();
                        $page->display();
                        break;
                    case 'view':
                        require_once KUNENA_PATH_FUNCS . '/view.php';
                        $layout = $kunena_app->getUserStateFromRequest("com_kunena.view_layout", 'layout', 'view');
                        $page = new CKunenaView($layout, $catid, $id, $limitstart, $limit, $mesid);
                        $page->display(true, true);
                        break;
                    case 'showcat':
                        require_once KUNENA_PATH_FUNCS . '/showcat.php';
                        $page = new CKunenaShowcat($catid, $page);
                        $page->display();
                        break;
                    case 'listcat':
                        require_once KUNENA_PATH_FUNCS . '/listcat.php';
                        $page = new CKunenaListcat($catid);
                        $page->display();
                        break;
                    case 'review':
                        require_once KUNENA_PATH_LIB . '/kunena.review.php';
                        $review = new CKunenaReview($catid);
                        $review->display();
                        break;
                    case 'rules':
                    case 'help':
                        CKunenaTools::loadTemplate('/' . $func . '.php');
                        break;
                    case 'report':
                        require_once KUNENA_PATH_LIB . '/kunena.report.class.php';
                        $report = new CKunenaReport();
                        $report->display();
                        break;
                    case 'latest':
                    case 'mylatest':
                    case 'noreplies':
                    case 'subscriptions':
                    case 'favorites':
                    case 'userposts':
                    case 'unapproved':
                    case 'deleted':
                        require_once KUNENA_PATH_FUNCS . '/latestx.php';
                        if ($do) {
                            $func = $do;
                        }
                        $page = new CKunenaLatestX($func, $page);
                        $page->display();
                        break;
                    case 'search':
                    case 'advsearch':
                        require_once JPATH_COMPONENT . '/lib/kunena.search.class.php';
                        $kunenaSearch = new CKunenaSearch();
                        $kunenaSearch->show();
                        break;
                    case 'markthisread':
                        if (!JRequest::checkToken('get')) {
                            $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                            while (@ob_end_clean()) {
                            }
                            $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), JText::_('COM_KUNENA_GEN_FORUM_MARKED'));
                        }
                        // Mark all unread topics in the category to read
                        $readTopics = $kunena_session->readtopics;
                        $kunena_db->setQuery("SELECT thread FROM #__kunena_messages WHERE catid='{$catid}' AND parent=0 AND thread NOT IN ({$readTopics})");
                        $readForum = $kunena_db->loadResultArray();
                        if (KunenaError::checkDatabaseError()) {
                            return;
                        }
                        $readTopics = implode(',', array_merge(explode(',', $readTopics), $readForum));
                        $kunena_db->setQuery("UPDATE #__kunena_sessions set readtopics='{$readTopics}' WHERE userid={$kunena_my->id}");
                        $kunena_db->query();
                        if (KunenaError::checkDatabaseError()) {
                            return;
                        }
                        while (@ob_end_clean()) {
                        }
                        $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), JText::_('COM_KUNENA_GEN_FORUM_MARKED'));
                        break;
                    case 'subscribecat':
                        if (!JRequest::checkToken('get')) {
                            $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                            if ($userid == 0) {
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false));
                            } else {
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetProfileURL($userid, false));
                            }
                        }
                        $success_msg = '';
                        if ($catid && $kunena_my->id) {
                            $query = "INSERT INTO #__kunena_subscriptions_categories (catid, userid) VALUES ('{$catid}','{$kunena_my->id}')";
                            $kunena_db->setQuery($query);
                            if (@$kunena_db->query() && $kunena_db->getAffectedRows() == 1) {
                                $success_msg = JText::_('COM_KUNENA_GEN_CATEGORY_SUBCRIBED');
                            }
                            KunenaError::checkDatabaseError();
                        }
                        while (@ob_end_clean()) {
                        }
                        $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), $success_msg);
                        break;
                    case 'unsubscribecat':
                        if (!JRequest::checkToken('get')) {
                            $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                            if ($userid == 0) {
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), $success_msg);
                            } else {
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetProfileURL($userid, false), $success_msg);
                            }
                        }
                        $success_msg = '';
                        if ($catid && $kunena_my->id) {
                            $query = "DELETE FROM #__kunena_subscriptions_categories WHERE catid={$catid} AND userid={$kunena_my->id}";
                            $kunena_db->setQuery($query);
                            if ($kunena_db->query() && $kunena_db->getAffectedRows() == 1) {
                                $success_msg = JText::_('COM_KUNENA_GEN_CATEGORY_UNSUBCRIBED');
                            }
                            KunenaError::checkDatabaseError();
                        }
                        if ($userid == 0) {
                            while (@ob_end_clean()) {
                            }
                            $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), $success_msg);
                        } else {
                            while (@ob_end_clean()) {
                            }
                            $kunena_app->redirect(CKunenaLink::GetProfileURL($userid, false), $success_msg);
                        }
                        break;
                    case 'karma':
                        include JPATH_COMPONENT . '/lib/kunena.karma.php';
                        break;
                    case 'thankyou':
                        require_once JPATH_COMPONENT . '/lib/kunena.thankyou.php';
                        $thankyou = new CKunenaThankyou();
                        $thankyou->setThankyou();
                        break;
                    case 'bulkactions':
                        switch ($do) {
                            case "bulkDel":
                                CKunenaTools::KDeletePosts();
                                break;
                            case "bulkMove":
                                CKunenaTools::KMovePosts($catid);
                                break;
                            case "bulkFavorite":
                                if (!JRequest::checkToken()) {
                                    $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                                    while (@ob_end_clean()) {
                                    }
                                    $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false));
                                }
                                require_once JPATH_ROOT . '/administrator/components/com_kunena/libraries/api.php';
                                $KunenaUserAPI = new KunenaUserAPI();
                                $cb = KGetArrayReverseInts("cb");
                                $result = $KunenaUserAPI->unfavoriteThreads($kunena_my->id, $cb);
                                if ($result) {
                                    $message = JText::_('COM_KUNENA_USER_UNFAVORITE_YES');
                                } else {
                                    $message = JText::_('COM_KUNENA_POST_UNFAVORITED_TOPIC');
                                }
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false), $message);
                                break;
                            case "bulkSub":
                                if (!JRequest::checkToken()) {
                                    $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                                    while (@ob_end_clean()) {
                                    }
                                    $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false));
                                }
                                require_once JPATH_ROOT . '/administrator/components/com_kunena/libraries/api.php';
                                $KunenaUserAPI = new KunenaUserAPI();
                                $cb = KGetArrayReverseInts("cb");
                                $result = $KunenaUserAPI->unsubscribeThreads($kunena_my->id, $cb);
                                if ($result) {
                                    $message = JText::_('COM_KUNENA_USER_UNSUBSCRIBE_YES');
                                } else {
                                    $message = JText::_('COM_KUNENA_POST_NO_UNSUBSCRIBED_TOPIC');
                                }
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false), $message);
                                break;
                            case "bulkDelPerm":
                                CKunenaTools::KDeletePerm();
                                break;
                            case "bulkRestore":
                                CKunenaTools::KUndelete();
                                break;
                        }
                        break;
                    case 'template':
                        jimport('joomla.filesystem.path');
                        $name = JRequest::getString('name', JRequest::getString('kunena_template', '', 'COOKIE'));
                        while (@ob_end_clean()) {
                        }
                        if ($name) {
                            $name = JPath::clean($name);
                            if (!is_readable(KPATH_SITE . "/template/{$name}/template.xml")) {
                                $name = 'default';
                            }
                            setcookie('kunena_template', $name, 0, JURI::root(true) . '/');
                        } else {
                            setcookie('kunena_template', null, time() - 3600, JURI::root(true) . '/');
                        }
                        $kunena_app->redirect(CKunenaLink::GetKunenaURL(false));
                        break;
                    case 'credits':
                        include JPATH_COMPONENT . '/lib/kunena.credits.php';
                        break;
                    default:
                        require_once KUNENA_PATH_FUNCS . '/listcat.php';
                        $page = new CKunenaListcat($catid);
                        $page->display();
                        break;
                }
                if (JDEBUG) {
                    $__profiler->mark('$func End');
                }
                // Bottom Module
                CKunenaTools::showModulePosition('kunena_bottom');
                // PDF and RSS
                if ($kunena_config->enablerss || $kunena_config->enablepdf) {
                    if ($catid > 0) {
                        kimport('category');
                        $category = KunenaCategory::getInstance($catid);
                        if ($category->pub_access == 0 && $category->parent) {
                            $rss_params = '&amp;catid=' . (int) $catid;
                        }
                    } else {
                        $rss_params = '';
                    }
                    if (isset($rss_params) || $kunena_config->enablepdf) {
                        echo '<div class="krss-block">';
                        if ($kunena_config->enablepdf && $func == 'view' && KUNENA_JOOMLA_COMPAT == '1.5') {
                            // FIXME: add better translation:
                            echo CKunenaLink::GetPDFLink($catid, $limit, $limitstart, $id, CKunenaTools::showIcon('kpdf', JText::_('PDF')), 'nofollow', '', JText::_('PDF'));
                        }
                        if ($kunena_config->enablerss && isset($rss_params)) {
                            if ($kunena_config->rss_specification == 'atom1.0') {
                                $rss_specification = 'application/atom+xml';
                            } else {
                                $rss_specification = 'application/rss+xml';
                            }
                            $document->addCustomTag('<link rel="alternate" type="' . $rss_specification . '" title="' . JText::_('COM_KUNENA_LISTCAT_RSS') . '" href="' . CKunenaLink::GetRSSURL($rss_params) . '" />');
                            echo CKunenaLink::GetRSSLink(CKunenaTools::showIcon('krss', JText::_('COM_KUNENA_LISTCAT_RSS')), 'follow', $rss_params);
                        }
                        echo '</div>';
                    }
                }
                $template = KunenaFactory::getTemplate();
                $this->params = $template->params;
                // Credits
                echo '<div class="kcredits kms"> ' . CKunenaLink::GetTeamCreditsLink($catid, JText::_('COM_KUNENA_POWEREDBY')) . ' ' . CKunenaLink::GetCreditsLink();
                if ($this->params->get('templatebyText') != '') {
                    echo ' :: <a href ="' . $this->params->get('templatebyLink') . '" rel="follow">' . $this->params->get('templatebyText');
                    if ($this->params->get('templatebyName')) {
                        echo ' ' . $this->params->get('templatebyName') . '</a>';
                    } else {
                        echo '</a>';
                    }
                }
                echo '</div>';
                // display footer
                // Show total time it took to create the page
                $__ktime = JProfiler::getmicrotime() - $__kstarttime;
                ?>
	<div class="kfooter">
		<span class="kfooter-time"><?php 
                echo JText::_('COM_KUNENA_FOOTER_TIME_TO_CREATE') . '&nbsp;' . sprintf('%0.2f', $__ktime) . '&nbsp;' . JText::_('COM_KUNENA_FOOTER_TIME_SECONDS');
                ?>
</span>
	</div>
</div>
<!-- closes Kunena div -->
<?php 
                $document->addHeadLink(KunenaRoute::_(), 'canonical', 'rel', '');
                $integration = KunenaFactory::getProfile();
                $integration->close();
                //$params = JComponentHelper::getParams( 'com_kunena' );
                //if ($params->get( 'show_page_title' )) $document->setTitle ( $params->get( 'page_title' ) );
                if (empty($_POST) && $format == 'html') {
                    $default = KunenaRoute::getDefault();
                    if ($default) {
                        $menu->setActive($default->id);
                    }
                }
            }
        }
        // end of online
        if (JDEBUG == 1) {
            $__profiler->mark('Done');
            $__queries = $__profiler->getQueryCount();
            if (defined('JFIREPHP')) {
                FB::log($__profiler->getBuffer(), 'Kunena Profiler');
                if ($__queries > 50) {
                    FB::error($__queries, 'Kunena Queries');
                } else {
                    if ($__queries > 35) {
                        FB::warn($__queries, 'Kunena Queries');
                    } else {
                        FB::log($__queries, 'Kunena Queries');
                    }
                }
            }
        }
        ob_end_flush();
    }
예제 #19
0
파일: post.php 프로젝트: redigy/Kunena-1.6
 public function floodProtection()
 {
     // Flood protection
     $ip = $_SERVER["REMOTE_ADDR"];
     if ($this->config->floodprotection && !CKunenaTools::isModerator($this->my->id, $this->catid)) {
         $this->_db->setQuery("SELECT MAX(time) FROM #__kunena_messages WHERE ip={$this->_db->Quote($ip)}");
         $lastPostTime = $this->_db->loadResult();
         if (KunenaError::checkDatabaseError()) {
             return false;
         }
         if ($lastPostTime + $this->config->floodprotection > CKunenaTimeformat::internalTime()) {
             echo JText::_('COM_KUNENA_POST_TOPIC_FLOOD1') . ' ' . $this->config->floodprotection . ' ' . JText::_('COM_KUNENA_POST_TOPIC_FLOOD2') . '<br />';
             echo JText::_('COM_KUNENA_POST_TOPIC_FLOOD3');
             return true;
         }
     }
     return false;
 }
예제 #20
0
				<ul class="kprofilebox-welcome">
					<li><?php 
echo JText::_('COM_KUNENA_PROFILEBOX_WELCOME');
?>
, <strong><?php 
echo CKunenaLink::GetProfileLink(intval($this->user->id), $this->escape($this->kunena_username));
?>
</strong></li>
					<li class="kms"><strong><?php 
echo JText::_('COM_KUNENA_MYPROFILE_LASTVISITDATE');
?>
:</strong> <span title="<?php 
echo CKunenaTimeformat::showDate($this->user->lastvisitDate, 'ago', 'utc');
?>
"><?php 
echo CKunenaTimeformat::showDate($this->user->lastvisitDate, 'date_today', 'utc');
?>
</span></li>
					<?php 
if ($logout) {
    ?>
					<li>
					<form action="<?php 
    echo KunenaRoute::_(KUNENA_LIVEURLREL);
    ?>
" method="post" name="login">
						<input type="submit" name="submit" class="kbutton" value="<?php 
    echo JText::_('COM_KUNENA_PROFILEBOX_LOGOUT');
    ?>
" />
						<input type="hidden" name="option" value="<?php 
예제 #21
0
 /**
  * This function check the edit time for the author of the author
  * of the post and return if the user is allwoed or not to edit
  * her post
  *
  * @param timestamp $messagemodifiedtime	Time when the message has been edited
  * @param timestamp $messagetime			Actual message time
  */
 function editTimeCheck($messagemodifiedtime, $messagetime)
 {
     $kunena_config = KunenaFactory::getConfig();
     if (intval($kunena_config->useredit) != 1) {
         return false;
     }
     if (intval($kunena_config->useredittime) == 0) {
         return true;
     } else {
         //Check whether edit is in time
         $modtime = $messagemodifiedtime;
         if (!$modtime) {
             $modtime = $messagetime;
         }
         if ($modtime + intval($kunena_config->useredittime) >= CKunenaTimeformat::internalTime()) {
             return true;
         }
     }
 }
예제 #22
0
 function updateSessionInfo()
 {
     // If this is a new session, reset the lasttime colum with the timestamp
     // of the last saved currvisit - only after that can we reset currvisit to now before the store
     if ($this->isNewSession()) {
         $this->lasttime = $this->currvisit;
         $this->readtopics = 0;
         $this->allowed == 'na';
     }
     $this->currvisit = CKunenaTimeformat::internalTime();
 }
예제 #23
0
파일: flat.php 프로젝트: redigy/Kunena-1.6
            echo CKunenaLink::GetThreadPageLink('view', intval($leaf->catid), intval($leaf->thread), 1, intval($this->config->messages_per_page), JText::_('COM_KUNENA_GEN_LAST_POST'), intval($this->lastreply[$leaf->thread]->id));
        }
        if ($leaf->name) {
            echo ' ' . JText::_('COM_KUNENA_GEN_BY') . ' ' . CKunenaLink::GetProfileLink(intval($this->lastreply[$leaf->thread]->userid), $this->escape($this->lastreply[$leaf->thread]->name), '', 'nofollow');
        }
        ?>
					</span>
					<!-- /Latest Post -->
					<br />
					<!-- Latest Post Date -->
					<span class="ktopic-date" title="<?php 
        echo CKunenaTimeformat::showDate($this->lastreply[$leaf->thread]->time, 'config_post_dateformat_hover');
        ?>
">
						<?php 
        echo CKunenaTimeformat::showDate($this->lastreply[$leaf->thread]->time, 'config_post_dateformat');
        ?>
					</span>
					<!-- /Latest Post Date -->
				</div>
			</td>

			<?php 
        if (count($this->actionDropdown) > 1) {
            ?>
			<td class="kcol-mid ktopicmoderation">
				<?php 
            if ($this->func == 'favorites' || $this->func == 'subscriptions') {
                ?>
					<input class ="kDelete_bulkcheckboxes_<?php 
                echo $this->func;
예제 #24
0
"><?php 
        echo CKunenaTimeformat::showDate($user->registerDate, 'datetime_today', 'utc');
        ?>
</td>
							<?php 
    }
    ?>

							<?php 
    if ($this->config->userlist_lastvisitdate) {
        ?>
							<td class="kcol-mid" title="<?php 
        echo CKunenaTimeformat::showDate($klvisit);
        ?>
"><?php 
        echo CKunenaTimeformat::showDate($klvisit);
        ?>
</td>
							<?php 
    }
    ?>

							<?php 
    if ($this->config->userlist_userhits) {
        ?>
							<td class="kcol-mid"><?php 
        echo $this->escape($user->uhits);
        ?>
</td>
							<?php 
    }
예제 #25
0
	</div>
	<div class="kcontainer" id="khistory">
		<div class="kbody">
			<?php 
foreach ($this->messages as $mes) {
    ?>
			<table>
				<thead>
					<tr class="ksth">
						<th colspan="2">
							<span class="kmsgdate khistory-msgdate" title="<?php 
    echo CKunenaTimeformat::showDate($mes->time, 'config_post_dateformat_hover');
    ?>
">
								<?php 
    echo CKunenaTimeformat::showDate($mes->time, 'config_post_dateformat');
    ?>
							</span>
							<a name="<?php 
    echo intval($mes->id);
    ?>
"></a>
							<?php 
    echo $this->getNumLink($mes->id, $this->replycount--);
    ?>
						</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td rowspan="2" valign="top" class="kprofile-left  kauthor">
 function showDate($time, $mode = 'datetime_today', $tz = 'kunena', $offset = null)
 {
     $app =& JFactory::getApplication();
     $kunena_config = KunenaFactory::getConfig();
     $date = JFactory::getDate($time);
     if ($offset === null || strtolower($tz) != 'utc') {
         $offset = JFactory::getUser()->getParam('timezone', $app->getCfg('offset', 0));
     }
     if (is_numeric($offset)) {
         $date->setOffset($offset);
     } else {
         // Joomla 1.6 support
         $offset = new DateTimeZone($offset);
         $date->setTimezone($offset);
     }
     if ($date->toFormat('%Y') < 1902) {
         return JText::_('COM_KUNENA_DT_DATETIME_UNKNOWN');
     }
     if (preg_match('/^config_/', $mode) == 1) {
         $option = substr($mode, 7);
         $mode = $kunena_config->{$option};
     }
     $modearr = explode('_', $mode);
     switch (strtolower($modearr[0])) {
         case 'none':
             return '';
         case 'time':
             $usertime_format = JText::_('COM_KUNENA_DT_TIME_FMT');
             $today_format = JText::_('COM_KUNENA_DT_TIME_FMT');
             $yesterday_format = JText::_('COM_KUNENA_DT_TIME_FMT');
             break;
         case 'date':
             $usertime_format = JText::_('COM_KUNENA_DT_DATE_FMT');
             $today_format = JText::_('COM_KUNENA_DT_DATE_TODAY_FMT');
             $yesterday_format = JText::_('COM_KUNENA_DT_DATE_YESTERDAY_FMT');
             break;
         case 'ago':
             return CKunenaTimeformat::showTimeSince($date->toUnix());
             break;
         case 'datetime':
             $usertime_format = JText::_('COM_KUNENA_DT_DATETIME_FMT');
             $today_format = JText::_('COM_KUNENA_DT_DATETIME_TODAY_FMT');
             $yesterday_format = JText::_('COM_KUNENA_DT_DATETIME_YESTERDAY_FMT');
             break;
         default:
             $usertime_format = $mode;
             $today_format = $mode;
             $yesterday_format = $mode;
     }
     // Today and Yesterday?
     if ($modearr[count($modearr) - 1] == 'today') {
         $now = JFactory::getDate('now');
         $now = @getdate($now->toUnix());
         $then = @getdate($date->toUnix());
         // Same day of the year, same year.... Today!
         if ($then['yday'] == $now['yday'] && $then['year'] == $now['year']) {
             $usertime_format = $today_format;
         }
         // Day-of-year is one less and same year, or it's the first of the year and that's the last of the year...
         if ($then['yday'] == $now['yday'] - 1 && $then['year'] == $now['year'] || $now['yday'] == 0 && $then['year'] == $now['year'] - 1 && $then['mon'] == 12 && $then['mday'] == 31) {
             $usertime_format = $yesterday_format;
         }
     }
     return $date->toFormat($usertime_format, true);
 }
예제 #27
0
// 14400 seconds = 6 hours
$kunena_my = JFactory::getUser();
?>

<table>
    <tr>
        <td>
            <center>
                <?php 
//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 ($kunena_config->showkarma && $kunena_my->id && $do && $userid) {
    $time = CKunenaTimeformat::internalTime();
    if ($kunena_my->id != $userid) {
        if (JRequest::checkToken('get') == false) {
            $this->_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
            if ($pid) {
                while (@ob_end_clean()) {
                }
                $kunena_app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($pid, $kunena_config->messages_per_page, $catid));
            } else {
                while (@ob_end_clean()) {
                }
                $kunena_app->redirect(CKunenaLink::GetMyProfileURL($userid));
            }
            return;
        }
        // This checkes to see if it's not too soon for a new karma change
예제 #28
0
					echo '<img src="'.$this->ktemplate->getImagePath('icons/lock_sm.png').'"  alt="' . JText::_ ( 'MOD_KUNENALATEST_LOCKED_TOPIC' ) . '" title="' . JText::_ ( 'MOD_KUNENALATEST_LOCKED_TOPIC' ) . '" />';
				}
			}
			?>
		</li>
		<?php if ($this->params->get ( 'sh_firstcontentcharacter' )) : ?>
			<li class="klatest-preview-content"><?php echo JString::substr(KunenaParser::stripBBCode($item->message), '0', $this->params->get ( 'lengthcontentcharacters' )); ?></li>
		<?php endif; ?>
		<?php if ($this->params->get ( 'sh_category' )) : ?>
			<li class="klatest-cat"><?php echo JText::_ ( 'MOD_KUNENALATEST_IN_CATEGORY' ).' '.CKunenaLink::GetCategoryLink ( 'showcat', $item->catid, $item->catname ); ?></li>
		<?php endif; ?>
		<?php if ($this->params->get ( 'sh_author' )) : ?>
			<li class="klatest-author"><?php echo JText::_ ( 'MOD_KUNENALATEST_LAST_POST_BY' ) .' '. CKunenaLink::GetProfileLink ( $item->userid, $item->name ); ?></li>
		<?php endif; ?>
		<?php if ($this->params->get ( 'sh_time' )) : ?>
			<li class="klatest-posttime"><?php $override = $this->params->get ( 'dateformat' ); echo CKunenaTimeformat::showDate($this->params->get( 'choosemodel' ) == 'latestposts' ? $item->time : $item->lasttime, $override ? $override : 'config_post_dateformat');?></li>
		<?php endif; ?>
	</ul>
</li>
<?php
	} //end foreach
?>
</ul>
<?php if ($this->params->get ( 'sh_morelink' )): ?>
	<p class="klatest-more"><?php echo CKunenaLink::GetShowLatestLink ( JText::_ ( 'MOD_KUNENALATEST_MORE_LINK' ) , $this->latestdo ); ?></p>
<?php endif; ?>
<?php
} else {
	echo JText::_('MOD_KUNENALATEST_OFFLINE');
} ?>
</div>