示例#1
0
<p><?php 
        _e('Below, you can see the names of the authors of the MovableType posts in <i>italics</i>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.');
        ?>
</p>
<p><?php 
        _e('If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)');
        ?>
</p>
	<?php 
        echo '<ol id="authors">';
        echo '<form action="?step=2" method="post">';
        $j = -1;
        foreach ($authors as $author) {
            ++$j;
            echo '<li><i>' . $author . '</i><br />' . '<input type="text" value="' . $author . '" name="' . 'user[]' . '" maxlength="30">';
            users_form($j);
            echo '</li>';
        }
        echo '<input type="submit" value="Submit">' . '<br/>';
        echo '</form>';
        echo '</ol>';
        flush();
        break;
    case 2:
        $newauthornames = array();
        $formnames = array();
        $selectnames = array();
        $mtnames = array();
        foreach ($_POST['user'] as $key => $line) {
            $newname = trim(stripslashes($line));
            if ($newname == '') {
    exit;
}
if (isset($_GET["display-synthesis"])) {
    synthesis();
    exit;
}
if (isset($_GET["visited"])) {
    visited();
    exit;
}
if (isset($_GET["websites-search"])) {
    visited_search();
    exit;
}
if (isset($_GET["users-form"])) {
    users_form();
    exit;
}
if (isset($_GET["users-search"])) {
    users_search();
    exit;
}
if (isset($_GET["paragraphe1"])) {
    paragraphe1();
    exit;
}
if (isset($_GET["paragraphe1-day-graph"])) {
    paragraphe1_day_graph();
    exit;
}
if (isset($_GET["paragraphe2"])) {
示例#3
0
function run()
{
    global $user;
    global $layout;
    global $DB;
    $out = '';
    $item = new user();
    switch ($_REQUEST['act']) {
        case 1:
            // json data retrieval & operations
            switch ($_REQUEST['oper']) {
                case 'del':
                    // remove rows
                    $ids = $_REQUEST['ids'];
                    $deleted = 0;
                    foreach ($ids as $id) {
                        $item = new user();
                        $item->load($id);
                        $deleted = $deleted + $item->delete();
                    }
                    echo json_encode(count($ids) == $deleted);
                    break;
                default:
                    // list or search
                    $page = intval($_REQUEST['page']);
                    $max = intval($_REQUEST['rows']);
                    $offset = ($page - 1) * $max;
                    $orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
                    $where = " 1=1 ";
                    if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
                        if (isset($_REQUEST['quicksearch'])) {
                            $where .= $item->quicksearch($_REQUEST['quicksearch']);
                        } else {
                            if (isset($_REQUEST['filters'])) {
                                $where .= navitable::jqgridsearch($_REQUEST['filters']);
                            } else {
                                // single search
                                $where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
                            }
                        }
                    }
                    $DB->queryLimit('id,username,email,profile,language,blocked', 'nv_users', $where, $orderby, $offset, $max);
                    $dataset = $DB->result();
                    $total = $DB->foundRows();
                    //echo $DB->get_last_error();
                    $out = array();
                    $profiles = profile::profile_names();
                    $languages = language::language_names();
                    for ($i = 0; $i < count($dataset); $i++) {
                        $out[$i] = array(0 => $dataset[$i]['id'], 1 => '<strong>' . $dataset[$i]['username'] . '</strong>', 2 => $dataset[$i]['email'], 3 => $profiles[$dataset[$i]['profile']], 4 => $languages[$dataset[$i]['language']], 5 => $dataset[$i]['blocked'] == 1 ? '<img src="img/icons/silk/cancel.png" />' : '');
                    }
                    navitable::jqgridJson($out, $page, $offset, $max, $total);
                    break;
            }
            session_write_close();
            exit;
            break;
        case 2:
            // edit/new form
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
            }
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    permission::update_permissions(json_decode($_REQUEST['navigate_permissions_changes'], true), 0, $item->id);
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
            }
            $out = users_form($item);
            break;
        case 4:
            // remove
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
                if ($item->delete() > 0) {
                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
                    $out = users_list();
                } else {
                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
                    $out = users_form($item);
                }
            }
            break;
        case 0:
            // list / search result
        // list / search result
        default:
            $out = users_list();
            break;
    }
    return $out;
}