Example #1
0
 /** 
  * Gets categories data 
  * 
  * @return array 
  */
 function getCategories()
 {
     global $mainframe, $option;
     static $items;
     if (isset($items)) {
         return $items;
     }
     $params = JComponentHelper::getParams('com_discussions');
     $_dateformat = $params->get('dateformat', '%d.%m.%Y');
     $_timeformat = $params->get('timeformat', '%H:%i');
     $db =& $this->getDBO();
     $user =& JFactory::getUser();
     $logUser = new CofiUser($user->id);
     if ($logUser->isModerator()) {
         // show me all categories
         $query = "SELECT c.id, c.parent_id, c.name, c.alias, c.description, c.image, c.show_image, c.published, \n\t\t\t\t\t\tc.counter_posts, c.counter_threads, \n\t\t\t\t\t\tDATE_FORMAT( c.last_entry_date, '" . $_dateformat . " " . $_timeformat . "') AS last_entry_date, c.last_entry_user_id, u.username,\n\t\t\t\t\t\tCASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as slug\n\t\t\t\t\t\tFROM " . $db->nameQuote('#__discussions_categories') . "c LEFT JOIN  (" . $db->nameQuote('#__users') . " u) ON u.id=c.last_entry_user_id \n\t\t\t\t\t\tWHERE c.published='1' ORDER by c.ordering ASC";
     } else {
         // only show the public forums (privates are hidden)
         $query = "SELECT c.id, c.parent_id, c.name, c.alias, c.description, c.image, c.show_image, c.published, \n\t\t\t\t\t\tc.counter_posts, c.counter_threads, \n\t\t\t\t\t\tDATE_FORMAT( c.last_entry_date, '" . $_dateformat . " " . $_timeformat . "') AS last_entry_date, c.last_entry_user_id, u.username,\n\t\t\t\t\t\tCASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as slug\n\t\t\t\t\t\tFROM " . $db->nameQuote('#__discussions_categories') . "c LEFT JOIN  (" . $db->nameQuote('#__users') . " u) ON u.id=c.last_entry_user_id \n\t\t\t\t\t\tWHERE c.private='0' AND c.published='1' ORDER by c.ordering ASC";
     }
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $children = array();
     if (count($rows)) {
         foreach ($rows as $row) {
             $pt = $row->parent_id;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $row);
             $children[$pt] = $list;
         }
     }
     $list = JHTML::_('menu.treerecurse', 0, '', array(), $children);
     $items = $list;
     return $items;
 }
Example #2
0
 /**
  * Constructor
  *
  * @since 1.5
  */
 function __construct()
 {
     parent::__construct();
     $app = JFactory::getApplication();
     $this->_task = JRequest::getString('task', '');
     $this->_thread = JRequest::getInt('thread', 0);
     $this->_categoryFrom = JRequest::getInt('catid', 0);
     $this->_categoryTo = JRequest::getInt('catidto', 0);
     $this->_post = JRequest::getInt('post', 0);
     if ($this->_post == 0) {
         $this->_post = JRequest::getInt('id', 0);
     }
     $user =& JFactory::getUser();
     $logUser = new CofiUser($user->id);
     if ($logUser->isModerator()) {
         switch ($this->_task) {
             case "move":
                 $this->_headline = JText::_('COFI_MOVE_THREAD');
                 if ($this->_categoryTo > 0) {
                     // move it now
                     $this->moveThread();
                 }
                 break;
             case "sticky":
                 $this->stickyThread();
                 break;
             case "unsticky":
                 $this->unstickyThread();
                 break;
             case "lock":
                 $this->lockThread();
                 break;
             case "unlock":
                 $this->unlockThread();
                 break;
             case "accept":
                 $this->acceptPost($this->_post);
                 break;
             case "deny":
                 $this->denyPost($this->_post);
                 break;
             case "createmsgaliases":
                 $this->createMsgAliases();
                 break;
             case "delete":
                 $this->deletePost($this->_post);
                 break;
             default:
                 break;
         }
     } else {
         // not allowed
         // redirect	link
         $redirectLink = JRoute::_("index.php?option=com_discussions&view=category&catid=" . $this->_categoryFrom);
         $app->redirect($redirectLink, JText::_('COFI_NO_ACCESS_TO_MODERATOR_FUNCTIONS'), "notice");
     }
 }
Example #3
0

	<?php 
$rowColor = 1;
foreach ($this->postings as $posting) {
    ?>

    	<tr>

			<td align="center" class="cofiIndexTableRow<?php 
    echo $rowColor;
    ?>
 cofiIndexTableRowReplies">

            <?php 
    $CofiUser = new CofiUser($posting->user_id);
    // $entryUsername = $CofiHelper->getUsernameById( $posting->user_id);
    $entryUsername = $CofiUser->getUsername();
    echo "<div class='cofiCategoryAvatarBox'>";
    if ($CofiUser->getAvatar() == "") {
        // display default avatar
        echo "<img src='" . $_root . "components/com_discussions/assets/users/user.png' class='cofiCategoryDefaultAvatar' alt='" . $entryUsername . "' title='" . $entryUsername . "' />";
    } else {
        // display uploaded avatar
        echo "<img src='" . $_root . "images/discussions/users/" . $posting->user_id . "/small/" . $CofiUser->getAvatar() . "' class='cofiCategoryAvatar' alt='" . $entryUsername . "' title='" . $entryUsername . "' />";
    }
    echo "</div>";
    ?>

			</td>
Example #4
0
 /** 
  * Gets Threads data 
  * 
  * @return array 
  */
 function getThreads()
 {
     global $mainframe;
     //     	$_catid = JRequest::getVar('catid', 0);
     $_catid = JRequest::getInt('catid', 0);
     if ($this->getExistStatus() != null) {
         // check if this category exists
         // 1. check if this is a private (moderator only) forum
         if ($this->getPrivateStatus() == 1) {
             // 2. if it is private -> check if this user is a moderator
             $user =& JFactory::getUser();
             $logUser = new CofiUser($user->id);
             if ($logUser->isModerator() == 0) {
                 // user is not moderator -> kick him out of here
                 $redirectLink = JRoute::_("index.php?option=com_discussions");
                 $mainframe->redirect($redirectLink, JText::_('COFI_NO_ACCESS_TO_FORUM'), "notice");
             }
         }
         $db =& $this->getDBO();
         // Load threads if they doesn't exist
         if (empty($this->_data)) {
             $selectQuery = $this->_buildSelectQuery();
             $limitstart = $this->getState('limitstart');
             $limit = $this->getState('limit');
             $this->_data = $this->_getList($selectQuery, $limitstart, $limit);
         }
         // return the category list data
         return $this->_data;
     } else {
         // category does not exist
         $redirectLink = JRoute::_("index.php?option=com_discussions");
         $mainframe->redirect($redirectLink, JText::_('COFI_FORUM_NOT_EXISTS'), "notice");
     }
 }
Example #5
0
<?php

/**
 * @package		Codingfish Discussions
 * @subpackage	com_discussions
 * @copyright	Copyright (C) 2010 Codingfish (Achim Fischer). All rights reserved.
 * @license		GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
 * @link		http://www.codingfish.com
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
JHTML::_('stylesheet', 'discussions.css', 'components/com_discussions/assets/');
$user =& JFactory::getUser();
$CofiUser = new CofiUser($user->id);
$app = JFactory::getApplication();
// get parameters
$params = JComponentHelper::getParams('com_discussions');
// website root directory
$_root = JURI::root();
?>

<div class="codingfish">

<?php 
if ($this->params->def('show_page_title', 1)) {
    ?>
	<div class="componentheading<?php 
    echo $this->escape($this->params->get('pageclass_sfx'));
    ?>
">
		<?php 
Example #6
0
 function getReplyRecentListByThreadId($id, $number)
 {
     if ($id == '0' || $id == '') {
         return "";
     } else {
         $_html = "";
         // website root directory
         $_root = JURI::root();
         $params = JComponentHelper::getParams('com_discussions');
         $_dateformat = $params->get('dateformat', '%d.%m.%Y');
         $_timeformat = $params->get('timeformat', '%H:%i');
         $db =& JFactory::getDBO();
         $sql = "SELECT user_id, DATE_FORMAT( date, '" . $_dateformat . " " . $_timeformat . "') AS rdate, message FROM " . $db->nameQuote('#__discussions_messages') . " WHERE thread='" . $id . "' AND published='1' ORDER BY date DESC LIMIT " . $number;
         $db->setQuery($sql);
         $rows = $db->loadObjectList();
         $_html = "<table cellspacing='0' cellpadding='0' class='noborder' >";
         foreach ($rows as $row) {
             $rUsername = $this->getUsernameById($row->user_id);
             $rUser = new CofiUser($row->user_id);
             $_html .= "<tr>";
             $_html .= "<td width='50px' class='noborder' style='border-top: 1px dotted #CCC;'>";
             $_html .= "<div class='cofiCategoryAvatarBox'>";
             if ($rUser->getAvatar() == "") {
                 // display default avatar
                 $_html .= "<img src='" . $_root . "components/com_discussions/assets/users/user.png' class='cofiCategoryDefaultAvatar' alt='{$rUsername}' title='{$rUsername}' />";
             } else {
                 // display uploaded avatar
                 $_html .= "<img src='" . $_root . "images/discussions/users/" . $row->user_id . "/small/" . $rUser->getAvatar() . "' class='cofiCategoryAvatar' alt='{$rUsername}' title='{$rUsername}' />";
             }
             $_html .= "</div>";
             $_html .= "</td>";
             $_html .= "<td class='noborder' style='border-top: 1px dotted #CCC;'>";
             $_html .= "<b>" . $rUsername . "</b>";
             $_html .= "<br />";
             $_html .= $row->rdate;
             $_html .= "<br />";
             $_html .= "</td>";
             $_html .= "</tr>";
             $_html .= "<tr>";
             $_html .= "<td colspan='2' class='noborder' style='padding: 0px 10px 10px 10px;'>";
             $_html .= $row->message;
             $_html .= "</td>";
             $_html .= "</tr>";
         }
         $_html .= "</table>";
         if (!$rows) {
             return "";
         } else {
             return $_html;
         }
     }
 }
Example #7
0
	<?php 
$rowColor = 1;
$counter = 1;
foreach ($this->postings as $posting) {
    ?>

    	<tr>

			<td width="100" align="center" valign="top" class="cofiThreadTableRow<?php 
    echo $rowColor;
    ?>
 cofiThreadBorder1" >
                <?php 
    // show avatar and username
    echo "<div class='cofiAvatarBox'>";
    $CofiUser = new CofiUser($posting->user_id);
    // get $post->username;
    // $opUserUsername = $CofiHelper->getUsernameById( $posting->user_id);
    $opUserUsername = $CofiUser->getUsername();
    if ($CofiUser->getAvatar() == "") {
        // display default avatar
        echo "<img src='" . $_root . "components/com_discussions/assets/users/user.png' class='cofiAvatar' alt='{$opUserUsername}' title='{$opUserUsername}' />";
    } else {
        // display uploaded avatar
        echo "<img src='" . $_root . "images/discussions/users/" . $posting->user_id . "/large/" . $CofiUser->getAvatar() . "' class='cofiAvatar' alt='{$opUserUsername}' title='{$opUserUsername}' />";
    }
    echo "</div>";
    // display social media buttons
    $twitter = $CofiUser->getTwitter();
    $facebook = $CofiUser->getFacebook();
    $flickr = $CofiUser->getFlickr();
Example #8
0
 /**
  * save posting
  *
  * @return int
  */
 function savePosting()
 {
     //global $mainframe;
     $app = JFactory::getApplication();
     $params = JComponentHelper::getParams('com_discussions');
     $_dateformat = $params->get('dateformat', 'd.m.Y');
     $_timeformat = $params->get('timeformat', 'H:i');
     $user =& JFactory::getUser();
     $logUser = new CofiUser($user->id);
     $CofiHelper = new CofiHelper();
     $this->_headline = "";
     $this->_dbmode = JRequest::getString('dbmode', '');
     $_postSubject = JRequest::getString('postSubject', '', 'POST', JREQUEST_ALLOWRAW);
     $_postSubject = strip_tags($_postSubject);
     $_postText = JRequest::getString('postText', '', 'POST', JREQUEST_ALLOWRAW);
     $_postText = strip_tags($_postText);
     $_image1_description = JRequest::getString('image1_description', '');
     $_image1_description = strip_tags($_image1_description);
     $_image2_description = JRequest::getString('image2_description', '');
     $_image2_description = strip_tags($_image2_description);
     $_image3_description = JRequest::getString('image3_description', '');
     $_image3_description = strip_tags($_image3_description);
     $_image4_description = JRequest::getString('image4_description', '');
     $_image4_description = strip_tags($_image4_description);
     $_image5_description = JRequest::getString('image5_description', '');
     $_image5_description = strip_tags($_image5_description);
     $_postCatId = JRequest::getInt('catid', '0');
     $_postThread = JRequest::getInt('thread', '0');
     $_postParent = JRequest::getInt('parent', '0');
     $_postId = JRequest::getInt('id', '0');
     // get user IP address
     $_postIpAddress = $_SERVER['REMOTE_ADDR'];
     // redirect	link
     $redirectLink = JRoute::_("index.php?option=com_discussions&view=category&catid=" . $this->getCategorySlug());
     // check if user is logged in - maybe session has timed out
     if ($user->guest) {
         // if user is not logged in, kick him back into category
         $app->redirect($redirectLink, JText::_('COFI_POST_NOT_SAVED'), "message");
     }
     // 1. check if subject >= 5 chars
     // todo make minimum subject length configurable
     if (strlen($_postSubject) < 5) {
         $isSubjectTooShort = true;
     } else {
         $isSubjectTooShort = false;
     }
     // 2. check if text >= 5 chars
     // todo make minimum text length configurable
     if (strlen($_postText) < 5) {
         $isTextTooShort = true;
     } else {
         $isTextTooShort = false;
     }
     // check if insert or update
     // update
     if ($this->_dbmode == "update") {
         if (!$isSubjectTooShort && !$isTextTooShort) {
             // check if subject and text have minimum length
             $db =& $this->getDBO();
             // insert last edit time stamp
             $_unixtime = time();
             // todo change date, time calculation
             // get rid of the percentage symbol %
             $_dateformat = str_replace("%", "", $_dateformat);
             $_timeformat = str_replace("%", "", $_timeformat);
             //$_timeformat = "g:i A";
             $_date = date($_dateformat, $_unixtime);
             $_time = date($_timeformat, $_unixtime);
             $_timestamp = "\n\n" . JText::_('COFI_EDITED_BY') . " " . $user->username . " - " . $_date . " " . $_time;
             $_postText .= $_timestamp;
             if ($logUser->isModerator()) {
                 // moderators are allowed to edit all posts
                 $sql = "UPDATE " . $db->nameQuote('#__discussions_messages') . " SET" . " message = " . $db->Quote($_postText) . ", " . " image1_description = " . $db->Quote($_image1_description) . ", " . " image2_description = " . $db->Quote($_image2_description) . ", " . " image3_description = " . $db->Quote($_image3_description) . ", " . " image4_description = " . $db->Quote($_image4_description) . ", " . " image5_description = " . $db->Quote($_image5_description) . " WHERE id = '" . $_postId . "'";
             } else {
                 // no mod? then user must be owner
                 $sql = "UPDATE " . $db->nameQuote('#__discussions_messages') . " SET" . " message = " . $db->Quote($_postText) . ", " . " image1_description = " . $db->Quote($_image1_description) . ", " . " image2_description = " . $db->Quote($_image2_description) . ", " . " image3_description = " . $db->Quote($_image3_description) . ", " . " image4_description = " . $db->Quote($_image4_description) . ", " . " image5_description = " . $db->Quote($_image5_description) . " WHERE id = '" . $_postId . "' AND user_id = '" . $user->id . "'";
             }
             $db->setQuery($sql);
             $result = $db->query();
             // check if there are images to delete
             // get folder name
             $rootDir = JPATH_ROOT;
             $cb_image1 = JRequest::getString('cb_image1', '', 'POST');
             $cb_image2 = JRequest::getString('cb_image2', '', 'POST');
             $cb_image3 = JRequest::getString('cb_image3', '', 'POST');
             $cb_image4 = JRequest::getString('cb_image4', '', 'POST');
             $cb_image5 = JRequest::getString('cb_image5', '', 'POST');
             if ($cb_image1 == "delete") {
                 $this->del_image($_postThread, $_postId, "image1", $rootDir, $db, 1);
             }
             if ($cb_image2 == "delete") {
                 $this->del_image($_postThread, $_postId, "image2", $rootDir, $db, 2);
             }
             if ($cb_image3 == "delete") {
                 $this->del_image($_postThread, $_postId, "image3", $rootDir, $db, 3);
             }
             if ($cb_image4 == "delete") {
                 $this->del_image($_postThread, $_postId, "image4", $rootDir, $db, 4);
             }
             if ($cb_image5 == "delete") {
                 $this->del_image($_postThread, $_postId, "image5", $rootDir, $db, 5);
             }
             if ($result) {
                 // update went fine
                 // upload images to id folder
                 if (isset($_FILES['image1']) and !$_FILES['image1']['error']) {
                     $this->add_image($_postThread, $_postId, "image1", $rootDir, $db, 1);
                 }
                 if (isset($_FILES['image2']) and !$_FILES['image2']['error']) {
                     $this->add_image($_postThread, $_postId, "image2", $rootDir, $db, 2);
                 }
                 if (isset($_FILES['image3']) and !$_FILES['image3']['error']) {
                     $this->add_image($_postThread, $_postId, "image3", $rootDir, $db, 3);
                 }
                 if (isset($_FILES['image4']) and !$_FILES['image4']['error']) {
                     $this->add_image($_postThread, $_postId, "image4", $rootDir, $db, 4);
                 }
                 if (isset($_FILES['image5']) and !$_FILES['image5']['error']) {
                     $this->add_image($_postThread, $_postId, "image5", $rootDir, $db, 5);
                 }
             }
         }
     } else {
         if (!$isSubjectTooShort && !$isTextTooShort) {
             // check if subject and text have minimum length
             $db =& $this->getDBO();
             // preset is published and not moderated (normal state)
             $published = 1;
             $wfm = 0;
             // wfm = waiting for moderation
             if ($logUser->isModerator() == 0) {
                 // bypass these checks if user is moderator
                 // 1. check for rookie mode
                 // get Rookie Mode setting from com_discussions parameters
                 $rookie = $params->get('rookie', '0');
                 if ($rookie > 0) {
                     // we are in rookie mode
                     if ($logUser->isRookie() == 1) {
                         // user is a rookie
                         $wfm = 1;
                         // wfm = waiting for moderation
                         $published = 0;
                     }
                 }
                 // 2. check if this is a moderated user
                 if ($logUser->isModerated() == 1) {
                     // user is moderated
                     $wfm = 1;
                     // wfm = waiting for moderation
                     $published = 0;
                 }
                 // 3. check if this is a moderated category
                 if ($CofiHelper->isCategoryModerated($_postCatId)) {
                     // category is moderated
                     $wfm = 1;
                     // wfm = waiting for moderation
                     $published = 0;
                 }
             }
             // create alias for SEF URL
             jimport('joomla.filter.output');
             $alias = $_postSubject;
             $alias = JFilterOutput::stringURLSafe($alias);
             $insert_sql = "INSERT INTO " . $db->nameQuote('#__discussions_messages') . " ( parent_id, cat_id, thread, user_id, account, name, email, ip, subject, alias, message, image1_description,  image2_description, image3_description, image4_description, image5_description, published, wfm) " . " VALUES ( " . $_postParent . ", " . $_postCatId . ", " . $_postThread . ", '" . $user->id . "', '" . $user->username . "', '" . $user->name . "', '" . $user->email . "', '" . $_postIpAddress . "', " . $db->Quote($_postSubject) . ", " . $db->Quote($alias) . ", " . $db->Quote($_postText) . ", " . $db->Quote($_image1_description) . ", " . $db->Quote($_image2_description) . ", " . $db->Quote($_image3_description) . ", " . $db->Quote($_image4_description) . ", " . $db->Quote($_image5_description) . ", " . $published . ", " . $wfm . " )";
             $db->setQuery($insert_sql);
             $insert_result = $db->query();
             // $_postId = last_insert_id();
             $db->setQuery("SELECT LAST_INSERT_ID() FROM " . $db->nameQuote('#__discussions_messages'));
             $_postId = $db->loadResult();
             // get parent and set thread to id if 0
             if ($_postThread == 0) {
                 // no thread id, so it is like id
                 $_postThread = $_postId;
                 $sql = "UPDATE " . $db->nameQuote('#__discussions_messages') . " SET thread = '" . $_postThread . "' WHERE id = '" . $_postId . "'";
                 $db->setQuery($sql);
                 $result = $db->query();
             } else {
                 // thread is set
                 if ($_postParent == 0) {
                     // no parent id, so it is like thread id
                     $sql = "UPDATE " . $db->nameQuote('#__discussions_messages') . " SET parent_id = '" . $_postThread . "' WHERE id = '" . $_postId . "'";
                     $db->setQuery($sql);
                     $result = $db->query();
                 }
             }
             if ($insert_result) {
                 // if insert was successful update statistics
                 if ($published == 1) {
                     // thread goes live, so we can update stats
                     // set user post counter ++
                     $result = $CofiHelper->increaseUserPostCounter($user->id);
                     // update thread stats
                     $result = $CofiHelper->updateThreadStats($_postThread);
                     // update category stats
                     $result = $CofiHelper->updateCategoryStats($_postCatId);
                 }
                 // if published
             }
             if ($insert_result) {
                 // insert went fine
                 // upload image attachments todo
                 // get folder name
                 $rootDir = JPATH_ROOT;
                 if (isset($_FILES['image1']) and !$_FILES['image1']['error']) {
                     $this->add_image($_postThread, $_postId, "image1", $rootDir, $db, 1);
                 }
                 if (isset($_FILES['image2']) and !$_FILES['image2']['error']) {
                     $this->add_image($_postThread, $_postId, "image2", $rootDir, $db, 2);
                 }
                 if (isset($_FILES['image3']) and !$_FILES['image3']['error']) {
                     $this->add_image($_postThread, $_postId, "image3", $rootDir, $db, 3);
                 }
                 if (isset($_FILES['image4']) and !$_FILES['image4']['error']) {
                     $this->add_image($_postThread, $_postId, "image4", $rootDir, $db, 4);
                 }
                 if (isset($_FILES['image5']) and !$_FILES['image5']['error']) {
                     $this->add_image($_postThread, $_postId, "image5", $rootDir, $db, 5);
                 }
                 if ($wfm == 1) {
                     // this post needs moderator approval
                     $CofiHelper->sendEmailToModeratorsPostWFM();
                     $app->redirect($redirectLink, JText::_('COFI_POST_SAVED_NEEDS_APPROVAL'), "notice");
                 } else {
                     // redirect	link to last post
                     $redirectLinkToLastPost = $this->getLinkToLastPostByThreadId($_postThread);
                     $app->redirect($redirectLinkToLastPost, JText::_('COFI_POST_SAVED'), "notice");
                 }
             } else {
                 $app->redirect($redirectLink, JText::_('COFI_POST_NOT_SAVED_INSERT_ERROR'), "message");
             }
         }
     }
     // end insert
     if ($isSubjectTooShort) {
         $app->redirect($redirectLink, JText::_('COFI_POST_NOT_SAVED_SUBJECT_TOO_SHORT'), "message");
     }
     if ($isTextTooShort) {
         $app->redirect($redirectLink, JText::_('COFI_POST_NOT_SAVED_TEXT_TOO_SHORT'), "message");
     }
     // redirect	link to last post
     $redirectLinkToLastPost = $this->getLinkToLastPostByThreadId($_postThread);
     $app->redirect($redirectLinkToLastPost, JText::_('COFI_POST_SAVED'), "notice");
     return 0;
     // save OK
 }
Example #9
0
    echo "</div>";
    ?>

			</td> 

									
			<td width="200" align="center" class="cofiIndexTableRow<?php 
    echo $rowColor;
    ?>
 cofiIndexTableRowLastPost">

                <table width="100%" cellspacing="0" cellpadding="0" border="0" class="noborder">
                    <tr>
                        <td width="32" align="left" class="noborder">
                            <?php 
    $CofiUser = new CofiUser($thread->last_entry_user_id);
    echo "<div class='cofiCategoryAvatarBox'>";
    // $lastEntryUserUsername = $CofiHelper->getUsernameById( $thread->last_entry_user_id);
    $lastEntryUserUsername = $CofiUser->getUsername();
    if ($CofiUser->getAvatar() == "") {
        // display default avatar
        echo "<img src='" . $_root . "components/com_discussions/assets/users/user.png' class='cofiCategoryDefaultAvatar' alt='{$lastEntryUserUsername}' title='{$lastEntryUserUsername}' />";
    } else {
        // display uploaded avatar
        echo "<img src='" . $_root . "images/discussions/users/" . $thread->last_entry_user_id . "/small/" . $CofiUser->getAvatar() . "' class='cofiCategoryAvatar' alt='{$lastEntryUserUsername}' title='{$lastEntryUserUsername}' />";
    }
    echo "</div>";
    ?>
                        </td>
                        <td align="left" valign="center" class="noborder" style="padding-left: 5px;">
                            <?php 
Example #10
0
        $rowColor = 2;
        foreach ($this->postingsWFM as $posting) {
            ?>
				
				    	<tr>
				
							<td width="100" align="center" valign="top" class="cofiThreadTableRow<?php 
            echo $rowColor;
            ?>
 cofiModerationBorder1" >
				                <?php 
            // get $post->username;
            $opUserUsername = $CofiHelper->getUsernameById($posting->user_id);
            // show avatar
            echo "<div class='cofiAvatarBox'>";
            $CofiUser = new CofiUser($posting->user_id);
            if ($CofiUser->getAvatar() == "") {
                // display default avatar
                echo "<img src='" . $_root . "components/com_discussions/assets/users/user.png' class='cofiAvatar' alt='{$opUserUsername}' />";
            } else {
                // display uploaded avatar
                echo "<img src='" . $_root . "images/discussions/users/" . $posting->user_id . "/large/" . $CofiUser->getAvatar() . "' class='cofiAvatar' alt='{$opUserUsername}' />";
            }
            echo "</div>";
            // display username
            echo "<br />";
            echo "<b>";
            echo $opUserUsername;
            echo "</b>";
            echo "<br />";
            echo "<div class='cofiAvatarColumnPosts'>";
Example #11
0
<?php

/**
 * @package		Codingfish Discussions
 * @subpackage	com_discussions
 * @copyright	Copyright (C) 2010 Codingfish (Achim Fischer). All rights reserved.
 * @license		GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
 * @link		http://www.codingfish.com
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
JHTML::_('stylesheet', 'discussions.css', 'components/com_discussions/assets/');
//require_once(JPATH_COMPONENT.DS.'helpers'.DS.'discussions.php');
require_once JPATH_COMPONENT . DS . 'classes/user.php';
$user =& JFactory::getUser();
$logUser = new CofiUser($user->id);
?>

<div class="codingfish">

<?php 
$document =& JFactory::getDocument();
// set page description
if (JText::_('COFI_INDEX_META_DESCRIPTION') == "") {
    $pageDescription = "";
    // to joomla 1.6
    //	$pageDescriptionSuffix = $mainframe->getCfg('sitename');
    $pageDescriptionSuffix = "";
}
// get parameters
$params = JComponentHelper::getParams('com_discussions');