コード例 #1
0
 public function __construct()
 {
     $this->tx_mmforum_postparser = GeneralUtility::makeInstance('tx_mmforum_postparser');
     $this->tx_mmforum_postqueue = GeneralUtility::makeInstance('tx_mmforum_postqueue');
     $this->pi_loadLL();
     parent::__construct();
 }
コード例 #2
0
 /**
  * @param array $conf
  * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj
  */
 public function __construct($conf, $cObj)
 {
     $this->injectCObj($cObj);
     $this->injectConf($conf);
     $this->tx_mmforum_rss = GeneralUtility::makeInstance('tx_mmforum_rss');
     $this->tx_mmforum_postparser = GeneralUtility::makeInstance('tx_mmforum_postparser');
     parent::__construct();
 }
コード例 #3
0
 /**
  * @return array|bool
  */
 function getModeratorBoards()
 {
     if ($this->parent->getIsAdmin()) {
         return true;
     }
     $groups = $GLOBALS['TSFE']->fe_user->groupData['uid'];
     if (count($groups) == 0) {
         return false;
     }
     $queryParts = array();
     foreach ($groups as $group) {
         $queryParts[] = 'FIND_IN_SET(' . $group . ',c.grouprights_mod)';
         $queryParts[] = 'FIND_IN_SET(' . $group . ',f.grouprights_mod)';
     }
     $query = implode(' OR ', $queryParts);
     $res = $this->databaseHandle->exec_SELECTquery('f.uid', 'tx_mmforum_forums f LEFT JOIN tx_mmforum_forums c ON c.uid=f.parentID', 'f.deleted=0 AND c.deleted=0 AND (' . $query . ')');
     $result = array();
     while (list($uid) = $this->databaseHandle->sql_fetch_row($res)) {
         $result[] = $uid;
     }
     return count($result) ? $result : false;
 }
コード例 #4
0
 /**
  * Displays a poll creation form.
  * This function displays a form allowing the user to create a new post.
  *
  * @param array $piVars
  * @param tx_mmforum_base $pObj
  * @return  string The form content
  * @version 2007-05-25
  */
 function display_createForm($piVars = array(), $pObj = NULL)
 {
     if (!$pObj->conf['polls.']['enable']) {
         return '';
     }
     $defACount = $pObj->conf['polls.']['minAnswers'];
     $rDefACount = $defACount;
     if ($piVars) {
         $defACount = count($piVars['answer']['new']) > $defACount ? count($piVars['answer']['new']) : $defACount;
     }
     $template = $pObj->cObj->fileResource($pObj->conf['template.']['polls']);
     $template = $pObj->cObj->getSubpart($template, '###POLL_FORM###');
     $answerTemplate = $pObj->cObj->getSubpart($template, '###ANSWERSECTION###');
     $marker = array('###LABEL_QUESTION###' => $pObj->pi_getLL('poll.question'), '###LABEL_ANSWERS###' => $pObj->pi_getLL('poll.answers'), '###QUESTION###' => $pObj->escape($piVars ? $piVars['question'] : ''), '###ANSWER###' => '', '###DELETE###' => $pObj->pi_getLL('poll.deleteAnswer'), '###ADD_ANSWER###' => $pObj->pi_getLL('poll.addAnswer'), '###DELCONFIRM###' => $pObj->pi_getLL('poll.deleteAnswerConf'), '###LABEL_EXPIRES###' => $pObj->pi_getLL('poll.expires'), '###LABEL_NEWANSWER###' => $pObj->pi_getLL('poll.addAnswer'), '###ENB_EXP###' => $piVars['expires']['act'] ? '' : 'disabled="disabled"', '###DAY###' => $piVars['expires']['act'] ? $piVars['expires']['day'] : 'DD', '###MONTH###' => $piVars['expires']['act'] ? $piVars['expires']['month'] : 'MM', '###YEAR###' => $piVars['expires']['act'] ? $piVars['expires']['year'] : 'YYYY', '###HOUR###' => $piVars['expires']['act'] ? $piVars['expires']['hour'] : 'HH', '###MINUTE###' => $piVars['expires']['act'] ? $piVars['expires']['minute'] : 'MM', '###EXPIRES###' => $piVars['expires']['act'] ? 'checked="checked"' : '', '###DELETEFIELDS###' => '', '###DISABLED###' => $this->getMayCreatePoll($pObj) ? '' : 'disabled="disabled"', '###DISABLED_VAR###' => $this->getMayCreatePoll($pObj) ? 0 : 1);
     $template = $pObj->cObj->substituteMarkerArrayCached($template, $marker);
     $answers = '';
     for ($i = 0; $i < $defACount; $i++) {
         $marker = array('###ANSWER###' => $pObj->escape($piVars ? $piVars['answer']['new'][$i] : ''), '###ANSWER_UID###' => '', '###ANSWER_MODE###' => 'new', '###DELETE###' => $pObj->pi_getLL('poll.deleteAnswer'), '###DISABLED###' => '');
         if ($i < $rDefACount) {
             $tAnswTmpl = $pObj->cObj->substituteSubpart($answerTemplate, '###DELLINK###', '');
         } else {
             $tAnswTmpl = $answerTemplate;
         }
         $answers .= $pObj->cObj->substituteMarkerArrayCached($tAnswTmpl, $marker);
     }
     $template = $pObj->cObj->substituteSubpart($template, '###ANSWERSECTION###', $answers);
     return $template;
 }
コード例 #5
0
 public function __construct()
 {
     $this->tx_mmforum_indexing = GeneralUtility::makeInstance('tx_mmforum_indexing');
     $this->tx_mmforum_pi1 = GeneralUtility::makeInstance('tx_mmforum_pi1');
     parent::__construct();
 }
コード例 #6
0
 public function __construct()
 {
     $this->tx_mmforum_pi1 = GeneralUtility::makeInstance('tx_mmforum_pi1');
     $this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     parent::__construct();
 }
コード例 #7
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();
        }
    }
コード例 #8
0
 /**
  * Constructor. takes the database handle from $GLOBALS['TYPO3_DB']
  */
 public function __construct()
 {
     // $this->tx_mmforum_postfunctions instanciated in main function to inject conf settings;
     $this->tx_mmforum_rss = GeneralUtility::makeInstance('tx_mmforum_rss');
     $this->tx_mmforum_havealook = GeneralUtility::makeInstance('tx_mmforum_havealook');
     $this->tx_mmforum_postalert = GeneralUtility::makeInstance('tx_mmforum_postalert');
     $this->tx_mmforum_postparser = GeneralUtility::makeInstance('tx_mmforum_postparser');
     $this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     parent::__construct();
 }
コード例 #9
0
 /**
  *
  * Wrapper for the pi_getLL method of the parent object. For convenience only.
  *
  * @param  String $key     The label key
  * @param  String $default Default value
  * @return String          The text
  */
 function l($key, $default = '')
 {
     $res = $this->p->pi_getLL('feadmin-' . $key, $key);
     return strlen($res) ? $res : ($default ? $default : 'feadmin-' . $key);
 }