예제 #1
0
 /**
  *
  * Displays the mm_forum help text. This text is displayed of no category
  * is selected.
  *
  * @author  Martin Helmich <*****@*****.**>
  * @version 2007-05-14
  * @return  string  The mm_forum help text
  *
  */
 function display_helpForm()
 {
     $template = file_get_contents(GeneralUtility::getFileAbsFileName('EXT:mm_forum/res/tmpl/mod1/install.html'));
     $template = tx_mmforum_BeTools::getSubpart($template, '###INSTALL_HELP###');
     $marker = array('###INST_HELP_TITLE###' => $this->getLL('help.title'), '###INST_HELP_TEXT###' => $this->getLL('help.content'));
     return tx_mmforum_BeTools::substituteMarkerArray($template, $marker);
 }
예제 #2
0
파일: index.php 프로젝트: rabe69/mm_forum
 /**
  *
  * Displays the user administration interface.
  * This includes a list of all registered users ordered descending by
  * username. The list includes the usergroups a user is member in and the
  * user's age. A search function is also included.
  *
  * @return string The HTML output.
  * @todo Outsource user management into own class!
  */
 function userManagement()
 {
     /* Get template */
     $template = file_get_contents(GeneralUtility::getFileAbsFileName('EXT:mm_forum/res/tmpl/mod1/users.html'));
     $template = tx_mmforum_BeTools::getSubpart($template, '###USERS_LIST###');
     $uTemplate = tx_mmforum_BeTools::getSubpart($template, '###USERS_LIST_ITEM###');
     // Retrieve global variables
     global $LANG, $BACK_PATH, $BE_USER;
     /** @var $LANG \TYPO3\CMS\Lang\LanguageService */
     // Generate SQL query
     $ug = $this->feGroups2Array();
     $mmforum = GeneralUtility::_GP('mmforum');
     if ($mmforum['no_filter']) {
         unset($mmforum['sword']);
         unset($mmforum['old_sword']);
     }
     if ($mmforum['old_sword'] && !$mmforum['sword']) {
         $mmforum['sword'] = $mmforum['old_sword'];
     }
     $gp = '';
     if ($mmforum['sword']) {
         $gp = '&mmforum[sword]=' . $mmforum['sword'];
     }
     $groups = implode(',', array(intval($this->confArr['userGroup']), intval($this->confArr['modGroup']), intval($this->confArr['adminGroup'])));
     if ($sword = $mmforum['sword']) {
         $sword = $this->databaseHandle->escapeStrForLike($sword, 'fe_users');
         $sword = $this->databaseHandle->fullQuoteStr($sword . '%', 'fe_users');
         $filter = 'username like ' . $sword;
     } else {
         $filter = '1';
     }
     // Determine sort order. The default is "ASC" order.
     switch (strtoupper(GeneralUtility::_GP('mmforum_style'))) {
         case 'DESC':
             $orderBy = 'DESC';
             break;
         case 'ASC':
         default:
             $orderBy = 'ASC';
             break;
     }
     if (GeneralUtility::_GP('mmforum_sort') == 'username') {
         $order = 'username ' . $orderBy . '';
         $uOrder = $orderBy == 'ASC' ? 'DESC' : 'ASC';
         $aOrder = 'ASC';
     } elseif (GeneralUtility::_GP('mmforum_sort') == 'age') {
         $order = 'crdate ' . $orderBy . '';
         $aOrder = $orderBy == 'ASC' ? 'DESC' : 'ASC';
         $uOrder = 'ASC';
     } else {
         $order = 'username ' . $orderBy . '';
         $aOrder = 'ASC';
         $uOrder = 'DESC';
     }
     #$userGroup_query = "(".$this->confArr['userGroup']." IN (usergroup) OR ".$this->confArr['modGroup']." IN (usergroup) OR ".$this->confArr['adminGroup']." IN (usergroup))";
     $userGroup_query = "(FIND_IN_SET('" . $this->confArr['userGroup'] . "',usergroup) OR FIND_IN_SET('" . $this->confArr['modGroup'] . "',usergroup) OR FIND_IN_SET('" . $this->confArr['adminGroup'] . "',usergroup))";
     #$userGroup_query = "1";
     $res = $this->databaseHandle->exec_SELECTquery('count(*)', 'fe_users', "{$filter} and pid='" . $this->confArr['userPID'] . "' and " . $userGroup_query . " and deleted=0");
     $row = $this->databaseHandle->sql_fetch_row($res);
     $records = $row[0];
     $pages = ceil($records / $this->confArr['recordsPerPage']);
     $offset = intval($mmforum['offset']);
     // Page navigation
     $pb = $LANG->getLL('page.page') . ' <a href="index.php?mmforum[offset]=0' . $gp . '">[' . $LANG->getLL('page.first') . ']</a> ';
     $end = $offset + 6 >= $pages ? $pages : $offset + 6;
     $start = $offset - 5;
     if ($start < 0) {
         $start = 0;
     }
     if ($start > 0) {
         $pb .= '... ';
     }
     for ($i = $start; $i < $end; $i++) {
         $pb .= '<a href="index.php?mmforum[offset]=' . $i . $gp . '">' . ($i == $offset ? '<b>' . ($i + 1) . '</b>' : $i + 1) . '</a> ';
     }
     if ($offset + 11 < $pages) {
         $pb .= ' ... <a href="index.php?mmforum[offset]=' . ($pages - 1) . $gp . '">[' . $LANG->getLL('page.last') . ']</a> ';
     }
     // Generate header table
     if ($records < $this->confArr['recordsPerPage']) {
         $mDisp = $records;
     } else {
         $mDisp = $offset * $this->confArr['recordsPerPage'] + $this->confArr['recordsPerPage'];
     }
     $userString = sprintf($LANG->getLL('useradmin.usercount'), $offset * $this->confArr['recordsPerPage'] + 1, $mDisp, $records);
     $out = '<table width="733"><tr>';
     $out .= '<td width="420">' . $pb . '</td>';
     $out .= '<td width="120" align="center"><b>' . $userString . '</b></td>';
     $out .= '<td align="right">' . $LANG->getLL('useradmin.searchfor') . ': <input type="text" id="sword" size="20" name="mmforum[sword]" /></td>';
     $out .= '</tr></table>';
     if ($mmforum['sword'] || $mmforum['old_sword']) {
         $out .= '<p>' . $LANG->getLL('useradmin.filter') . ': ' . $mmforum['sword'] . '* <a href="index.php?mmforum[no_filter]=1&' . $this->linkParams($mmforum) . '">' . $LANG->getLL('useradmin.filter.clear') . '</a></p>';
         $out .= '<input type="hidden" name="mmforum[old_sword]" value="' . $mmforum['sword'] . '" />';
     }
     // Display userdata table
     // Execute database query
     $res = $this->databaseHandle->exec_SELECTquery('*', 'fe_users', "{$filter} and pid='" . $this->confArr['userPID'] . "' and deleted=0 AND " . $userGroup_query, '', $order, $offset * $this->confArr['recordsPerPage'] . "," . $this->confArr['recordsPerPage']);
     if ($res) {
         $marker = array('###USERS_LLL_TITLE###' => $LANG->getLL('users.title'), '###USERS_LLL_USERNAME###' => '<a href="index.php?mmforum_sort=username&mmforum_style=' . $uOrder . '">' . $LANG->getLL('useradmin.username') . '</a>', '###USERS_LLL_REGISTERED###' => '<a href="index.php?mmforum_sort=age&mmforum_style=' . $aOrder . '">' . $LANG->getLL('useradmin.age') . '</a>', '###USERS_LLL_GROUPS###' => $LANG->getLL('useradmin.usergroup'), '###USERS_LLL_OPTIONS###' => '&nbsp;');
         $i = 0;
         $uContent = '';
         while ($row = $this->databaseHandle->sql_fetch_assoc($res)) {
             // Display user groups
             $g = explode(',', $row['usergroup']);
             $outg = '';
             foreach ($g as $sg) {
                 $outg .= $ug[$sg] . ', ';
             }
             $iconAltText = BackendUtility::getRecordIconAltText($row, $table);
             $elementTitle = BackendUtility::getRecordPath($row['uid'], '1=1', 0);
             $elementTitle = GeneralUtility::fixed_lgd_cs($elementTitle, -$BE_USER->uc['titleLen']);
             $elementIcon = IconUtility::getIconImage($table, $row, $BACK_PATH, 'class="c-recicon" title="' . $iconAltText . '"');
             $params = '&edit[fe_users][' . $row['uid'] . ']=edit';
             $editOnClick = BackendUtility::editOnClick($params, $BACK_PATH);
             // Generate row item
             $class_suffix = $i++ % 2 == 0 ? '2' : '';
             $link = "index.php?mmforum[cid]=" . $row['uid'];
             $js = 'onmouseover="this.className=\'mm_forum-listrow_active\'; this.style.cursor=\'pointer\';" onmouseout="this.className=\'mm_forum-listrow' . $class_suffix . '\'" onclick="' . htmlspecialchars($editOnClick) . '"';
             $icon = '<img src="../icon_tx_mmforum_forums.gif" />';
             $hidden = $row['hidden'] == 1 ? '<span style="color:blue;">[' . $LANG->getLL('boardadmin.hidden') . ']</span> ' : '';
             $uMarker = array('###USER_USERNAME###' => htmlspecialchars($row['username']), '###USER_REGISTERED###' => BackendUtility::dateTimeAge($row['crdate'], 1), '###USER_GROUPS###' => substr($outg, -2) == ', ' ? substr($outg, 0, strlen($outg) - 2) : $outg, '###USER_OPTIONS###' => '<img src="img/edit.png" onclick="' . htmlspecialchars($editOnClick) . '" style="cursor:pointer;" />');
             $uContent .= tx_mmforum_BeTools::substituteMarkerArray($uTemplate, $uMarker);
         }
         $template = tx_mmforum_BeTools::substituteSubpart($template, '###USERS_LIST_ITEM###', $uContent);
         $template = tx_mmforum_BeTools::substituteMarkerArray($template, $marker);
         $out .= $template;
     }
     return $out;
 }
 /**
  * Displays a list of all user defined fields.
  *
  * @author  Martin Helmich <*****@*****.**>
  * @version 2009-02-14
  * @return  string A list of all user defined fields.
  */
 function displayFieldTable()
 {
     $this->saveData();
     $template = file_get_contents(GeneralUtility::getFileAbsFileName('EXT:mm_forum/res/tmpl/mod1/userfields.html'));
     $template = tx_mmforum_BeTools::getSubpart($template, '###USERFIELD_LIST###');
     $iTemplate = tx_mmforum_BeTools::getSubpart($template, '###USERFIELD_LIST_ITEM###');
     $marker = array('###UF_LLL_TITLE###' => $this->getLL('list.title'), '###UF_LLL_HEAD_NAME###' => $this->getLL('field.name'), '###UF_LLL_HEAD_EDIT###' => $this->getLL('field.options'), '###UF_LLL_HEAD_TYPE###' => $this->getLL('field.type'), '###UF_LLL_NEW###' => $this->getLL('list.new'), '###UF_LLL_HELP###' => $this->getLL('list.help'), '###UF_LINK_NEW###' => $this->generateLink('&tx_mmforum_userfields[edit]=-1', 1));
     $template = tx_mmforum_BeTools::substituteMarkerArray($template, $marker);
     $res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_userfields', 'deleted=0', '', 'sorting DESC');
     $i = 0;
     $max = $this->databaseHandle->sql_num_rows($res);
     $iContent = '';
     while ($arr = $this->databaseHandle->sql_fetch_assoc($res)) {
         $meta = unserialize($arr['meta']);
         $upButton = $i > 0 ? $this->generateLink('&tx_mmforum_userfields[moveUp]=' . $arr['uid']) . '<img src="img/move-up.png" /></a>' : '<img src="../../../../typo3/clear.gif" width="24" height="24" />';
         $downButton = $i < $max - 1 ? $this->generateLink('&tx_mmforum_userfields[moveDown]=' . $arr['uid']) . '<img src="img/move-down.png" /></a>' : '<img src="../../../../typo3/clear.gif" width="24" height="24" />';
         $delButton = $this->generateLink('&tx_mmforum_userfields[field][' . $arr['uid'] . '][delete]=1') . '<img src="img/edit-delete.png" /></a>';
         $extButton = $this->generateLink('&tx_mmforum_userfields[edit]=' . $arr['uid']) . '<img src="img/edit.png" /></a>';
         $iMarker = array('###UF_NAME###' => htmlspecialchars($arr['label']), '###UF_TYPE###' => $this->getLL('field.type.' . $meta['type']), '###UF_EDIT###' => $extButton . $delButton . $upButton . $downButton);
         $iContent .= tx_mmforum_BeTools::substituteMarkerArray($iTemplate, $iMarker);
         $i++;
     }
     return tx_mmforum_BeTools::substituteSubpart($template, '###USERFIELD_LIST_ITEM###', $iContent);
 }