示例#1
0
文件: user.php 项目: nosch/phpMyFAQ
    print $PMF_LANG['msgNewContentName'];
    ?>
</th>
            <th><?php 
    print $PMF_LANG['msgNewContentMail'];
    ?>
</th>
            <th><?php 
    print $PMF_LANG['ad_entry_action'];
    ?>
</th>
        </tr>
    </thead>
        <tbody>
        <?php 
    foreach ($user->getAllUsers() as $userId) {
        $user->getUserById($userId);
        ?>
            <tr>
                <td><?php 
        print $user->getUserData('user_id');
        ?>
</td>
                <td><?php 
        print $user->getUserData('display_name');
        ?>
</td>
                <td><?php 
        print $user->getUserData('email');
        ?>
</td>
示例#2
0
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 */
if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$ajax_action = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING);
$group_id = PMF_Filter::filterInput(INPUT_GET, 'group_id', FILTER_VALIDATE_INT);
if ($permission['adduser'] || $permission['edituser'] || $permission['deluser']) {
    $user = new PMF_User();
    $userList = $user->getAllUsers();
    $groupList = $user->perm instanceof PMF_Perm_PermMedium ? $user->perm->getAllGroups() : array();
    // Returns all groups
    if ('get_all_groups' == $ajax_action) {
        $groups = array();
        foreach ($groupList as $group_id) {
            $data = $user->perm->getGroupData($group_id);
            $groups[] = array('group_id' => $data['group_id'], 'name' => $data['name']);
        }
        print json_encode($groups);
    }
    // Return the group data
    if ('get_group_data' == $ajax_action) {
        print json_encode($user->perm->getGroupData($group_id));
    }
    // Return the group rights
示例#3
0
 if ($userAction == 'add' && $user->perm->checkRight($user->getUserId(), 'adduser')) {
     $twig->loadTemplate('user/add.twig')->display(array('PMF_LANG' => $PMF_LANG, 'csrfToken' => $user->getCsrfTokenFromSession(), 'userEmail' => isset($user_email) ? $user_email : '', 'userName' => isset($user_name) ? $user_name : '', 'userPassword' => isset($user_password) ? $user_password : '', 'userPasswordConfirm' => isset($user_password_confirm) ? $user_password_confirm : '', 'userRealName' => isset($user_realname) ? $user_realname : ''));
 }
 // show list of users
 if ($userAction == 'list') {
     $templateVars = array('PMF_LANG' => $PMF_LANG, 'message' => $message, 'renderUpdateUserScript' => false, 'rights' => $user->perm->getAllRightsData(), 'showListAllUsers' => $permission['edituser']);
     if (isset($_GET['user_id'])) {
         $templateVars['renderUpdateUserScript'] = true;
         $templateVars['updateUserId'] = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT, 0);
     }
     $twig->loadTemplate('user/list.twig')->display($templateVars);
 }
 // show list of all users
 if ($userAction == 'listallusers' && $user->perm->checkRight($user->getUserId(), 'edituser')) {
     $templateVars = array('PMF_LANG' => $PMF_LANG, 'displayPagination' => false, 'message' => $message, 'users' => array());
     $allUsers = $user->getAllUsers();
     $numUsers = count($allUsers);
     $page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 0);
     $perPage = 10;
     $numPages = ceil($numUsers / $perPage);
     $lastPage = $page * $perPage;
     $firstPage = $lastPage - $perPage;
     $baseUrl = sprintf('%s?action=user&amp;user_action=listallusers&amp;page=%d', PMF_Link::getSystemRelativeUri(), $page);
     if ($perPage < $numUsers) {
         // Pagination options
         $options = array('baseUrl' => $baseUrl, 'total' => $numUsers, 'perPage' => $perPage, 'pageParamName' => 'page');
         $pagination = new PMF_Pagination($faqConfig, $options);
         $templateVars['displayPagination'] = true;
         $templateVars['pagination'] = $pagination->render();
     }
     $counter = $displayedCounter = 0;