Exemplo n.º 1
0
/**
 * wp.getAuthors
 *
 * @see http://codex.wordpress.org/XML-RPC_wp#wp.getAuthors
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 blogid (int): Unique identifier of the blog.
 *					1 username (string): User login.
 *					2 password (string): Password for said username.
 */
function wp_getauthors($m)
{
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET BLOG:
    /**
     * @var Blog
     */
    if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    if (!$current_User->check_perm('users', 'view')) {
        return xmlrpcs_resperror(5, T_('You have no permission to view other users!'));
    }
    load_class('users/model/_userlist.class.php', 'UserList');
    $UserList = new UserList('', NULL, 'u_', array('join_group' => false, 'join_session' => false, 'join_country' => false, 'join_city' => false));
    // Run the query:
    $UserList->query();
    logIO('Found users: ' . $UserList->result_num_rows);
    $data = array();
    while ($User =& $UserList->get_next()) {
        $data[] = new xmlrpcval(array('user_id' => new xmlrpcval($User->ID, 'int'), 'user_login' => new xmlrpcval($User->login), 'display_name' => new xmlrpcval($User->get_preferred_name())), 'struct');
    }
    logIO('OK.');
    return new xmlrpcresp(new xmlrpcval($data, 'array'));
}
Exemplo n.º 2
0
     _set_setting_by_path($edit_Plugin, 'UserSettings', $set_path, array());
     $edit_Plugin->Settings->dbupdate();
     $action = 'edit';
     break;
 case 'search':
     // Quick search
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('user');
     param('user_search', 'string', '');
     set_param('keywords', $user_search);
     set_param('filter', 'new');
     load_class('users/model/_userlist.class.php', 'UserList');
     $UserList = new UserList('admin', $UserSettings->get('results_per_page'), 'users_', array('join_city' => false));
     $UserList->load_from_Request();
     // Make query to get a count of users
     $UserList->query();
     if ($UserList->get_total_rows() == 1) {
         // If we find only one user by quick search we do a redirect to user's edit page
         $User = $UserList->rows[0];
         if (!empty($User)) {
             header_redirect('?ctrl=user&user_tab=profile&user_ID=' . $User->user_ID);
         }
     }
     // Unset the filter to avoid the step 1 in the function $UserList->query() on the users list
     set_param('filter', '');
     break;
 case 'remove_sender_customization':
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('users');
     // Check required permission
     $current_User->check_perm('users', 'edit', true);
Exemplo n.º 3
0
 function getLists()
 {
     require_once ROOT_DIR . '/sys/LocalEnrichment/UserList.php';
     $lists = array();
     $sql = "SELECT user_list.* FROM user_list " . "WHERE user_list.user_id = '{$this->id}' " . "ORDER BY user_list.title";
     $list = new UserList();
     $list->query($sql);
     if ($list->N) {
         while ($list->fetch()) {
             $lists[] = clone $list;
         }
     }
     return $lists;
 }