- Timestamp:
- 07/10/08 12:35:19 (5 years ago)
- Location:
- events/phpframework/plain_php/trunk
- Files:
-
- 1 added
- 2 modified
-
AcountService.php (modified) (3 diffs)
-
FriendshipService.php (modified) (6 diffs)
-
TimelineService.php (added)
Legend:
- Unmodified
- Added
- Removed
-
events/phpframework/plain_php/trunk/AcountService.php
r15538 r15604 13 13 $password = sha1($password); 14 14 15 $smt = $this->pdo->prepare('insert into users(user_name, email, password, created_at, updated_at) values(:username, :email, :password, now(), now())'); 15 $smt = $this->pdo->prepare( 16 'insert into users(user_name, email, password, created_at, updated_at) ' . 17 'values(:username, :email, :password, now(), now())'); 16 18 $smt->bindValue(':username', $username, PDO::PARAM_STR); 17 19 $smt->bindValue(':email', $email, PDO::PARAM_STR); … … 25 27 26 28 $smt = $this->pdo->prepare( 27 'update users set email = :email, password = :password, private_flag = :private_flag, delete_flag = :delete_flag, updated_at = now() where user_name = :username '); 29 'update users set email = :email, password = :password, ' . 30 'private_flag = :private_flag, delete_flag = :delete_flag, ' . 31 'updated_at = now() where user_name = :username '); 28 32 $smt->bindValue(':username', $username, PDO::PARAM_STR); 29 33 $smt->bindValue(':email', $email, PDO::PARAM_STR); … … 35 39 function updateImage($username, $image) 36 40 { 37 $smt = $this->pdo->prepare('update users set image = :image where user_name = :username'); 41 $smt = $this->pdo->prepare( 42 'update users set image = :image where user_name = :username'); 38 43 $smt->bindValue(':username', $username, PDO::PARAM_STR); 39 44 if (is_null($image)) { -
events/phpframework/plain_php/trunk/FriendshipService.php
r15538 r15604 13 13 14 14 $smt = $this->pdo->prepare( 15 'select users.* from users, followers where :user_id = followers.follow_id and followers.user_id = users.id limit :offset, :limit'); 15 'select users.* from users, followers where :user_id = ' . 16 'followers.follow_id and followers.user_id = users.id ' . 17 'limit :offset, :limit'); 16 18 $smt->bindValue(':user_id', $user_id, PDO::PARAM_INT); 17 19 $smt->bindValue(':offset', $offset, PDO::PARAM_INT); … … 23 25 function fetchFollowerCount($user_id) 24 26 { 25 $smt = $this->pdo->prepare('select count(users.id) from users, followers where :user_id = followers.follow_id and followers.user_id = users.id'); 27 $smt = $this->pdo->prepare( 28 'select count(users.id) from users, followers where ' . 29 ':user_id = followers.follow_id and followers.user_id = users.id'); 26 30 $smt->bindValue(':user_id', $user_id, PDO::PARAM_INT); 27 31 $smt->execute(); … … 35 39 $count = $this->fetchFollowerCount($user_id); 36 40 37 $smt = $this->pdo->prepare('select users.* from users, followers where :user_id = followers.user_id and followers.follow_id = users.id limit :offset, :limit'); 41 $smt = $this->pdo->prepare( 42 'select users.* from users, followers where :user_id = followers.user_id ' . 43 'and followers.follow_id = users.id limit :offset, :limit'); 38 44 $smt->bindValue(':user_id', $user_id, PDO::PARAM_STR); 39 45 $smt->bindValue(':offset', $offset, PDO::PARAM_INT); … … 45 51 function fetchFollowingCount($user_id) 46 52 { 47 $smt = $this->pdo->prepare('select count(users.id) from users, followers where :user_id = followers.user_id and followers.follow_id = users.id'); 53 $smt = $this->pdo->prepare( 54 'select count(users.id) from users, followers where ' . 55 ':user_id = followers.user_id and followers.follow_id = users.id'); 48 56 $smt->bindValue(':user_id', $user_id, PDO::PARAM_INT); 49 57 $smt->execute(); … … 54 62 function follow($user_id, $follow_user_name) 55 63 { 56 $smt = $this->pdo->prepare('insert into followers(user_id, follow_id, created_at) values(:user_id, (select id from users where user_name = :follow_user_name), now())'); 64 $smt = $this->pdo->prepare( 65 'insert into followers(user_id, follow_id, created_at) ' . 66 'values(:user_id, (select id from users where user_name = ' . 67 ':follow_user_name), now())'); 57 68 $smt->bindValue(':user_id', $user_id, PDO::PARAM_INT); 58 69 $smt->bindValue(':follow_user_name', $follow_user_name, PDO::PARAM_STR); … … 62 73 function unfollow($user_id, $follow_user_name) 63 74 { 64 $smt = $this->pdo->prepare('delete from followers where user_id = :user_id and follow_id = (select id from users where user_name = :follow_user_name)'); 75 $smt = $this->pdo->prepare( 76 'delete from followers where user_id = :user_id and ' . 77 'follow_id = (select id from users where user_name = :follow_user_name)'); 65 78 $smt->bindValue(':user_id', $user_id, PDO::PARAM_INT); 66 79 $smt->bindValue(':follow_user_name', $follow_user_name, PDO::PARAM_STR);
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)