Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
/**************************************************************************
3
*   Copyright (C) 2009-2011 by Geo Varghese(www.seopanel.in)  	          *
4
*   sendtogeo@gmail.com   											      *
5
*                                                                         *
6
*   This program is free software; you can redistribute it and/or modify  *
7
*   it under the terms of the GNU General Public License as published by  *
8
*   the Free Software Foundation; either version 2 of the License, or     *
9
*   (at your option) any later version.                                   *
10
*                                                                         *
11
*   This program is distributed in the hope that it will be useful,       *
12
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
*   GNU General Public License for more details.                          *
15
*                                                                         *
16
*   You should have received a copy of the GNU General Public License     *
17
*   along with this program; if not, write to the                         *
18
*   Free Software Foundation, Inc.,                                       *
19
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20
***************************************************************************/
21
 
22
/**
23
 * Class defines all user token controller functions
24
 */
25
class UserTokenController extends Controller {
26
 
27
	/*
28
	 * function to get user token for a application
29
	 */
30
	function getUserToken($userId, $category = 'google') {
31
		$category = addslashes($category);
32
		$userId = intval($userId);
33
		$whereCond = "user_id=$userId and token_category='$category' order by created DESC";
34
		$tokenInfo = $this->dbHelper->getRow("user_tokens", $whereCond);
35
		return $tokenInfo;
36
	}
37
 
38
	/*
39
	 * function to insert user token
40
	 */
41
	function insertUserToken($tokenInfo) {
42
		$ret = $this->dbHelper->insertRow("user_tokens", $tokenInfo);
43
		return $ret;
44
	}
45
 
46
	/*
47
	 * function to update user token
48
	 */
49
	function updateUserToken($tokenId, $tokenInfo) {
50
		$whereCond = "id=" . intval($tokenId);
51
		$ret = $this->dbHelper->updateRow("user_tokens", $tokenInfo, $whereCond);
52
		return $ret;
53
	}
54
 
55
	/*
56
	 * function to delete user token
57
	 */
58
	function deleteToken($tokenId) {
59
		$whereCond = "id=" . intval($tokenId);
60
		$ret = $this->dbHelper->deleteRows("user_tokens", $whereCond);
61
		return $ret;
62
	}
63
 
64
	/*
65
	 * function to delete all user token
66
	 */
67
	function deleteAllUserTokens($userId, $category = 'google') {
68
		$category = addslashes($category);
69
		$userId = intval($userId);
70
		$whereCond = "user_id=$userId and token_category='$category'";
71
		$ret = $this->dbHelper->deleteRows("user_tokens", $whereCond);
72
		return $ret;
73
	}
74
 
75
}
76
?>