/**
  * Delete a user
  *
  * @access protected
  * @param unknown_type $UserID
  * @return boolean
  */
 protected function _deleteUser($UserID)
 {
     // Sanitize parameters!
     $UserID = intval($UserID);
     if (!CKunenaTools::isAdmin($this->_my->id)) {
         $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_NOT_ADMIN');
         return false;
     }
     if ($UserID == $this->_my->id) {
         $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_USER_DELETE_YOURSELF');
         return false;
     }
     if (!$UserID) {
         $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_USER_DELETE_ANONYMOUS');
         return false;
     }
     $user = JUser::getInstance($UserID);
     if (!$user->id) {
         $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_USER_DELETE_NO_USER', $UserID);
         return false;
     }
     // Nobody can delete admins
     if (CKunenaTools::isAdmin($UserID)) {
         $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_USER_DELETE_ADMIN', $user->username);
         return false;
     }
     $user->delete();
     $this->_db->setQuery("DELETE FROM #__kunena_users WHERE `userid`={$this->_db->Quote($UserID)};");
     $this->_db->query();
     if (KunenaError::checkDatabaseError()) {
         return false;
     }
     return true;
 }
Exemplo n.º 2
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']);
     }
 }
Exemplo n.º 3
0
function convertDate($date)
{
    // used for non-FB dates only!
    $format = _KUNENA_USRL_DATE_FORMAT;
    if ($date != "0000-00-00 00:00:00" && preg_match('`(\\d{4})-(\\d{2})-(\\d{2})[[:space:]](\\d{2}):(\\d{2}):(\\d{2})`', $date, $regs)) {
        $date = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
        $date = $date > -1 ? strftime($format, CKunenaTools::fbGetShowTime($date, 'UTC')) : '-';
    } else {
        $date = _KUNENA_USRL_NEVER;
    }
    return $date;
}
Exemplo n.º 4
0
function convertDate($date)
{
    // used for non-FB dates only!
    $format = _KUNENA_USRL_DATE_FORMAT;
    if ($date != "0000-00-00 00:00:00" && ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})[ ]([0-9]{2}):([0-9]{2}):([0-9]{2})", $date, $regs)) {
        $date = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
        $date = $date > -1 ? strftime($format, CKunenaTools::fbGetShowTime($date, 'UTC')) : '-';
    } else {
        $date = _KUNENA_USRL_NEVER;
    }
    return $date;
}
Exemplo n.º 5
0
 function __construct()
 {
     $this->_db =& JFactory::getDBO();
     $this->_my =& JFactory::getUser();
     $this->_session =& KunenaFactory::getSession();
     $this->_config = KunenaFactory::getConfig();
     $this->_isimage = false;
     $this->_isfile = false;
     if (CKunenaTools::isModerator($this->_my->id) || $this->_my->id && $this->_config->allowimageregupload || !$this->_my->id && $this->_config->allowimageupload) {
         $this->validImageExts = explode(',', $this->_config->imagetypes);
     }
     if (CKunenaTools::isModerator($this->_my->id) || $this->_my->id && $this->_config->allowfileregupload || !$this->_my->id && $this->_config->allowfileupload) {
         $this->validFileExts = explode(',', $this->_config->filetypes);
     }
     $this->setImageResize(intval($this->_config->imagesize) * 1024, intval($this->_config->imagewidth), intval($this->_config->imageheight), intval($this->_config->imagequality));
 }
Exemplo n.º 6
0
function KUNENA_timeformat($logTime, $show_today = true)
{
    // formatts a time in Display space! Don't pass internal times!
    // ToDo: Pass format!
    $usertime_format = _KUNENA_DT_DATETIME_FMT;
    $app =& JFactory::getApplication();
    $time = $logTime;
    $todayMod = 2;
    // We can't have a negative date (on Windows, at least.)
    if ($time < 0) {
        $time = 0;
    }
    // Today and Yesterday?
    if ($show_today === true) {
        // Get the current time.
        $nowtime = CKunenaTools::fbGetShowTime();
        $then = @getdate($time);
        $now = @getdate($nowtime);
        // Try to make something of a time format string...
        $s = strpos($usertime_format, '%S') === false ? '' : ':%S';
        if (strpos($usertime_format, '%H') === false && strpos($usertime_format, '%T') === false) {
            $today_fmt = '%I:%M' . $s . ' %p';
        } else {
            $today_fmt = '%H:%M' . $s;
        }
        // Same day of the year, same year.... Today!
        if ($then['yday'] == $now['yday'] && $then['year'] == $now['year']) {
            return '' . _TIME_TODAY . '' . KUNENA_timeformat($logTime, $today_fmt);
        }
        // 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 ($todayMod == '2' && ($then['yday'] == $now['yday'] - 1 && $then['year'] == $now['year'] || $now['yday'] == 0 && $then['year'] == $now['year'] - 1 && $then['mon'] == 12 && $then['mday'] == 31)) {
            return '' . _TIME_YESTERDAY . '' . KUNENA_timeformat($logTime, $today_fmt);
        }
    }
    $str = !is_bool($show_today) ? $show_today : $usertime_format;
    // Do-it-yourself time localization.  Fun.
    foreach (array('%a' => 'days_short', '%A' => 'days', '%b' => 'months_short', '%B' => 'months') as $token => $text_label) {
        if (strpos($str, $token) !== false) {
            $str = str_replace($token, $GLOBALS['KUNENA_DT_txt'][$text_label][(int) strftime($token === '%a' || $token === '%A' ? '%w' : '%m', $time)], $str);
        }
    }
    if (strpos($str, '%p')) {
        $str = str_replace('%p', strftime('%H', $time) < 12 ? 'am' : 'pm', $str);
    }
    // Format any other characters..
    return strftime($str, $time);
}
 function display()
 {
     if (!$this->config->showannouncement) {
         return;
     }
     $do = JRequest::getVar("do", "");
     $id = intval(JRequest::getVar("id", ""));
     switch ($do) {
         case 'read':
             $this->getAnnouncement($id, 1);
             CKunenaTools::loadTemplate('/announcement/read.php');
             break;
         case 'show':
             $this->getAnnouncements(0, 5);
             CKunenaTools::loadTemplate('/announcement/show.php');
             break;
         case 'edit':
             if (!$this->canEdit) {
                 while (@ob_end_clean()) {
                 }
                 $this->app->redirect(CKunenaLink::GetKunenaURL(false), JText::_('COM_KUNENA_POST_NOT_MODERATOR'));
                 return;
             }
             $this->getAnnouncement($id, 0);
             // Continue
         // Continue
         case 'add':
             if (!$this->canEdit) {
                 while (@ob_end_clean()) {
                 }
                 $this->app->redirect(CKunenaLink::GetKunenaURL(false), JText::_('COM_KUNENA_POST_NOT_MODERATOR'));
                 return;
             }
             CKunenaTools::loadTemplate('/announcement/edit.php');
             break;
         case 'delete':
             $this->delete($id);
             break;
         case 'doedit':
             $this->edit($id);
             break;
         default:
             $this->getAnnouncements(0, 5);
             CKunenaTools::loadTemplate('/announcement/show.php');
     }
 }
Exemplo n.º 8
0
         }
         $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
 if (!CKunenaTools::isModerator($kunena_my->id, $catid)) {
     $userprofile = KunenaFactory::getUser($kunena_my->id);
     $karma_time_old = $userprofile->karma_time;
     $karma_time_diff = $time - $karma_time_old;
 }
 if (CKunenaTools::isModerator($kunena_my->id, $catid) || $karma_time_diff >= $karma_min_seconds) {
     if ($do == "increase") {
         $kunena_db->setQuery("UPDATE #__kunena_users SET karma_time={$kunena_db->Quote($time)} WHERE userid={$kunena_db->Quote($kunena_my->id)} ");
         $kunena_db->query();
         if (KunenaError::checkDatabaseError()) {
             return;
         }
         $kunena_db->setQuery("UPDATE #__kunena_users SET karma=karma+1 WHERE userid={$kunena_db->Quote($userid)}");
         $kunena_db->query();
         if (KunenaError::checkDatabaseError()) {
             return;
         }
         // Activity integration
         $activity = KunenaFactory::getActivityIntegration();
         $activity->onAfterKarma($userid, $kunena_my->id, 1);
         if ($pid) {
Exemplo n.º 9
0
function dofreePDF($kunena_db)
{
    global $aro_group;
    $app =& JFactory::getApplication();
    $kunena_acl =& JFactory::getACL();
    $kunena_my =& JFactory::getUser();
    $fbConfig =& CKunenaConfig::getInstance();
    require_once KUNENA_PATH_LIB . DS . 'kunena.authentication.php';
    $is_Mod = 0;
    $catid = JRequest::getInt('catid', 2);
    if (!$is_admin) {
        $kunena_db->setQuery("SELECT userid FROM #__fb_moderation WHERE catid='{$catid}' AND userid='{$kunena_my->id}'");
        if ($kunena_db->loadResult()) {
            $is_Mod = 1;
        }
    } else {
        $is_Mod = 1;
    }
    //superadmins always are
    if (!$is_Mod) {
        //get all the info on this forum:
        $kunena_db->setQuery("SELECT id, pub_access, pub_recurse, admin_access, admin_recurse FROM #__fb_categories WHERE id='{$catid}'");
        $row = $kunena_db->loadObjectList();
        check_dberror("Unable to load category detail.");
        $allow_forum = explode(',', CKunenaTools::getAllowedForums($kunena_my->id, $aro_group->id, $kunena_acl));
    }
    if ($is_Mod || in_array($catid, $allow_forum)) {
        $id = JRequest::getInt('id', 1);
        $catid = JRequest::getInt('catid', 2);
        //first get the thread id for the current post to later on determine the parent post
        $kunena_db->setQuery("SELECT thread FROM #__fb_messages WHERE id='{$id}' AND catid='{$catid}'");
        $threadid = $kunena_db->loadResult();
        //load topic post and details
        $kunena_db->setQuery("SELECT a.*, b.* FROM #__fb_messages AS a, #__fb_messages_text AS b WHERE a.thread='{$threadid}' AND a.catid='{$catid}' AND a.parent='0' AND a.id=b.mesid");
        $row = $kunena_db->loadObjectList();
        check_dberror("Unable to load message details.");
        if (file_exists(KUNENA_ROOT_PATH . DS . 'includes/class.ezpdf.php')) {
            include KUNENA_ROOT_PATH . DS . '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
            //Doesn't work Fatal error: Call to undefined method CKunenaLink::GetKunenaURL()
            //$app->redirect ( CKunenaLink::GetKunenaURL(true), _KUNENA_PDF_NOT_GENERATED_MESSAGE_DELETED );
        } 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, $fbConfig->board_title . ' - ' . $app->getCfg('sitename'));
            $strtmp = _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 = _KUNENA_PDF_DATE;
            $strtmp = str_replace('%date%', date('j F, Y, H:i', CKunenaTools::fbGetShowTime()), $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(_VIEW_POSTED . " " . $row[0]->name . " - " . date(_DATETIME, $row[0]->time), 8);
            $pdf->ezText("_____________________________________", 8);
            //$pdf->line( 10, 780, 578, 780 );
            $txt3 = "\n";
            $txt3 .= stripslashes($mes_text);
            $pdf->ezText($txt3, 10);
            $pdf->ezText("\n============================================================================\n\n", 8);
            //now let's try to see if there's more...
            $kunena_db->setQuery("SELECT a.*, b.* FROM #__fb_messages AS a, #__fb_messages_text AS b WHERE a.catid='{$catid}' AND a.thread='{$threadid}' AND a.id=b.mesid AND a.parent!='0' ORDER BY a.time ASC");
            $replies = $kunena_db->loadObjectList();
            check_dberror("Unable to load messages & detail.");
            $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(_VIEW_POSTED . " " . $reply->name . " - " . date(_DATETIME, $reply->time), 8);
                    $pdf->ezText("_____________________________________", 8);
                    $txt3 = "\n";
                    $txt3 .= stripslashes($mes_text);
                    $pdf->ezText($txt3, 10);
                    $pdf->ezText("\n============================================================================\n\n", 8);
                }
            }
            $pdf->ezStream();
        }
    } else {
        echo "You don't have access to this resource.";
    }
}
Exemplo n.º 10
0
 function fbMovePosts($catid, $isMod, $return)
 {
     $app =& JFactory::getApplication();
     $backUrl = $app->getUserState("com_kunena.ActionBulk");
     $kunena_db =& JFactory::getDBO();
     $kunena_my =& JFactory::getUser();
     // $isMod if user is moderator in the current category
     if (!$isMod) {
         // Test also if user is a moderator in some other category
         $kunena_db->setQuery("SELECT userid FROM #__fb_moderation WHERE userid='{$kunena_my->id}'");
         $isMod = $kunena_db->loadResult();
         check_dberror("Unable to load moderation info.");
     }
     $isAdmin = CKunenaTools::isModOrAdmin();
     //isMod will stay until better group management comes in
     if (!$isAdmin && !$isMod) {
         $app->redirect($return, _POST_NOT_MODERATOR);
     }
     $catid = (int) $catid;
     if ($catid > 0) {
         $items = fbGetArrayInts("fbDelete");
         // start iterating here
         foreach ($items as $id => $value) {
             $id = (int) $id;
             $kunena_db->setQuery("SELECT subject, catid, time AS timestamp FROM #__fb_messages WHERE id='{$id}'");
             $oldRecord = $kunena_db->loadObjectList();
             check_dberror("Unable to load message detail.");
             $newCatObj = new jbCategory($kunena_db, $oldRecord[0]->catid);
             if (fb_has_moderator_permission($kunena_db, $newCatObj, $kunena_my->id, $isAdmin)) {
                 $newSubject = _MOVED_TOPIC . " " . $oldRecord[0]->subject;
                 $kunena_db->setQuery("SELECT MAX(time) AS timestamp FROM #__fb_messages WHERE thread='{$id}'");
                 $lastTimestamp = $kunena_db->loadResult();
                 check_dberror("Unable to load messages max(time).");
                 if ($lastTimestamp == "") {
                     $lastTimestamp = $oldRecord[0]->timestamp;
                 }
                 //perform the actual move
                 $kunena_db->setQuery("UPDATE #__fb_messages SET `catid`='{$catid}' WHERE `id`='{$id}' OR `thread`='{$id}'");
                 $kunena_db->query();
                 check_dberror("Unable to move thread.");
                 $err = _POST_SUCCESS_MOVE;
             } else {
                 $err = _POST_NOT_MODERATOR;
             }
         }
         //end foreach
     } else {
         $err = _POST_NO_DEST_CATEGORY;
     }
     CKunenaTools::reCountBoards();
     $app->redirect($return, $err);
 }
Exemplo n.º 11
0
     $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL . '&amp;func=showcat&amp;catid=' . $catid)), _GEN_FORUM_MARKED);
     break;
     #########################################################################################
 #########################################################################################
 case 'karma':
     include KUNENA_PATH_LIB . DS . 'kunena.karma.php';
     break;
     #########################################################################################
 #########################################################################################
 case 'bulkactions':
     switch ($do) {
         case "bulkDel":
             CKunenaTools::fbDeletePosts($is_Moderator, $return);
             break;
         case "bulkMove":
             CKunenaTools::fbMovePosts($catid, $is_Moderator, $return);
             break;
     }
     break;
     ######################
     /*    template chooser    */
 ######################
 /*    template chooser    */
 case "templatechooser":
     $fb_user_template = strval(JRequest::getVar('fb_user_template', '', 'COOKIE'));
     $fb_user_img_template = strval(JRequest::getVar('fb_user_img_template', $fb_user_img_template));
     $fb_change_template = strval(JRequest::getVar('fb_change_template', $fb_user_template));
     $fb_change_img_template = strval(JRequest::getVar('fb_change_img_template', $fb_user_img_template));
     if ($fb_change_template) {
         // clean template name
         $fb_change_template = preg_replace('#\\W#', '', $fb_change_template);
Exemplo n.º 12
0
function trashrestore($option, $cid)
{
    $kunena_app =& JFactory::getApplication();
    $kunena_db =& JFactory::getDBO();
    JArrayHelper::toInteger($cid);
    if ($cid) {
        foreach ($cid as $id) {
            $kunena_db->setQuery("SELECT * FROM #__kunena_messages WHERE id={$id} AND hold=2");
            $mes = $kunena_db->loadObject();
            if (KunenaError::checkDatabaseError()) {
                return;
            }
            $kunena_db->setQuery("UPDATE #__kunena_messages SET hold=0 WHERE hold IN (2,3) AND thread={$mes->thread} ");
            $kunena_db->query();
            if (KunenaError::checkDatabaseError()) {
                return;
            }
            CKunenaTools::reCountUserPosts();
            CKunenaTools::reCountBoards();
        }
    }
    while (@ob_end_clean()) {
    }
    $kunena_app->redirect(JURI::base() . "index.php?option={$option}&task=showtrashview", JText::_('COM_KUNENA_TRASH_RESTORE_DONE'));
}
Exemplo n.º 13
0
 public function showForm()
 {
     if (!$this->reportAllowed()) {
         return false;
     }
     CKunenaTools::loadTemplate('/plugin/report/report.php');
 }
Exemplo n.º 14
0
    $this->displayContents();
    ?>
			</td>
			<td rowspan="2" class="kprofile-right">
				<?php 
    $this->displayProfile('vertical');
    ?>
			</td>
		</tr>
		<tr>
			<td class="kbuttonbar-right">
				<?php 
    $this->displayActions();
    ?>
				<?php 
    $this->displayThankyou();
    ?>
			</td>
		</tr>
	</tbody>
</table>

<?php 
}
?>

<!-- Begin: Message Module Position -->
	<?php 
CKunenaTools::showModulePosition('kunena_msg_' . $this->mmm);
?>
<!-- Finish: Message Module Position -->
Exemplo n.º 15
0
     // TODO: Enable split when it's fixed
     // $msg_split = CKunenaLink::GetTopicPostLink('split', $catid, $fmessage->id , isset($fbIcons['split']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['split'] . '" alt="' . _GEN_SPLIT . '" border="0" title="' . _GEN_SPLIT . '" />':_GEN_SPLIT);
 }
 if ($fbConfig->useredit && $kunena_my->id != "") {
     //Now, if the viewer==author and the viewer is allowed to edit his/her own post then offer an 'edit' link
     $allowEdit = 0;
     if ($kunena_my->id == $userinfo->userid) {
         if ((int) $fbConfig->useredittime == 0) {
             $allowEdit = 1;
         } else {
             //Check whether edit is in time
             $modtime = $fmessage->modified_time;
             if (!$modtime) {
                 $modtime = $fmessage->time;
             }
             if ($modtime + (int) $fbConfig->useredittime >= CKunenaTools::fbGetInternalTime()) {
                 $allowEdit = 1;
             }
         }
     }
     if ($allowEdit) {
         $msg_edit = CKunenaLink::GetTopicPostLink('edit', $catid, $fmessage->id, isset($fbIcons['edit']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['edit'] . '" alt="Edit" border="0" title="' . _VIEW_EDIT . '" />' : _GEN_EDIT);
         $showedEdit = 1;
     }
 }
 if ($is_Moderator && $showedEdit != 1) {
     //Offer a moderator always the edit link except when it is already showing..
     $msg_edit = CKunenaLink::GetTopicPostLink('edit', $catid, $fmessage->id, isset($fbIcons['edit']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['edit'] . '" alt="Edit" border="0" title="' . _VIEW_EDIT . '" />' : _GEN_EDIT);
 }
 //(JJ)
 if (file_exists(KUNENA_ABSTMPLTPATH . '/message.php')) {
Exemplo n.º 16
0
 function display()
 {
     if (!$this->allow) {
         echo JText::_('COM_KUNENA_NO_ACCESS');
         return;
     }
     if ($this->func == 'mylatest') {
         $this->getMyLatest();
     } else {
         if ($this->func == 'latestposts') {
             $this->getLatestPosts();
         } else {
             if ($this->func == 'latesttopics') {
                 $this->getLatestTopics();
             } else {
                 if ($this->func == 'noreplies') {
                     $this->getNoReplies();
                 } else {
                     if ($this->func == 'subscriptions') {
                         $this->getSubscriptions();
                     } else {
                         if ($this->func == 'catsubscriptions') {
                             $this->getCategoriesSubscriptions();
                         } else {
                             if ($this->func == 'favorites') {
                                 $this->getFavorites();
                             } else {
                                 if ($this->func == 'userposts') {
                                     $this->getUserPosts();
                                 } else {
                                     if ($this->func == 'owntopics') {
                                         $this->getOwnTopics();
                                     } else {
                                         if ($this->func == 'saidthankyouposts') {
                                             $this->getSaidThankYouPosts();
                                         } else {
                                             if ($this->func == 'gotthankyouposts') {
                                                 $this->getGotThankYouPosts();
                                             } else {
                                                 if ($this->func == 'unapproved') {
                                                     $this->getUnapprovedPosts();
                                                 } else {
                                                     if ($this->func == 'deleted') {
                                                         $this->getDeletedPosts();
                                                     } else {
                                                         $this->getLatest();
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$this->allow) {
         echo JText::_('COM_KUNENA_NO_ACCESS');
         return;
     }
     //meta description and keywords
     $metaKeys = $this->header . kunena_htmlspecialchars(", {$this->config->board_title}, ") . $this->app->getCfg('sitename');
     $metaDesc = $this->header . kunena_htmlspecialchars(" ({$this->page}/{$this->totalpages}) - {$this->config->board_title}");
     $cur = $this->document->get('description');
     $metaDesc = $cur . '. ' . $metaDesc;
     $this->document =& JFactory::getDocument();
     $this->document->setMetadata('robots', 'noindex, follow');
     $this->document->setMetadata('keywords', $metaKeys);
     $this->document->setDescription($metaDesc);
     $this->document->setTitle($this->title . ' - ' . $this->config->board_title);
     if (!isset($this->total)) {
         $this->total = 0;
     }
     CKunenaTools::loadTemplate('/threads/latestx.php');
 }
Exemplo n.º 17
0
                 }
                 if (file_exists($fileLocation_l)) {
                     CKunenaFile::delete($fileLocation_l);
                 }
                 CKunenaFile::copy($src_file, $fileLocation);
                 break;
         }
         // delete original file
         unlink($src_file);
         $kunena_db->setQuery("UPDATE #__fb_users SET avatar='{$newFileName}' WHERE userid={$kunena_my->id}");
         $kunena_db->query() or trigger_dberror("Unable to update avatar.");
         $app->redirect(JRoute::_(KUNENA_LIVEURLREL . '&func=myprofile'), _UPLOAD_UPLOADED);
     case 'gallery':
         require_once KUNENA_PATH_LIB . DS . 'kunena.helpers.php';
         $newAvatar = JRequest::getVar('newAvatar', '');
         $newAvatar = CKunenaTools::fbRemoveXSS($newAvatar);
         if ($newAvatar == '') {
             $app->enqueueMessage(_UPLOAD_ERROR_CHOOSE, 'notice');
             $app->redirect(JRoute::_(KUNENA_LIVEURLREL . '&amp;func=myprofile&do=avatar'));
         }
         $kunena_db->setQuery("UPDATE #__fb_users SET avatar='{$kunena_db->getEscaped($newAvatar)}' WHERE userid={$kunena_my->id}");
         $kunena_db->query() or trigger_dberror("Unable to update user avatar.");
         $app->redirect(JRoute::_(KUNENA_LIVEURLREL . '&func=myprofile'), _UPLOAD_UPLOADED);
         break;
 }
 if ($task == 'default') {
     if ($fbConfig->allowavatar) {
         ?>
     <td class = "fb_myprofile_right" valign = "top">
         <!-- B:My Profile Right -->
         <!-- B: My AVATAR -->
Exemplo n.º 18
0
 function displayLoginBox()
 {
     require_once KUNENA_PATH_LIB . '/kunena.login.php';
     $type = CKunenaLogin::getType();
     if ($type == 'login') {
         CKunenaTools::loadTemplate('/loginbox/login.php');
     } else {
         CKunenaTools::loadTemplate('/loginbox/logout.php');
     }
 }
Exemplo n.º 19
0
 function displayEdit()
 {
     $user = JFactory::getUser();
     if ($user->id != $this->profile->userid) {
         return;
     }
     CKunenaTools::loadTemplate('/profile/edit.php');
 }
Exemplo n.º 20
0
    function editUserProfile($user, $subslist, $selectRank, $selectPref, $selectMod, $selectOrder, $uid, $modCats)
    {
        $fbConfig =& CKunenaConfig::getInstance();
        $kunena_db =& JFactory::getDBO();
        //fill the variables needed later
        $signature = $user->signature;
        $username = $user->name;
        $avatar = $user->avatar;
        $ordering = $user->ordering;
        //that's what we got now; later the 'future_use' columns can be used..
        $csubslist = count($subslist);
        //        include_once ('components/com_kunena/bb_adm.js');
        ?>

        <form action = "index2.php?option=<?php 
        echo $option;
        ?>
" method = "POST" name = "adminForm">
            <table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminheading">
                <tr>
                    <th colspan = "3" class = "user">
<?php 
        echo _KUNENA_PROFFOR;
        ?>
 <?php 
        echo $username;
        ?>
                    </th>
                </tr>
            </table>

            <table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminlist">
                <tr>
                    <th colspan = "3" class = "title">
<?php 
        echo _KUNENA_GENPROF;
        ?>

                </tr>

                <tr>
                    <td width = "150" class = "contentpane"><?php 
        echo _KUNENA_PREFOR;
        ?>
                    </td>

                    <td align = "left" valign = "top" class = "contentpane">
<?php 
        echo $selectOrder;
        ?>
                    </td>

                    <td>&nbsp;

                    </td>
                </tr>

                         <tr>
                    <td width = "150" class = "contentpane"><?php 
        echo _KUNENA_RANKS;
        ?>
                    </td>

                    <td align = "left" valign = "top" class = "contentpane">
<?php 
        echo $selectRank;
        ?>
                    </td>

                    <td>&nbsp;

                    </td>
                </tr>



                            <td width = "150" valign = "top" class = "contentpane">
<?php 
        echo _GEN_SIGNATURE;
        ?>
:
<?php 
        /*
        // FIXME: bbcode broken
        
                <br/> <?php echo $fbConfig->maxsig; ?>
        
                <input readonly type = text name = rem size = 3 maxlength = 3 value = "" class = "inputbox"> <?php echo _CHARS; ?><br/>
        <?php echo _HTML_YES; ?>
        */
        ?>
                            </td>

                            <td align = "left" valign = "top" class = "contentpane">
                                <textarea rows = "6"
                                    class = "inputbox"
                                    onMouseOver = "textCounter(this.form.message,this.form.rem,<?php 
        echo $fbConfig->maxsig;
        ?>
);"
                                    onClick = "textCounter(this.form.message,this.form.rem,<?php 
        echo $fbConfig->maxsig;
        ?>
);"
                                    onKeyDown = "textCounter(this.form.message,this.form.rem,<?php 
        echo $fbConfig->maxsig;
        ?>
);"
                                    onKeyUp = "textCounter(this.form.message,this.form.rem,<?php 
        echo $fbConfig->maxsig;
        ?>
);" cols = "50" type = "text" name = "message"><?php 
        echo html_entity_decode_utf8(stripslashes($signature));
        ?>
</textarea>

<?php 
        /*
        // FIXME: bbcode broken
                                        <br/>
        
                                        <input type = "button" class = "button" accesskey = "b" name = "addbbcode0" value = " B " style = "font-weight:bold; width: 30px" onClick = "bbstyle(0)" onMouseOver = "helpline('b')"/>
        
                                        <input type = "button" class = "button" accesskey = "i" name = "addbbcode2" value = " i " style = "font-style:italic; width: 30px" onClick = "bbstyle(2)" onMouseOver = "helpline('i')"/>
        
                                        <input type = "button" class = "button" accesskey = "u" name = "addbbcode4" value = " u " style = "text-decoration: underline; width: 30px" onClick = "bbstyle(4)" onMouseOver = "helpline('u')"/>
        
                                        <input type = "button" class = "button" accesskey = "p" name = "addbbcode14" value = "Img" style = "width: 40px" onClick = "bbstyle(14)" onMouseOver = "helpline('p')"/>
        
                                        <input type = "button" class = "button" accesskey = "w" name = "addbbcode16" value = "URL" style = "text-decoration: underline; width: 40px" onClick = "bbstyle(16)" onMouseOver = "helpline('w')"/>
        
                                        <br/><?php echo _KUNENA_COLOR; ?>:
        
                <select name = "addbbcode20" onChange = "bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver = "helpline('s')">
                    <option style = "color:black;  background-color: #FAFAFA" value = ""><?php echo _COLOUR_DEFAULT; ?></option>
        
                    <option style = "color:red;    background-color: #FAFAFA" value = "#FF0000"><?php echo _COLOUR_RED; ?></option>
        
                    <option style = "color:blue;   background-color: #FAFAFA" value = "#0000FF"><?php echo _COLOUR_BLUE; ?></option>
        
                    <option style = "color:green;  background-color: #FAFAFA" value = "#008000"><?php echo _COLOUR_GREEN; ?></option>
        
                    <option style = "color:yellow; background-color: #FAFAFA" value = "#FFFF00"><?php echo _COLOUR_YELLOW; ?></option>
        
                    <option style = "color:orange; background-color: #FAFAFA" value = "#FF6600"><?php echo _COLOUR_ORANGE; ?></option>
                </select>
        <?php echo _SMILE_SIZE; ?>:
        
                <select name = "addbbcode22" onChange = "bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onMouseOver = "helpline('f')">
                    <option value = "1"><?php echo _SIZE_VSMALL; ?></option>
        
        
                    <option value = "2"><?php echo _SIZE_SMALL; ?></option>
        
                    <option value = "3" selected><?php echo _SIZE_NORMAL; ?></option>
        
                    <option value = "4"><?php echo _SIZE_BIG; ?></option>
        
                    <option value = "5"><?php echo _SIZE_VBIG; ?></option>
                </select>
        
                <a href = "javascript: bbstyle(-1)"onMouseOver = "helpline('a')"><small><?php echo _BBCODE_CLOSA; ?></small></a>
        
                <br/>
        
                <input type = "text" name = "helpbox" size = "45" maxlength = "100" style = "width:400px; font-size:8px" class = "options" value = "<?php echo _BBCODE_HINT;?>"/>
        */
        ?>
                            </td>

                            <?php 
        if ($fbConfig->allowavatar) {
            ?>

                                <td class = "contentpane" align = "center">
<?php 
            echo _KUNENA_UAVATAR;
            ?>
<br/>

<?php 
            if ($avatar != '') {
                echo '<img src="' . KUNENA_LIVEUPLOADEDPATH . '/avatars/' . $avatar . '" ><br />';
                echo '<input type="hidden" value="' . $avatar . '" name="avatar">';
            } else {
                echo "<em>" . _KUNENA_NS . "</em><br />";
                echo '<input type="hidden" value="$avatar" name="avatar">';
            }
            ?>
                                </td>

                            <?php 
        } else {
            echo "<td>&nbsp;</td>";
            echo '<input type="hidden" value="" name="avatar">';
        }
        ?>
                        </tr>

                        <tr>
                            <td colspan = "2" class = "contentpane">
                                <input type = "checkbox" value = "1" name = "deleteSig"><i><?php 
        echo _KUNENA_DELSIG;
        ?>
</i>
                            </td>

                            <?php 
        if ($fbConfig->allowavatar) {
            ?>

                                <td class = "contentpane">
                                    <input type = "checkbox" value = "1" name = "deleteAvatar"><i><?php 
            echo _KUNENA_DELAV;
            ?>
</i>
                                </td>

                            <?php 
        } else {
            echo "<td>&nbsp;</td>";
        }
        ?>
                        </tr>

                        <tr cellspacing = "3" colspan = "2">
                            &nbsp;

                            </td>
                        </tr>
            </table>

        <table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminform">
            <tr>
                <th colspan = "2" class = "title">
<?php 
        echo _KUNENA_MOD_NEW;
        ?>

            </td>
            </tr>
                        </tr>

                        <tr>


    <td width = "150" class = "contentpane">
    <?php 
        echo _KUNENA_ISMOD;
        ?>

                    <?php 
        //admins are always moderators
        if (CKunenaTools::isModOrAdmin($uid)) {
            echo _KUNENA_ISADM;
            ?>
 <input type = "hidden" name = "moderator" value = "1">
                    <?php 
        } else {
            echo $selectMod;
        }
        ?>
                        </td>
                        <td>
<?php 
        echo $modCats;
        ?>
                        </td>
                        </tr>

            </table>
            <input type = "hidden" name = "uid" value = "<?php 
        echo $uid;
        ?>
">

            <input type = "hidden" name = "task" value = ""/>

            <input type = "hidden" name = "option" value = "com_kunena"/>
        </form>

        <table border = 0 cellspacing = 0 width = "100%" align = "center" class = "adminform">
            <tr>
                <th colspan = "2" class = "title">
<?php 
        echo _KUNENA_SUBFOR;
        ?>
 <?php 
        echo $username;
        ?>

            </td>
            </tr>

            <?php 
        $enum = 1;
        //reset value
        $k = 0;
        //value for alternating rows
        if ($csubslist > 0) {
            foreach ($subslist as $subs) {
                //get all message details for each subscription
                $kunena_db->setQuery("select * from #__fb_messages where id={$subs->thread}");
                $subdet = $kunena_db->loadObjectList();
                check_dberror("Unable to load subscription messages.");
                foreach ($subdet as $sub) {
                    $k = 1 - $k;
                    echo "<tr class=\"row{$k}\">";
                    echo "  <td>{$enum}: " . html_entity_decode_utf8(stripslashes($sub->subject)) . " by " . html_entity_decode_utf8(stripslashes($sub->name));
                    echo "  <td>&nbsp;</td>";
                    echo "</tr>";
                    $enum++;
                }
            }
        } else {
            echo "<tr><td class=\"message\">" . _KUNENA_NOSUBS . "</td></tr>";
        }
        echo "</table>";
    }
Exemplo n.º 21
0
	protected function createReference($row, $thread) {
		$query = "INSERT INTO #__kunenadiscuss (content_id, thread_id) VALUES(
			{$this->_db->quote($row->id)},
			{$this->_db->quote($thread)})";
		$this->_db->setQuery ( $query );
		$this->_db->query ();
		CKunenaTools::checkDatabaseError ();
	}
Exemplo n.º 22
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);
}
Exemplo n.º 23
0
                        </script>

                            <select name = "do" id = "fbBulkActions" class = "inputbox fbs">
                                <option value = "">&nbsp;</option>
                                <option value = "bulkDel"><?php 
        echo _KUNENA_DELETE_SELECTED;
        ?>
</option>
                                <option value = "bulkMove"><?php 
        echo _KUNENA_MOVE_SELECTED;
        ?>
</option>
                            </select>

                            <?php 
        CKunenaTools::showBulkActionCats();
        ?>

            <input type = "submit" name = "fbBulkActionsGo" class = "fb_button fbs" value = "<?php 
        echo _KUNENA_GO;
        ?>
"/>
                        </td>

                        </tr>


            <?php 
    }
    ?>
            </tbody>
Exemplo n.º 24
0
 public function emailToSubscribers($LastPostUrl = false, $mailsubs = false, $mailmods = false, $mailadmins = false)
 {
     if ($LastPostUrl === false) {
         jimport('joomla.environment.uri');
         $uri = JURI::getInstance(JURI::base());
         $LastPostUrl = $uri->toString(array('scheme', 'host', 'port')) . CKunenaLink::GetMessageURL($this->get('id'), $this->get('catid'), 0, false);
     }
     $once = false;
     if ($mailsubs) {
         if (!$this->get('parent')) {
             // New topic: Send email only to category subscribers
             $mailsubs = $this->_config->category_subscriptions != 'disabled' ? 3 : 0;
             $once = $this->_config->category_subscriptions == 'topic';
         } elseif ($this->_config->category_subscriptions != 'post') {
             // Existing topic: Send email only to topic subscribers
             $mailsubs = $this->_config->topic_subscriptions != 'disabled' ? 2 : 0;
             $once = $this->_config->topic_subscriptions == 'first';
         } else {
             // Existing topic: Send email to both category and topic subscribers
             $mailsubs = $this->_config->topic_subscriptions == 'disabled' ? 3 : 1;
             // FIXME: category subcription can override topic
             $once = $this->_config->topic_subscriptions == 'first';
         }
     }
     // Fetch all subscribers, moderators and admins who will get the email
     $emailToList = CKunenaTools::getEMailToList($this->get('catid'), $this->get('thread'), $mailsubs, $mailmods, $mailadmins, $this->_my->id);
     if (count($emailToList)) {
         jimport('joomla.mail.helper');
         kimport('html.parser');
         if (!$this->_config->email) {
             KunenaError::warning(JText::_('COM_KUNENA_EMAIL_DISABLED'));
             return false;
         } else {
             if (!JMailHelper::isEmailAddress($this->_config->email)) {
                 KunenaError::warning(JText::_('COM_KUNENA_EMAIL_INVALID'));
                 return false;
             }
         }
         // clean up the message for review
         $authorname = $this->get('name');
         $message = KunenaParser::stripBBCode($this->get('message'), 0, false);
         $subject = $this->get('subject');
         $topicsubject = $this->parent->subject ? $this->parent->subject : $subject;
         $mailsender = JMailHelper::cleanAddress($this->_config->board_title);
         $mailsubject = JMailHelper::cleanSubject("[" . $this->_config->board_title . "] " . $topicsubject . " (" . $this->parent->catname . ")");
         // Make a list from all receivers
         $sentusers = array();
         $receivers = array(0 => array(), 1 => array());
         foreach ($emailToList as $emailTo) {
             if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
                 continue;
             }
             $receivers[$emailTo->subscription][] = $emailTo->email;
             $sentusers[] = $emailTo->id;
         }
         // Create email
         $mail = JFactory::getMailer();
         $mail->setSubject($mailsubject);
         $mail->setSender(array($this->_config->email, $mailsender));
         // Send email to all subscribers
         $mail->setBody($this->createEmailBody(1, $subject, $authorname, $LastPostUrl, $message, $once));
         $this->sendEmail($mail, $receivers[1]);
         // Send email to all moderators
         $mail->setBody($this->createEmailBody(0, $subject, $authorname, $LastPostUrl, $message, $once));
         $this->sendEmail($mail, $receivers[0]);
         // Update subscriptions
         if ($once && $sentusers) {
             $sentusers = implode(',', $sentusers);
             $db = JFactory::getDBO();
             $query = "UPDATE #__kunena_subscriptions\n\t\t\t\t\tSET future1=1 WHERE thread={$this->get('thread')} AND userid IN ({$sentusers})";
             $db->setQuery($query);
             $db->query();
             KunenaError::checkDatabaseError();
         }
     }
 }
Exemplo n.º 25
0
				<div class="ks">
					<!-- Category -->
					<span class="ktopic-category">
						<?php 
        echo JText::_('COM_KUNENA_CATEGORY') . ' ' . CKunenaLink::GetCategoryLink('showcat', intval($message->catid), $this->escape($message->catname));
        ?>
					</span>
					<!-- /Category -->
				</div>
			</td>
			<td class="kcol-mid kcol-ktopiclastpost">
				<div class="klatest-post-info">
					<!--  Sticky   -->
					<?php 
        if ($this->messages[$message->id]->ordering != 0) {
            echo CKunenaTools::showIcon('ktopicsticky', JText::_('COM_KUNENA_GEN_ISSTICKY'));
        }
        ?>
					<!--  /Sticky   -->
					<!-- Avatar -->
					<?php 
        if ($this->config->avataroncat > 0) {
            $profile = KunenaFactory::getUser((int) $this->messages[$message->id]->userid);
            $useravatar = $profile->getAvatarLink('klist-avatar', 'list');
            if ($useravatar) {
                ?>
					<span class="ktopic-latest-post-avatar">
					<?php 
                echo CKunenaLink::GetProfileLink(intval($this->messages[$message->id]->userid), $useravatar);
                ?>
					</span>
Exemplo n.º 26
0
			<div class="khelprulescontent">
				<?php 
echo $introtext;
?>
			</div>
		</div>
	</div>
</div>
<!-- Begin: Forum Jump -->
<?php 
if ($kunena_config->enableforumjump) {
    ?>
<div class="kblock">
	<div class="kheader">
		<h2><span><?php 
    echo JText::_('COM_KUNENA_GO_TO_CATEGORY');
    ?>
</span></h2>
	</div>
	<div class="kcontainer">
		<div class="khelprulesjump">
			<?php 
    CKunenaTools::loadTemplate('/forumjump.php');
    ?>
		</div>
	</div>
</div>
<?php 
}
?>
<!-- Finish: Forum Jump -->
Exemplo n.º 27
0
 protected function _removeAttachment($data)
 {
     $result = array();
     // only registered users when the board is online will endup here
     // $data has already been escaped as part of this class
     // TODO: Get attachment details
     $query = "SELECT a.*, m.*\n\t\t\tFROM #__kunena_attachments AS a\n\t\t\tJOIN #__kunena_messages AS m ON a.mesid = m.id\n\t\t\tWHERE a.id = '" . $data . "'";
     $this->_db->setQuery($query);
     $attachment = $this->_db->loadObject();
     if ($this->_db->getErrorNum()) {
         $result = array('status' => '-1', 'error' => KunenaError::getDatabaseError());
         return $result;
     }
     // Verify permissions, user must be author of the message this
     // attachment is attached to or be a moderator or admin of the site
     if ($attachment->userid != $this->_my->id && !CKunenaTools::isModerator($this->_my->id, $attachment->catid) && !CKunenaTools::isAdmin()) {
         // not the author, not a moderator, not an admin
         // nothing todo here - end with permission error
         $result = array('status' => '-1', 'error' => JText::_('COM_KUNENA_AJAX_PERMISSION_DENIED'));
         return $result;
     }
     // Request coming form valid user, moderator or admin...
     // First remove files from filsystem - check for thumbs and raw in case this is an image
     if (file_exists(JPATH_ROOT . $attachment->folder . $attachment->filename)) {
         JFile::delete(JPATH_ROOT . $attachment->folder . $attachment->filename);
     }
     if (file_exists(JPATH_ROOT . $attachment->folder . '/raw/' . $attachment->filename)) {
         JFile::delete(JPATH_ROOT . $attachment->folder . '/raw/' . $attachment->filename);
     }
     if (file_exists(JPATH_ROOT . $attachment->folder . '/thumb/' . $attachment->filename)) {
         JFile::delete(JPATH_ROOT . $attachment->folder . '/thumb/' . $attachment->filename);
     }
     // Finally delete attachment record from db
     $query = "DELETE FROM #__kunena_attachments AS a\n\t\t\t\t\tWHERE a.id = {$this->_db->Quote($data)}";
     $this->_db->setQuery($query);
     $this->_db->query();
     if ($this->_db->getErrorNum()) {
         $result = array('status' => '-1', 'error' => KunenaError::getDatabaseError());
     } else {
         $result = array('status' => '1', 'error' => JText::_('COM_KUNENA_AJAX_ATTACHMENT_DELETED'));
     }
     return $result;
 }
Exemplo n.º 28
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) {
Exemplo n.º 29
0
// We load mediaxboxadvanced library only if configuration setting allow it
if (KunenaFactory::getConfig()->lightbox == 1) {
    $template->addStyleSheet('css/mediaboxAdv.css');
    $template->addScript('js/mediaboxAdv.js');
}
// New Kunena JS for default template
$template->addScript('js/default.js');
$rtl = JFactory::getLanguage()->isRTL();
$skinner = $template->params->get('enableSkinner', 0);
if (file_exists(JPATH_ROOT . "/templates/{$app->getTemplate()}/css/kunena.forum.css")) {
    // Load css from Joomla template
    CKunenaTools::addStyleSheet(JURI::root(true) . "templates/{$app->getTemplate()}/css/kunena.forum.css");
    if ($skinner && file_exists(JPATH_ROOT . "templates/{$app->getTemplate()}/css/kunena.skinner.css")) {
        CKunenaTools::addStyleSheet(JURI::root(true) . "templates/{$app->getTemplate()}/css/kunena.skinner.css");
    } elseif (!$skinner && file_exists(JPATH_ROOT . "templates/{$app->getTemplate()}/css/kunena.default.css")) {
        CKunenaTools::addStyleSheet(JURI::root(true) . "templates/{$app->getTemplate()}/css/kunena.default.css");
    }
} else {
    // Load css from default template
    $template->addStyleSheet('css/kunena.forum.css');
    if ($skinner) {
        $template->addStyleSheet('css/kunena.skinner.css');
    } else {
        $template->addStyleSheet('css/kunena.default.css');
    }
}
$cssurl = JURI::root(true) . '/components/com_kunena/template/jsn_corsa/css';
?>
<!--[if lte IE 7]>
<link rel="stylesheet" href="<?php 
echo $cssurl;
Exemplo n.º 30
0
function listThreadHistory($id, $fbConfig, $kunena_db)
{
    if ($id != 0) {
        //get the parent# for the post on which 'reply' or 'quote' is chosen
        $kunena_db->setQuery("SELECT parent FROM #__fb_messages WHERE id='{$id}'");
        $this_message_parent = $kunena_db->loadResult();
        //Get the thread# for the same post
        $kunena_db->setQuery("SELECT thread FROM #__fb_messages WHERE id='{$id}'");
        $this_message_thread = $kunena_db->loadResult();
        //determine the correct thread# for the entire thread
        if ($this_message_parent == 0) {
            $thread = $id;
        } else {
            $thread = $this_message_thread;
        }
        //get all the messages for this thread
        $kunena_db->setQuery("SELECT * FROM #__fb_messages AS m LEFT JOIN #__fb_messages_text AS t ON m.id=t.mesid WHERE (thread='{$thread}' OR id='{$thread}') AND hold='0' ORDER BY time DESC LIMIT " . $fbConfig->historylimit);
        $messages = $kunena_db->loadObjectList();
        check_dberror("Unable to load messages.");
        //and the subject of the first thread (for reference)
        $kunena_db->setQuery("SELECT subject FROM #__fb_messages WHERE id='{$thread}' and parent='0'");
        $this_message_subject = $kunena_db->loadResult();
        check_dberror("Unable to load messages.");
        echo "<b>" . _POST_TOPIC_HISTORY . ":</b> " . kunena_htmlspecialchars(stripslashes($this_message_subject)) . " <br />" . _POST_TOPIC_HISTORY_MAX . " {$fbConfig->historylimit} " . _POST_TOPIC_HISTORY_LAST . "<br />";
        ?>

        <table border = "0" cellspacing = "1" cellpadding = "3" width = "100%" class = "fb_review_table">
            <tr>
                <td class = "fb_review_header" width = "20%" align = "center">
                    <strong><?php 
        echo _GEN_AUTHOR;
        ?>
</strong>
                </td>

                <td class = "fb_review_header" align = "center">
                    <strong><?php 
        echo _GEN_MESSAGE;
        ?>
</strong>
                </td>
            </tr>

            <?php 
        $k = 0;
        $smileyList = smile::getEmoticons(1);
        foreach ($messages as $mes) {
            $k = 1 - $k;
            $mes->name = kunena_htmlspecialchars($mes->name);
            $mes->email = kunena_htmlspecialchars($mes->email);
            $mes->subject = kunena_htmlspecialchars($mes->subject);
            $fb_message_txt = stripslashes($mes->message);
            $fb_message_txt = smile::smileReplace($fb_message_txt, 1, $fbConfig->disemoticons, $smileyList);
            $fb_message_txt = nl2br($fb_message_txt);
            $fb_message_txt = str_replace("__FBTAB__", "\t", $fb_message_txt);
            ?>

                <tr>
                    <td class = "fb_review_body<?php 
            echo $k;
            ?>
" valign = "top">
                        <?php 
            echo stripslashes($mes->name);
            ?>
                    </td>

                    <td class = "fb_review_body<?php 
            echo $k;
            ?>
">
                        <?php 
            $fb_message_txt = str_replace("</P><br />", "</P>", $fb_message_txt);
            //Long Words Wrap:
            $fb_message_txt = smile::htmlwrap($fb_message_txt, $fbConfig->wrap);
            $fb_message_txt = CKunenaTools::prepareContent($fb_message_txt);
            echo $fb_message_txt;
            ?>
                    </td>
                </tr>

            <?php 
        }
        ?>
        </table>

<?php 
    }
    //else: this is a new topic so there can't be a history
}