function fbSetTimeout($url, $time, $script = 1) { $url = JRoute::_($url); if ($script) { echo CKunenaLink::GetAutoRedirectHTML($url, $time); } else { echo 'setTimeout("location=\'' . $url . '\'",$time)'; } }
if ($pid) { echo CKunenaLink::GetAutoRedirectHTML(JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $pid), 3500); } else { echo CKunenaLink::GetAutoRedirectHTML(CKunenaLink::GetProfileURL($userid), 3500); } } else { if ($do == "decrease") { $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_DECREASED . '<br /> <a href="' . JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $pid) . '">' . _POST_CLICK . '</a>.'; if ($pid) { echo CKunenaLink::GetAutoRedirectHTML(JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $pid), 3500); } else { echo CKunenaLink::GetAutoRedirectHTML(CKunenaLink::GetProfileURL($userid), 3500); } } else { //you got me there... don't know what to $do echo _USER_ERROR_A; echo _USER_ERROR_B . "<br /><br />"; echo _USER_ERROR_C . "<br /><br />" . _USER_ERROR_D . ": <code>fb001-karma-02NoDO</code><br /><br />"; } } } else { echo _KARMA_WAIT . '<br /> ' . _KARMA_BACK . ' <a href="' . JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $pid) . '">' . _POST_CLICK . '</a>.'; } } else { if ($kunena_my->id == $userid) { if ($do == "increase") { $kunena_db->setQuery('UPDATE #__fb_users SET karma=karma-10, karma_time=' . $time . ' WHERE userid=' . $kunena_my->id . '');
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."; } }
function GetLatestCategoryAutoRedirectHTML($catid) { $Output = '<div id="Kunena_post_result" align="center">'; $Output .= CKunenaLink::GetCategoryLink('showcat', $catid, _POST_SUCCESS_FORUM) . '<br />'; $Output .= '</div>'; $Output .= CKunenaLink::GetAutoRedirectHTML(KUNENA_LIVEURLREL . '&func=showcat&catid=' . $catid, 3500); return $Output; }
function GetAutoRedirectThreadPageHTML($func, $catid, $threadid, $page, $limit = '', $anker = '', $timeout) { $p_url = CKunenaLink::GetThreadPageURL($func, $catid, $threadid, $page, $limit, $anker); return CKunenaLink::GetAutoRedirectHTML($p_url, $timeout); }
if ($pid) { echo CKunenaLink::GetAutoRedirectHTML(JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $pid), 3500); } else { echo CKunenaLink::GetAutoRedirectHTML(JRoute::_(KUNENA_PROFILE_LINK_SUFFIX . $userid), 3500); } } else { if ($do == "decrease") { $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_DECREASED . '<br /> <a href="' . JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $pid) . '">' . _POST_CLICK . '</a>.'; if ($pid) { echo CKunenaLink::GetAutoRedirectHTML(JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $pid), 3500); } else { echo CKunenaLink::GetAutoRedirectHTML(JRoute::_(KUNENA_PROFILE_LINK_SUFFIX . $userid), 3500); } } else { //you got me there... don't know what to $do echo _USER_ERROR_A; echo _USER_ERROR_B . "<br /><br />"; echo _USER_ERROR_C . "<br /><br />" . _USER_ERROR_D . ": <code>fb001-karma-02NoDO</code><br /><br />"; } } } else { echo _KARMA_WAIT . '<br /> ' . _KARMA_BACK . ' <a href="' . JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $pid) . '">' . _POST_CLICK . '</a>.'; } } else { if ($kunena_my->id == $userid) { if ($do == "increase") { $kunena_db->setQuery('UPDATE #__fb_users SET karma=karma-10, karma_time=' . $time . ' WHERE userid=' . $kunena_my->id . '');
function ReportMessage($id, $catid, $reporter, $reason, $text, $type) { $kunena_my =& JFactory::getUser(); $kunena_db =& JFactory::getDBO(); $fbConfig =& CKunenaConfig::getInstance(); if (!$kunena_my->id) { JError::raiseError(403, JText::_("ALERTNOTAUTH")); return; } if (!empty($reason) && !empty($text)) { $kunena_db->setQuery("SELECT a.*, b.mesid, b.message AS msg_text FROM #__fb_messages AS a" . " LEFT JOIN #__fb_messages_text AS b ON b.mesid = a.id" . " WHERE a.id='{$id}'"); $row = $kunena_db->loadObject(); $kunena_db->setQuery("SELECT username FROM #__users WHERE id={$row->userid}"); $baduser = $kunena_db->loadResult(); $kunena_db->setQuery("SELECT username FROM #__users WHERE id={$reporter}"); $sender = $kunena_db->loadResult(); if ($reason) { $subject = "[" . stripslashes($fbConfig->board_title) . " " . _GEN_FORUM . "] " . _KUNENA_REPORT_MSG . ": " . $reason; } else { $subject = "[" . stripslashes($fbConfig->board_title) . " " . _GEN_FORUM . "] " . _KUNENA_REPORT_MSG . ": " . stripslashes($row->subject); } jimport('joomla.environment.uri'); $uri =& JURI::getInstance(JURI::base()); $msglink = $uri->toString(array('scheme', 'host', 'port')) . str_replace('&', '&', JRoute::_(KUNENA_LIVEURLREL . "&func=view&catid=" . $row->catid . "&id=" . $row->id) . '#' . $row->id); $message = "" . _KUNENA_REPORT_RSENDER . " " . $sender; $message .= "\n"; $message .= "" . _KUNENA_REPORT_RREASON . " " . $reason; $message .= "\n"; $message .= "" . _KUNENA_REPORT_RMESSAGE . " " . $text; $message .= "\n\n"; $message .= "" . _KUNENA_REPORT_POST_POSTER . " " . $baduser; $message .= "\n"; $message .= "" . _KUNENA_REPORT_POST_SUBJECT . " " . stripslashes($row->subject); $message .= "\n"; $message .= "" . _KUNENA_REPORT_POST_MESSAGE . "\n-----\n" . stripslashes($row->msg_text); $message .= "\n-----\n\n"; $message .= "" . _KUNENA_REPORT_POST_LINK . " " . $msglink; $message .= "\n\n\n\n** Powered by Kunena! - http://www.Kunena.com **"; $message = strtr($message, array(' ' => '')); //get category moderators $kunena_db->setQuery("SELECT userid FROM #__fb_moderation WHERE catid={$row->catid}"); $mods = $kunena_db->loadObjectList(); check_dberror("Unable to load moderators."); //get admins $kunena_db->setQuery("SELECT id FROM #__users WHERE gid >= 24"); $admins = $kunena_db->loadObjectList(); check_dberror("Unable to load admin."); switch ($type) { default: case '0': SendReporttoMail($sender, $subject, $message, $msglink, $mods, $admins); break; case '1': SendReporttoPM($reporter, $subject, $message, $msglink, $mods, $admins); break; } echo '<div align="center">' . _KUNENA_REPORT_SUCCESS; echo CKunenaLink::GetAutoRedirectHTML(JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $id) . '#' . $id, 3500); } else { echo '<div align="center">'; if (empty($reason)) { echo _POST_FORGOT_SUBJECT; } else { if (empty($text)) { echo _POST_FORGOT_MESSAGE; } } } echo '<br /><br />'; echo '<a href="' . JRoute::_(KUNENA_LIVEURLREL . '&func=view&catid=' . $catid . '&id=' . $id) . '#' . $id . '">' . _POST_SUCCESS_VIEW . '</a><br />'; echo '<a href="' . JRoute::_(KUNENA_LIVEURLREL . '&func=showcat&catid=' . $catid) . '">' . _POST_SUCCESS_FORUM . '</a><br />'; echo '</div>'; }
} } else { if ($do == "unfavorite") { //ergo, ergo delete $kunena_db->setQuery("DELETE from #__fb_favorites where userid={$kunena_my->id} and thread={$thread}"); if (!$kunena_db->query()) { echo _USER_UNFAVORITE_A . " <strong><font color=\"red\">" . _USER_UNFAVORITE_B . "</font></strong> " . _USER_UNFAVORITE_C . ".<br /><br />"; } else { echo _USER_UNFAVORITE_YES . ".<br /><br />"; } if ($fbConfig->fb_profile == 'cb') { echo _USER_RETURN_A . ' <a href="' . CKunenaCBProfile::getForumTabURL() . '">' . _USER_RETURN_B . "</a><br /><br />"; echo CKunenaLink::GetAutoRedirectHTML(CKunenaCBProfile::getForumTabURL(), 3500); } else { echo _USER_RETURN_A . " <a href=\"index.php?option=com_kunena&Itemid={$Itemid}&func=userprofile&do=show\">" . _USER_RETURN_B . "</a><br /><br />"; echo CKunenaLink::GetAutoRedirectHTML(JRoute::_(KUNENA_LIVEURLREL . '&func=userprofile&do=show'), 3500); } } else { //you got me there... don't know what to $do echo _USER_ERROR_A; echo _USER_ERROR_B . "<br /><br />"; echo _USER_ERROR_C . "<br /><br />" . _USER_ERROR_D . ": <code>fb001-up-02NoDO</code><br /><br />"; } } } } } else { //get outa here, you fraud! echo _USER_ERROR_A; echo _USER_ERROR_B . "<br /><br />"; echo _USER_ERROR_C . "<br /><br />" . _USER_ERROR_D . ": <code>fb001-up-01NLO</code><br /><br />";