コード例 #1
0
 /**
  * Displays the post queue.
  * This function displays all elements of the postqueue in a list
  * view.
  *
  * @author  Martin Helmich
  * @version 2007-07-21
  * @return  string The postqueue list content
  */
 function display_postQueue()
 {
     $template = $this->cObj->fileResource($this->conf['template.']['postqueue']);
     $template = $this->cObj->getSubpart($template, '###POSTQUEUE_LIST###');
     $template_row = $this->cObj->getSubpart($template, '###POSTQUEUE_ITEM###');
     $marker = array('###LLL_PUBLISH###' => $this->pi_getLL('postqueue.publishtab'), '###LLL_DELETE###' => $this->pi_getLL('postqueue.deletetab'), '###LLL_IGNORE###' => $this->pi_getLL('postqueue.ignoretab'), '###LLL_POSTTEXT###' => $this->pi_getLL('postqueue.posttext'), '###LLL_POSTQUEUE###' => $this->pi_getLL('postqueue.title'), '###LLL_PUBLISHBUTTON###' => $this->pi_getLL('postqueue.publishbutton'), '###LLL_NOITEMS###' => $this->pi_getLL('postqueue.noitems'), '###ACTION###' => $this->parent->escapeURL($this->parent->pi_getPageLink($GLOBALS['TSFE']->id)));
     $template = $this->cObj->substituteMarkerArray($template, $marker);
     $rContent = '';
     $boards = $this->getModeratorBoards();
     if (is_array($boards)) {
         $res = $this->databaseHandle->exec_SELECTquery('q.*', 'tx_mmforum_postqueue q LEFT JOIN tx_mmforum_topics t ON q.post_parent = t.uid', 'q.deleted = 0 AND (t.deleted=0 OR t.uid IS NULL) AND (q.topic_forum IN (' . implode(',', $boards) . ') OR t.forum_id IN (' . implode(',', $boards) . '))', '', 'q.crdate DESC');
     } elseif ($boards === true) {
         $res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_postqueue', 'deleted=0', '', 'crdate DESC');
     }
     if ($boards !== false) {
         if ($this->databaseHandle->sql_num_rows($res) > 0) {
             $template = $this->cObj->substituteSubpart($template, '###POSTQUEUE_NOITEMS###', '');
         } else {
             $template = $this->cObj->substituteSubpart($template, '###POSTQUEUE_ITEMLIST###', '');
         }
         while ($arr = $this->databaseHandle->sql_fetch_assoc($res)) {
             $rMarker = array('###LLL_WROTE###' => $this->pi_getLL('postqueue.wrote'), '###DATE###' => $this->parent->formatDate($arr['post_time']), '###POST_TEXT###' => $this->tx_mmforum_postparser->main($this->parent, $this->conf, $this->parent->escape($arr['post_text']), 'textparser'), '###UID###' => $arr['uid'], '###POST_POSTER###' => $this->parent->linkToUserProfile($arr['post_user']), '###CHECK_DELETE###' => '', '###CHECK_IGNORE###' => $arr['hidden'] ? 'checked="checked"' : '', '###CHECK_PUBLISH###' => $arr['hidden'] ? '' : 'checked="checked"', '###FORUMPATH###' => $this->getForumLink($arr['topic_forum']));
             if ($arr['topic']) {
                 $rMarker['###TOPIC_LINK###'] = $this->parent->escape($arr['topic_title']) . ' [' . $this->pi_getLL('postqueue.newTopic') . ']';
             } else {
                 $tData = $this->parent->getTopicData($arr['post_parent']);
                 $linkParams[$this->parent->prefixId] = array('action' => 'list_post', 'tid' => $tData['uid']);
                 if ($this->parent->getIsRealURL()) {
                     $linkParams[$this->parent->prefixId]['fid'] = $tData['forum_id'];
                 }
                 $rMarker['###TOPIC_LINK###'] = $this->parent->pi_linkToPage($this->parent->escape($tData['topic_title']), $this->conf['pid_forum'], '', $linkParams);
             }
             $rContent .= $this->cObj->substituteMarkerArray($template_row, $rMarker);
         }
         $template = $this->cObj->substituteSubpart($template, '###POSTQUEUE_ITEM###', $rContent);
     } else {
         $template = $this->cObj->substituteSubpart($template, '###POSTQUEUE_ITEMLIST###', '');
     }
     return $template;
 }
コード例 #2
0
 /**
  * Display a poll.
  * This function displays a poll. Depending on whether the user that is
  * currently logged in is allowed to vote on this poll (this will be the
  * case if the user has not already voted in this poll and if the poll is
  * not yet expired), the user will see a set of radio buttons allowing him/her
  * to choose an answering possibility, or the poll results.
  *
  * @return  string The poll content
  * @version 2007-05-22
  */
 function objDisplay()
 {
     if ($this->piVars['poll']['vote'] == '1') {
         $this->objVote();
     }
     $template = $this->cObj->fileResource($this->conf['template.']['polls']);
     $template = $this->cObj->getSubpart($template, '###POLL_DISPLAY###');
     $vote = $this->getMayVote();
     if (!$vote) {
         $template = $this->cObj->substituteSubpart($template, '###POLL_SUBMIT###', '');
         $row_template = $this->cObj->getSubpart($template, '###POLL_ANSWER_2###');
     } else {
         $row_template = $this->cObj->getSubpart($template, '###POLL_ANSWER_1###');
     }
     $res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_polls_answers', 'poll_id=' . intval($this->data['uid']) . ' AND deleted=0');
     $i = 1;
     $aContent = '';
     while ($arr = $this->databaseHandle->sql_fetch_assoc($res)) {
         $pAnswers = $arr['votes'] > 0 ? round($arr['votes'] / $this->data['votes'] * 100) : 0;
         if ($this->conf['polls.']['pollBar_colorMap.'][$i]) {
             $color = $this->conf['polls.']['pollBar_colorMap.'][$i];
         } else {
             $color = $this->conf['polls.']['pollBar_colorMap.']['default'];
         }
         $aMarker = array('###ANSWER_UID###' => $arr['uid'], '###ANSWER_TEXT###' => $this->p->escape($arr['answer']), '###ANSWER_COUNT###' => sprintf($this->p->pi_getLL('poll.replies'), $arr['votes'], $this->data['votes'], $pAnswers . '%'), '###ANSWER_ANSWERS###' => '<div style="width: ' . $pAnswers . '%; height:10px; background-color: ' . $color . ';">&nbsp;</div>', '###ENABLE###' => '');
         $aContent .= $this->cObj->substituteMarkerArray($row_template, $aMarker);
         $i++;
     }
     $actionParams[$this->p->prefixId] = array('tid' => $this->p->piVars['tid'], 'fid' => $this->p->piVars['fid'], 'action' => 'list_post');
     $actionLink = $this->p->pi_getPageLink($GLOBALS['TSFE']->id, '', $actionParams);
     $marker = array('###LABEL_POLL###' => $this->p->pi_getLL('poll.title'), '###LABEL_VOTE###' => $this->p->pi_getLL('poll.vote'), '###LABEL_QUESTION###' => $this->p->pi_getLL('poll.question'), '###QUESTION###' => $this->p->escape($this->data['question']), '###EXPIRES###' => $this->data['endtime'] ? $this->p->pi_getLL('poll.expires') . ' ' . date('d. m. Y, H:i', $this->data['endtime']) : '', '###ACTION###' => $this->p->escapeURL($actionLink), '###ICON###' => $this->cObj->cObjGetSingle($this->conf['polls.']['poll_icon'], $this->conf['polls.']['poll_icon.']));
     $marker['###EXPIRES###'] = $this->cObj->stdWrap($marker['###EXPIRES###'], $this->conf['polls.']['expired_stdWrap.']);
     $template = $this->cObj->substituteMarkerArray($template, $marker);
     $template = $this->cObj->substituteSubpart($template, '###POLL_ANSWER_1###', $aContent);
     $template = $this->cObj->substituteSubpart($template, '###POLL_ANSWER_2###', '');
     return $template;
 }
コード例 #3
0
    /**
     * Sends an e-mail to users who have subscribed to certain forumcategory
     * @param $topicId int The UID of the new topic that was created
     * @param $forumId int The UID of the forum about which the users are to be alerted.
     * @param \tx_mmforum_base $forumObj
     * @return void
     * @author Cyrill Helg
     */
    static function notifyForumSubscribers($topicId, $forumId, \tx_mmforum_base $forumObj)
    {
        $res = $this->databaseHandle->exec_SELECTquery('topic_title', 'tx_mmforum_topics', 'uid = ' . intval($topicId) . $forumObj->getStoragePIDQuery());
        list($topicName) = $this->databaseHandle->sql_fetch_row($res);
        $res = $this->databaseHandle->exec_SELECTquery('forum_name, parentID', 'tx_mmforum_forums', 'uid = ' . intval($forumId) . $forumObj->getStoragePIDQuery());
        list($forumName, $categoryId) = $this->databaseHandle->sql_fetch_row($res);
        // prepare the template (the variables that don't change all the time need only to be set once)
        $linkParams[$forumObj->prefixId] = array('action' => 'open_topic', 'id' => $topicId);
        $link = $forumObj->pi_getPageLink($GLOBALS['TSFE']->id, '', $linkParams);
        $link = $forumObj->tools->escapeBrackets($link);
        if (strlen($forumObj->conf['notifyingMail.']['topicLinkPrefix_override']) > 0) {
            $link = $forumObj->conf['notifyingMail.']['topicLinkPrefix_override'] . $link;
        }
        $template = $forumObj->pi_getLL('ntfMailForum.text');
        $marker = array('###LINK###' => $link, '###USERNAME###' => $toUsername, '###FORUMNAME###' => $forumName, '###TEAM###' => $forumObj->conf['teamName']);
        $subjectMarker = array('###TOPICNAME###' => $topicName, '###FORUMNAME###' => $forumName, '###BOARDNAME###' => $forumObj->conf['boardName']);
        // loop through each user who subscribed
        $res = $this->databaseHandle->exec_SELECTquery('DISTINCT tx_mmforum_forummail.user_id, fe_users.email, fe_users.' . $forumObj->getUserNameField(), 'tx_mmforum_forummail, fe_users', 'tx_mmforum_forummail.user_id = fe_users.uid AND
			 (tx_mmforum_forummail.forum_id = ' . intval($forumId) . ($categoryId > 0 ? ' OR tx_mmforum_forummail.forum_id = ' . $categoryId : '') . ') AND
			 fe_users.deleted = 0 AND
			 fe_users.disable = 0 AND
			 fe_users.email != "" AND
			 tx_mmforum_forummail.user_id != ' . intval($GLOBALS['TSFE']->fe_user->user['uid']) . $forumObj->getStoragePIDQuery('tx_mmforum_forummail'));
        while (list($toUserId, $toEmail, $toUsername) = $this->databaseHandle->sql_fetch_row($res)) {
            $marker['###USERNAME###'] = $forumObj->escape($toUsername);
            $mailtext = $forumObj->cObj->substituteMarkerArrayCached($template, $marker);
            // Compose mail and send
            $subject = $forumObj->cObj->substituteMarkerArray($forumObj->pi_getLL('ntfMailForum.subject'), $subjectMarker);
            $mail = GeneralUtility::makeInstance('t3lib_mail_Message');
            $mail->setFrom(array($forumObj->conf['notifyingMail.']['sender_address'] => $forumObj->conf['notifyingMail.']['sender']));
            $mail->setTo(array($toEmail => $toUsername));
            $mail->setSubject($subject);
            $mail->setBody($mailtext, 'text/plain');
            $mail->send();
        }
    }
コード例 #4
0
 /**
  *
  * Generates a HTTP redirect to a specific action of this controller.
  *
  * @access private
  * @param  Array $args Arguments for the redirect URL
  * @return Void
  */
 function redirectToAction($args)
 {
     HttpUtility::redirect($this->p->pi_getPageLink($GLOBALS['TSFE']->id, NULL, array($this->p->prefixId => $args)));
 }