/**
  * @test
  */
 public function it_returns_null_when_a_parse_exception_occurs_when_searching_by_username()
 {
     $username = '******';
     $query = new \CultureFeed_SearchUsersQuery();
     $query->nick = $username;
     $this->cultureFeed->expects($this->once())->method('searchUsers')->with($query)->willThrowException(new \CultureFeed_ParseException('error'));
     $user = $this->service->getUserByUsername($username);
     $this->assertNull($user);
 }
示例#2
0
<?php

require_once "forAllPages.php";
require_once 'services/user.service.php';
require_once 'services/goods.service.php';
$userService = new UserService();
$goodsService = new GoodsService();
var_dump($userService->getUserByUsername('nimitae'));
示例#3
0
<?php

require_once "forAllPages.php";
require_once "services/user.service.php";
if (!isset($_SESSION['username'])) {
    header('Location: login.php');
}
$userService = new UserService();
$currentUser = $userService->getUserByUsername($_SESSION['username']);
//var_dump($currentUser);
include "partials/header.partial.php";
?>
<div style="height: 40px"></div>
<h1 style="margin-left: 30px"><img src="images/wrench77.png" style="display: inline-block"> Settings</h1>
<div style="height: 20px"></div>
<div class="container" style="background-color: white; width:50%; padding:15px; float: left; margin-left: 40px">
    <form class="form-horizontal contactRows">
        Leave any text box blank if you do not wish to display those details on your profile page.
        <div style="height: 30px"></div>
        <div class="form-group">
            <label for="Email" class="col-sm-3 control-label">Email</label>

            <div class="inline-block col-sm-6">
                <input name="email" class="form-control" type="text" id="Email" placeholder="Email" value="<?php 
sizeof($currentUser->contactContainer[1]) > 0 ? print $currentUser->contactContainer[1][0]->value : (print "");
?>
">
            </div>
        </div>

        <div class="form-group">
     setcookie("pwd");
     header("Location: ./login.php");
     break;
 case 'pwd_change_get':
     require_once './user_view_pwd_change.php';
     break;
 case 'pwd_change_post':
     require_once 'class/user.class.php';
     require_once 'class/user_service.class.php';
     $username = trim($_POST['username']);
     $pwd = md5(trim($_POST['pwd']));
     $user = new User(null, null, null, null, $username, $pwd, null, null, null, null);
     $user_service = new UserService();
     $rs = $user_service->validateUser($user);
     if ($rs) {
         $user = $user_service->getUserByUsername($username);
         $user->pwd = md5($_POST["new_pwd"]);
         print_r($user);
         $user_service->updateUser($user);
         $_SESSION['operation'] = true;
         $_SESSION['operation_msg'] = "修改密码:" . $username . "成功";
         $log_service->addLog("update", "用户修改密码", $id);
         header("Location: ./index.php?mod=home");
     } else {
         $_SESSION['operation'] = false;
         $_SESSION['operation_msg'] = "密码错误,请重新输入";
         header("Location: index.php?mod=user&action=pwd_change_get");
     }
     break;
 default:
     break;
示例#5
0
<?php

require_once "forAllPages.php";
require_once "services/user.service.php";
require_once "services/goods.service.php";
$userService = new UserService();
$goodsService = new GoodsService();
$goodsContainer = $goodsService->getAllGoods();
$userFound = false;
if (isset($_GET['u'])) {
    $browsedUser = $userService->getUserByUsername($_GET['u']);
    if ($browsedUser) {
        $userFound = true;
    } else {
        $userFound = false;
    }
}
if ($userFound) {
    include "views/profile.view.php";
} else {
    include "views/profilesearch.view.php";
}