render('err404', null, false); }); // Users // -------------------------------------------------------------------------------- get('/users', function () { if (!is_reviewer()) { render('err403', null, false); return; } $users = account_list(); uasort($users, 'account_group_cmp'); render('user_list', array('head_title' => 'Users', 'users' => $users)); }); // The url router wasn't matching "/users/:email" probably something to do with the @ and the dots in emails if (startsWith(request_uri(), '/users/') && strlen(trim(request_uri(), '/')) > 5) { $email = remove_first(request_uri(), '/users/'); if (!account_exists($email)) { render('err404', null, false); die; } if ($email !== user_email() && !is_reviewer()) { render('err403', null, false); die; } $data = account_data($email); $email = $data['email']; if (request_method() == 'GET') { render('user', array('head_title' => $data['email'], 'user' => $data, 'user_apps' => app_get_user($data['email'], valid_bool(from($_REQUEST, 'show-deleted'))), 'is_self' => user_email() == $email)); } else { if (request_method() == 'POST') { $action = from($_REQUEST, 'action');
function ltrim2($str, $cut) { return remove_first($str, $cut); }