Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
 
3
/***************************************************************************
4
 *   Copyright (C) 2009-2011 by Geo Varghese(www.seopanel.in)  	   *
5
 *   sendtogeo@gmail.com   												   *
6
 *                                                                         *
7
 *   This program is free software; you can redistribute it and/or modify  *
8
 *   it under the terms of the GNU General Public License as published by  *
9
 *   the Free Software Foundation; either version 2 of the License, or     *
10
 *   (at your option) any later version.                                   *
11
 *                                                                         *
12
 *   This program is distributed in the hope that it will be useful,       *
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15
 *   GNU General Public License for more details.                          *
16
 *                                                                         *
17
 *   You should have received a copy of the GNU General Public License     *
18
 *   along with this program; if not, write to the                         *
19
 *   Free Software Foundation, Inc.,                                       *
20
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
21
 ***************************************************************************/
22
 
23
// class defines all api controller functions
24
class APIController extends Controller {
25
 
26
	// function to show api connection details
27
	function showAPIConnectionManager($info) {
28
		$settingCtrler = new SettingsController();
29
		$stnList = $settingCtrler->__getAllSettings(true, 1, 'api');
30
 
31
		// loop through settings
32
		$apiInfo = array();
33
		foreach ($stnList as $settingInfo) {
34
			$apiInfo[$settingInfo['set_name']] = $settingInfo['set_val'];
35
		}
36
 
37
		$apiInfo['api_url'] = SP_WEBPATH . "/" . SP_API_FILE;
38
		$this->set('apiInfo', $apiInfo);
39
		$this->render('api/showapiconnect');
40
	}
41
 
42
	// get api credentails of the system
43
	function getAPICredentials() {
44
		$apiCredInfo =  array();
45
		$settingCtrler = new SettingsController();
46
		$stList = $settingCtrler->__getAllSettings(true, 1, 'api');
47
 
48
		// loop through settings values
49
		foreach ($stList as $stInfo) {
50
			$apiCredInfo[$stInfo['set_name']] = $stInfo['set_val'];
51
		}
52
 
53
		return $apiCredInfo;
54
	}
55
 
56
	// function to verify api credentials passed
57
	function verifyAPICredentials($info) {
58
		$apiCredInfo = $this->getAPICredentials();
59
 
60
		if ( ($apiCredInfo['SP_API_KEY'] == $info['SP_API_KEY']) && ($apiCredInfo['API_SECRET'] == $info['API_SECRET']) ) {
61
			return true;
62
		}
63
 
64
		return false;
65
	}
66
 
67
}
68
?>