Beispiel #1
0
function handle_list()
{
    page_head("Job submission access control");
    echo "The following users are allowed to submit jobs.\n        <p>\n    ";
    $us = BoincUserSubmit::enum("");
    start_table();
    table_header("User<br><p class=\"text-muted\">Click to change permissions or quota</p>", "Can submit jobs for", "Quota", "Max jobs in progress<br><p class=\"text-muted\">0 means no limit</p>", "Current priority<br><p class=\"text-muted\">Later time = lower priority</p>");
    foreach ($us as $u) {
        user_row($u);
    }
    end_table();
    show_button("manage_project.php?action=add_form", "Add user", "Allow a new user to submit jobs");
    page_tail();
}
function handle_list()
{
    page_head("Project-wide management functions");
    echo "<h3>User permissions and quotas</h3>\n        The following users are allowed to submit jobs.\n        <p>\n    ";
    show_button("manage_project.php?action=add_form", "Add user", "Allow a new user to submit jobs");
    $us = BoincUserSubmit::enum("");
    start_table();
    table_header("User", "Can submit jobs for", "Quota");
    foreach ($us as $u) {
        user_row($u);
    }
    end_table();
    page_tail();
}
                ?>
</th>
	<th colspan="2" style="text-align: center"><?php 
                _e('Actions');
                ?>
</th>
</tr>
</tbody>
<tbody id="role-<?php 
                echo $role;
                ?>
"><?php 
                $style = '';
                foreach ((array) $roleclass as $user_object) {
                    $style = ' class="alternate"' == $style ? '' : ' class="alternate"';
                    echo "\n\t" . user_row($user_object, $style);
                }
                ?>

</tbody>
<?php 
            }
            ?>
</table>

<?php 
            if ($wp_user_search->results_are_paged()) {
                ?>
	<div class="user-paging-text"><p><?php 
                $wp_user_search->page_links();
                ?>
Beispiel #4
0
</tr>
</tfoot>

<tbody id="users" class="list:user user-list">
<?php 
            $style = '';
            foreach ($wp_user_search->get_results() as $userid) {
                $user_object = new WP_User($userid);
                $roles = $user_object->roles;
                $role = array_shift($roles);
                $wallet = $user_object->wallet;
                if (is_multisite() && empty($role)) {
                    continue;
                }
                $style = ' class="alternate"' == $style ? '' : ' class="alternate"';
                echo "\n\t", user_row($user_object, $style, $role, $wallet);
            }
            ?>
</tbody>
</table>

<div class="tablenav">

<?php 
            if ($wp_user_search->results_are_paged()) {
                ?>
	<div class="tablenav-pages"><?php 
                $wp_user_search->page_links();
                ?>
</div>
<?php 
Beispiel #5
0
     $x->send();
     break;
 case 'add-user':
     check_ajax_referer($action);
     if (!current_user_can('create_users')) {
         die('-1');
     }
     require_once ABSPATH . WPINC . '/registration.php';
     if (!($user_id = add_user())) {
         die('0');
     } elseif (is_wp_error($user_id)) {
         $x = new WP_Ajax_Response(array('what' => 'user', 'id' => $user_id));
         $x->send();
     }
     $user_object = new WP_User($user_id);
     $x = new WP_Ajax_Response(array('what' => 'user', 'id' => $user_id, 'data' => user_row($user_object, '', $user_object->roles[0]), 'supplemental' => array('show-link' => sprintf(__('User <a href="#%s">%s</a> added'), "user-{$user_id}", $user_object->user_login), 'role' => $user_object->roles[0])));
     $x->send();
     break;
 case 'autosave':
     // The name of this action is hardcoded in edit_post()
     define('DOING_AUTOSAVE', true);
     $nonce_age = check_ajax_referer('autosave', 'autosavenonce');
     global $current_user;
     $_POST['post_category'] = explode(",", $_POST['catslist']);
     if ($_POST['post_type'] == 'page' || empty($_POST['post_category'])) {
         unset($_POST['post_category']);
     }
     $do_autosave = (bool) $_POST['autosave'];
     $do_lock = true;
     $data = '';
     /* translators: draft saved date format, see http://php.net/date */
case 'add-user' :
	if ( !current_user_can('edit_users') )
		die('-1');
	require_once(ABSPATH . WPINC . '/registration.php');
	if ( !$user_id = add_user() )
		die('0');
	elseif ( is_wp_error( $user_id ) ) {
		foreach( $user_id->get_error_messages() as $message )
			echo "<p>$message<p>";
		exit;
	}
	$user_object = new WP_User( $user_id );
	$x = new WP_Ajax_Response( array(
		'what' => 'user',
		'id' => $user_id,
		'data' => user_row( $user_object ),
		'supplemental' => array('show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login))
	) );
	$x->send();
	break;
case 'autosave' : // The name of this action is hardcoded in edit_post()
	$_POST['post_content'] = $_POST['content'];
	$_POST['post_excerpt'] = $_POST['excerpt'];
	$_POST['post_status'] = 'draft';
	$_POST['post_category'] = explode(",", $_POST['catslist']);
	if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
		unset($_POST['post_category']);

	if($_POST['post_ID'] < 0) {
		$_POST['temp_ID'] = $_POST['post_ID'];
		$id = wp_write_post();
Beispiel #7
0
	require_once(ABSPATH . WPINC . '/registration.php');
	if ( !$user_id = add_user() )
		die('0');
	elseif ( is_wp_error( $user_id ) ) {
		$x = new WP_Ajax_Response( array(
			'what' => 'user',
			'id' => $user_id
		) );
		$x->send();
	}
	$user_object = new WP_User( $user_id );

	$x = new WP_Ajax_Response( array(
		'what' => 'user',
		'id' => $user_id,
		'data' => user_row( $user_object, '', $user_object->roles[0] ),
		'supplemental' => array(
			'show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login),
			'role' => $user_object->roles[0]
		)
	) );
	$x->send();
	break;
case 'autosave' : // The name of this action is hardcoded in edit_post()
	define( 'DOING_AUTOSAVE', true );

	$nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' );

	$_POST['post_category'] = explode(",", $_POST['catslist']);
	if ( $_POST['post_type'] == 'page' || empty($_POST['post_category']) )
		unset($_POST['post_category']);
Beispiel #8
0
            ?>
</tr>
</tfoot>

<tbody id="users" class="list:user user-list">
<?php 
            $style = '';
            foreach ($wp_user_search->get_results() as $userid) {
                $user_object = new WP_User($userid);
                $roles = $user_object->roles;
                $role = array_shift($roles);
                if (is_multisite() && empty($role)) {
                    continue;
                }
                $style = ' class="alternate"' == $style ? '' : ' class="alternate"';
                echo "\n\t", user_row($user_object, $style, $role, $post_counts[$userid]);
            }
            ?>
</tbody>
</table>

<div class="tablenav">

<?php 
            if ($wp_user_search->results_are_paged()) {
                ?>
	<div class="tablenav-pages"><?php 
                $wp_user_search->page_links();
                ?>
</div>
<?php 
Beispiel #9
0
$users = db_fetch_all('SELECT * FROM ' . KFM_DB_PREFIX . 'users WHERE id>1');
if (!is_array($users)) {
    die('error retrieving user list');
}
$lhtml = '<table id="kfm_admin_users_table">
<thead>
	<tr>
		<th>Name</th>
		<th></th>
		<th>Status</th>
	</tr>
</thead>
<tbody>
';
foreach ($users as $user) {
    $lhtml .= user_row($user['id'], $user['username'], $user['status']);
}
$lhtml .= "</tbody>\n</table>\n";
if (count($users) == 0) {
    $lhtml = '<span class="message">No users found</span>';
}
?>
<script type="text/javascript">
/* User functions */
function new_user(){
	input_props='size=12 maxsize=16';
	fc='<h3>New user</h3>';
	fc+='Username <input type="text" id="newuser_username" '+input_props+'/><br/>';
	fc+='Password <input type="password" id="newuser_password" '+input_props+'/>';
	$.prompt(fc,{
		buttons:{cancel:false, OK:true},
Beispiel #10
0
<?php

require_once 'initialise.php';
require_once 'functions.php';
if ($kfm->user_status != 1) {
    die('error("No authorization aquired")');
}
if (!(isset($_POST['username']) && isset($_POST['password']))) {
    die('error("error with new user request");');
}
$res = db_fetch_all('SELECT id FROM ' . KFM_DB_PREFIX . 'users WHERE username="******"');
if ($res && count($res)) {
    die('error("Name already exists.");');
}
$kfm->db->query('INSERT INTO ' . KFM_DB_PREFIX . 'users (username, password,status) VALUES ("' . sql_escape($_POST['username']) . '", "' . sha1($_POST['password']) . '", 2)');
if (PEAR::isError($kfmdb)) {
    die('error("error with database interactions");');
}
$uhtml = user_row($kfm->db->lastInsertId(), $_POST['username'], 2);
$uhtml = preg_replace('/\\n/', '', $uhtml);
$uhtml = str_replace("'", "\\'", $uhtml);
echo '$("#kfm_admin_users_table tbody").append(\'' . $uhtml . '\');';
?>
message('user created');