/** * Outputs a list of all posts alerted by users. * * This function output a list of all post alerts submitted by users. * It allows a filtering by post alert status and different ordering options. * @param array $conf The calling plugin's configuration vars * @return string The post alert list */ function list_alerts($conf) { $param = GeneralUtility::_GP('tx_mmforum_pi1'); if ($param['update'] == 'update_status') { foreach ($param as $key => $value) { $key = str_replace('status_', '', $key); if (is_numeric($key)) { $key = $this->databaseHandle->fullQuoteStr($key, 'tx_mmforum_post_alert'); $value = $this->databaseHandle->fullQuoteStr($value, 'tx_mmforum_post_alert'); $updateArray = array('status' => $value, 'tstamp' => $GLOBALS['EXEC_TIME']); $this->databaseHandle->exec_UPDATEquery('tx_mmforum_post_alert', 'uid=' . $key . ' AND status <> ' . $value, $updateArray); } } } $template = $this->cObj->fileResource($conf['template.']['post_alert']); $template = $this->cObj->getSubpart($template, "###ALERT_LIST###"); $template_sub = $this->cObj->getSubpart($template, "###ALERT_LIST_SUB###"); // Language dependent markers $marker = array('###LABEL_POSTALERTS###' => $this->pi_getLL('postalert.title'), '###LABEL_ORDERBY###' => $this->pi_getLL('postalert.orderby'), '###LABEL_ORDERBY_STATUS###' => $this->pi_getLL('postalert.orderby.status'), '###LABEL_ORDERBY_DATE###' => $this->pi_getLL('postalert.orderby.date'), '###LABEL_ORDERBY_USER###' => $this->pi_getLL('postalert.orderby.user'), '###LABEL_ORDERASC###' => $this->pi_getLL('postalert.ordermode.asc'), '###LABEL_ORDERDESC###' => $this->pi_getLL('postalert.ordermode.desc'), '###LABEL_DISPLAY###' => $this->pi_getLL('postalert.display'), '###LABEL_OPEN###' => $this->pi_getLL('postalert.status.open'), '###LABEL_INPROGRESS###' => $this->pi_getLL('postalert.status.progress'), '###LABEL_DONE###' => $this->pi_getLL('postalert.status.done'), '###LABEL_NR###' => $this->pi_getLL('postalert.number'), '###LABEL_DATE###' => $this->pi_getLL('postalert.date'), '###LABEL_PROBLEM###' => $this->pi_getLL('postalert.problem'), '###LABEL_POST###' => $this->pi_getLL('postalert.post'), '###LABEL_USER###' => $this->pi_getLL('postalert.user'), '###LABEL_STATUS###' => $this->pi_getLL('postalert.status'), '###LABEL_POSTTEXT###' => $this->pi_getLL('postalert.posttext')); $marker['###ORDERBY_USER###'] = ''; $marker['###ORDERBY_DATE###'] = ''; $marker['###ORDERBY_STAT###'] = ''; $marker['###ORDERASC###'] = ''; $marker['###ORDERDESC###'] = ''; $marker['###VIEW_OPEN###'] = ''; $marker['###VIEW_WORK###'] = ''; $marker['###VIEW_CLOSE###'] = ''; // Determine ordering mode switch ($param['order_by']) { case "user": $order_by = 'cruser_id'; $marker['###ORDERBY_USER###'] = 'selected'; break; case "date": $order_by = 'crdate'; $marker['###ORDERBY_DATE###'] = 'selected'; break; case "status": $order_by = 'status'; $marker['###ORDERBY_STAT###'] = 'selected'; break; default: $order_by = 'status'; $marker['###ORDERBY_STAT###'] = 'selected'; break; } switch ($param['order']) { case "up": $order = 'ASC'; $marker['###ORDERASC###'] = 'selected'; break; case "down": $order = 'DESC'; $marker['###ORDERDESC###'] = 'selected'; break; default: $order = 'ASC'; $marker['###ORDERASC###'] = 'selected'; break; } $allowedStatus = array(); // Determine filtering mode if ($param['view_open'] == 1) { $marker['###VIEW_OPEN###'] = 'checked'; #$where .= 'OR status = -1 '; $allowedStatus[] = -1; } if ($param['view_work'] == 1) { $marker['###VIEW_WORK###'] = 'checked'; #$where .= 'OR status = 0 ';= -1 '; $allowedStatus[] = 0; } if ($param['view_close'] == 1) { $marker['###VIEW_CLOSE###'] = 'checked'; #$where .= 'OR status = 1 ';= -1 '; $allowedStatus[] = 1; } if ($param['view_close'] == '' and $param['view_work'] == '' and $param['view_open'] == '' and empty($param)) { $marker['###VIEW_OPEN###'] = 'checked'; $marker['###VIEW_WORK###'] = 'checked'; $marker['###VIEW_CLOSE###'] = ''; #$where = ' OR status = -1 OR status = 0'; $allowedStatus = array(0, -1); } $where = count($allowedStatus) ? ' AND status IN (' . implode(',', $allowedStatus) . ') ' : ''; $boards = tx_mmforum_postalert::getModeratorBoards(); if ($boards === false) { $accessWhere = ' AND 0=1 '; } elseif ($boards === true) { $accessWhere = ' AND 1=1 '; } else { $accessWhere = ' AND t.forum_id IN (' . implode(',', $boards) . ') '; } // Load post alert records from database $res = $this->databaseHandle->exec_SELECTquery('a.*', 'tx_mmforum_post_alert a LEFT JOIN tx_mmforum_topics t ON a.topic_id = t.uid', "1 = 1 {$where} {$accessWhere}", '', $order_by . ' ' . $order); $content_sub = ''; while ($row = $this->databaseHandle->sql_fetch_assoc($res)) { $marker['###STATUS###'] = ''; switch ($row['status']) { case '-1': $marker['###STATCOLOR###'] = $this->conf['postalerts.']['statusColors.']['open']; $marker['###STATUS###'] .= '<option value="-1" selected>' . $this->pi_getLL('postalert.status.open') . '</option>'; $marker['###STATUS###'] .= '<option value="0">' . $this->pi_getLL('postalert.status.progress') . '</option>'; $marker['###STATUS###'] .= '<option value="1">' . $this->pi_getLL('postalert.status.done') . '</option>'; break; case '0': $marker['###STATCOLOR###'] = $this->conf['postalerts.']['statusColors.']['work']; $marker['###STATUS###'] .= '<option value="-1">' . $this->pi_getLL('postalert.status.open') . '</option>'; $marker['###STATUS###'] .= '<option value="0" selected>' . $this->pi_getLL('postalert.status.progress') . '</option>'; $marker['###STATUS###'] .= '<option value="1">' . $this->pi_getLL('postalert.status.done') . '</option>'; break; case '1': $marker['###STATCOLOR###'] = $this->conf['postalerts.']['statusColors.']['done']; $marker['###STATUS###'] .= '<option value="-1">' . $this->pi_getLL('postalert.status.open') . '</option>'; $marker['###STATUS###'] .= '<option value="0">' . $this->pi_getLL('postalert.status.progress') . '</option>'; $marker['###STATUS###'] .= '<option value="1" selected>' . $this->pi_getLL('postalert.status.done') . '</option>'; break; } $linkparams[$this->prefixId] = array('action' => 'list_post', 'tid' => $row['topic_id'], 'pid' => $row['post_id']); list($posttext) = $this->databaseHandle->sql_fetch_row($this->databaseHandle->exec_SELECTquery('post_text', 'tx_mmforum_posts_text', 'deleted="0" AND hidden="0" AND post_id="' . $row['post_id'] . '"')); $marker['###UID###'] = $row['uid']; $marker['###TOPIC###'] = $this->pi_linkToPage($this->escape($this->get_topic_name($row['topic_id'])), $conf['pid_forum'], $target = '_self', $linkparams); $marker['###DATE###'] = $this->formatDate($row['crdate']); $marker['###POST_TEXT###'] = nl2br($this->escape($posttext)); $marker['###TEXT_SHORT###'] = $this->escape(tx_mmforum_tools::textCut($row['alert_text'], 15, '')); $marker['###TEXT###'] = nl2br($this->escape($row['alert_text'])); $mod_data = tx_mmforum_tools::get_userdata($row['cruser_id']); $marker['###MOD###'] = $mod_data[$this->getUserNameField()]; $marker['###POST_USER###'] = $this->pi_linkToPage($mod_data[$this->getUserNameField()], $conf['pm_id'], '', array('tx_mmforum_pi3[action]' => 'message_write', 'userid' => $row['cruser_id'])); $content_sub .= $this->cObj->substituteMarkerArrayCached($template_sub, $marker); } $content = $this->cObj->substituteSubpart($template, '###ALERT_LIST_SUB###', $content_sub); $marker['###FORMACTION###'] = $this->escapeURL($this->pi_getPageLink($GLOBALS["TSFE"]->id, '', $linkparams)); $content = $this->cObj->substituteMarkerArrayCached($content, $marker); return $content; }
/** * Outputs information about a specific user for the post listing. * @param int $uid The UID of the user whose information are to be displayed * @param array $conf The configuration vars of the plugin * @param bool $threadauthor TRUE, if the user is the author of the thread displayed. In * this case, a special string telling that this user is the author * of the thread is displayed. * @return string The user information */ function ident_user($uid, $conf, $threadauthor = FALSE) { $userData = !is_array($uid) ? tx_mmforum_tools::get_userdata($uid) : $uid; $template = $this->cObj->fileResource($this->conf['template.']['list_post']); $template = $this->cObj->getSubpart($template, '###USERINFO###'); if ($template) { $avatar = $this->getUserAvatar($userData); $marker = array('###LLL_DELETED###' => $this->pi_getLL('user-deleted'), '###USERNAME###' => $this->cObj->stdWrap($userData[$this->getUserNameField()], $this->conf['list_posts.']['userinfo.']['username_stdWrap.']), '###USERREALNAME###' => $this->cObj->stdWrap($userData['name'], $this->conf['list_posts.']['userinfo.']['realname_stdWrap.']), '###USERRANKS###' => $this->get_userranking($uid, $conf), '###TOPICCREATOR###' => $uid == $threadauthor ? $this->cObj->stdWrap($this->pi_getLL('topic-topicauthor'), $this->conf['list_posts.']['userinfo.']['creator_stdWrap.']) : '', '###AVATAR###' => $avatar, '###LLL_REGSINCE###' => $this->pi_getLL('user-regSince'), '###LLL_POSTCOUNT###' => $this->pi_getLL('user-posts'), '###REGSINCE###' => $this->cObj->stdWrap($userData['crdate'], $this->conf['list_posts.']['userinfo.']['crdate_stdWrap.']), '###POSTCOUNT###' => intval($userData['tx_mmforum_posts']), '###USER_RATING###' => $this->isUserRating() ? $this->getRatingDisplay('fe_users', $userData['uid']) : ''); if ($userData === false) { $template = $this->cObj->substituteSubpart($template, '###USERINFO_REGULAR###', ''); } else { $template = $this->cObj->substituteSubpart($template, '###USERINFO_DELETED###', ''); } // Include hooks if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['userInformation_marker'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['userInformation_marker'] as $_classRef) { $_procObj =& GeneralUtility::getUserObj($_classRef); $marker = $_procObj->userInformation_marker($marker, $userData, $this); } } $content = $this->cObj->substituteMarkerArray($template, $marker); } else { if ($userData === false) { return '<strong>' . $this->pi_getLL('user.deleted') . '</strong>'; } $content = '<strong>' . $userData[$this->getUserNameField()] . '</strong><br />'; if ($this->conf['list_posts.']['userinfo_realName'] && $userData['name']) { $content .= $this->cObj->wrap($userData['name'], $this->conf['list_posts.']['userinfo_realName_wrap']); } $userranking = $this->get_userranking($uid, $conf) . '<br />'; if ($uid == $threadauthor) { $userranking .= $this->cObj->wrap($this->pi_getLL('topic.topicauthor'), $this->conf['list_posts.']['userinfo_topicauthor_wrap']); } $content .= $userranking; if ($userData['tx_mmforum_avatar']) { $content .= $this->tools->res_img($conf['path_avatar'] . $userData['tx_mmforum_avatar'], $conf['avatar_height'], $conf['avatar_width']); } $content .= $this->cObj->wrap($this->pi_getLL('user.regSince') . ': ' . date('d.m.Y', $userData['crdate']) . '<br />' . $this->pi_getLL('user.posts') . ': ' . $userData['tx_mmforum_posts'], $this->conf['list_posts.']['userinfo_content_wrap']); } return $content; }
/** * Displays a single private message. * * @author Georg Ringer <*****@*****.**> * @version 2007-05-02 * @param string $content The content * @param array $conf The plugin's configuration vars * @return string The plugin content */ function message_read($content, $conf) { // Load message from database $field = 'uid, subject, from_name, sendtime, message, read_flg, from_uid'; $where = 'hidden = 0 AND DELETED = 0 AND uid = ' . intval($this->piVars["messid"]) . ' AND to_uid = ' . $GLOBALS['TSFE']->fe_user->user['uid'] . $this->getStoragePIDQuery(); $res = $this->databaseHandle->exec_SELECTquery($field, 'tx_mmforum_pminbox', $where, '', '', $limit = 1); if ($res) { // Set read flag $val = array('read_flg' => 1); $this->databaseHandle->exec_UPDATEquery('tx_mmforum_pminbox', $where, $val); // Display message $content = $this->top_navi($content, $conf); $template = $this->cObj->fileResource($conf['template.']['message_read']); $template = $this->cObj->getSubpart($template, "###MESSAGE_READ###"); $marker = array('###LABEL_FROM###' => $this->pi_getLL('headerTofromInbox'), '###LABEL_DATE###' => $this->pi_getLL('headerDate'), '###LABEL_SUBJECT###' => $this->pi_getLL('headerSubject'), '###LABEL_READMESSAGE###' => $this->pi_getLL('read.readMessage')); $row = $this->databaseHandle->sql_fetch_assoc($res); $marker['###MESSID###'] = $row['uid']; $marker['###SUBJECT###'] = $this->escape($row['subject']); $message_text = $row['message']; #$message_text = tx_mmforum_postparser::main($this,$this->conf,$message_text,'textparser'); if ($row['mess_type'] == 1) { $userdata = tx_mmforum_tools::get_userdata($row['to_uid']); $marker['###LABEL_FROM###'] = $this->pi_getLL('headerTofromOutbox'); } else { $userdata = tx_mmforum_tools::get_userdata($row['from_uid']); } if ($userdata === FALSE) { $marker['###FROM###'] = $this->pi_getLL('user.deleted'); } elseif ($userdata['deleted']) { $marker['###FROM###'] = $this->escape($userdata[$this->getUserNameField()]); } else { $marker['###FROM###'] = $this->linkToUserProfile($userdata); } $marker['###DATE###'] = $this->formatDate($row['sendtime']); $marker['###MESSAGE###'] = nl2br($this->escape($message_text)); if (!($userdata === FALSE || $userdata['deleted'] == 1)) { $linkParams = array(); $linkParams[$this->prefixId] = array('action' => 'message_write', 'messid' => $row['uid']); if ($this->useRealUrl()) { $linkParams[$this->prefixId]['folder'] = $this->piVars['folder'] ? $this->piVars['folder'] : 'inbox'; } $marker['###REPLY###'] = $this->createButton('pmreply', $linkParams); } else { $marker['###REPLY###'] = ''; } $linkParams[$this->prefixId] = array('action' => 'message_del', 'messid' => $row['uid']); if ($this->useRealUrl()) { $linkParams[$this->prefixId]['folder'] = $this->piVars['folder'] ? $this->piVars['folder'] : 'inbox'; } $marker['###DELETE###'] = $this->createButton('pmdelete', $linkParams, 0, false, '', false, 'onclick="return confirm(\'' . $this->pi_getLL('deleteConfirm') . '\');"'); } else { $template = $this->cObj->fileResource($conf['template.']['error_message']); $marker['###ERROR###'] = $this->pi_getLL('errorNoAccess'); $marker['###BACKLINK###'] = '<a href="javascript:history.back()">' . $this->pi_getLL('back') . '</a>'; } $content .= $this->cObj->substituteMarkerArrayCached($template, $marker); return $content; }
/** * Returns a link to a user's profile page * @param int $userId The UID of the user, to whose profile page is to be linked * @return string The HTML-Link tag */ function getauthor($userId) { $userData = tx_mmforum_tools::get_userdata($userId); if ($userData === false) { $content = $this->pi_getLL('user.deleted'); } else { if (!$userData['deleted']) { $content = $this->linkToUserProfile($userData); } else { $content = $this->escape($userData[$this->getUserNameField()]); } } // Include hooks if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['profileLink_postContentHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['profileLink_postContentHook'] as $_classRef) { $_procObj =& GeneralUtility::getUserObj($_classRef); $content = $_procObj->profileLink_postContentHook($content, $userData, $this); } } return $content; }