Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
// $Id: EbatNs_AuthenticationHelper.php 4066 2011-11-03 08:13:59Z tiefland $
3
// $Log: EbatNs_AuthenticationHelper.php,v $
4
// Revision 1.3  2008-06-13 08:51:25  michael
5
// use getSession() on proxy
6
//
7
// Revision 1.2  2008/05/02 15:04:05  carsten
8
// Initial, PHP5
9
//
10
//
11
require_once 'EbatNs_ServiceProxy.php';
12
require_once 'GetRuNameRequestType.php';
13
 
14
class EbatNs_AuthenticationHelper
15
{
16
	protected $_cs;
17
	function EbatNs_AuthenticationHelper($cs)
18
	{
19
		$this->_cs = $cs;
20
	}
21
 
22
	function GetEbaySignInUrl($RuName, $Params = null)
23
	{
24
		$s = $this->_cs->_session;
25
		if ($s->getAppMode() == 0)
26
			$url = 'https://signin.' . $this->_getDomainnameBySiteId($s->getSiteId()) . '/ws/eBayISAPI.dll?SignIn&';
27
		else
28
			$url = 'https://signin.sandbox.' . $this->_getDomainnameBySiteId($s->getSiteId()) . '/ws/eBayISAPI.dll?SignIn&';
29
		$url .= 'runame=' . $RuName;
30
		if ($Params != null)
31
			$url .= '&ruparams=' . $Params;
32
		return $url;
33
	}
34
 
35
	function getFetchSecretId()
36
	{
37
		srand((double)microtime() * 1000000);
38
		$r = rand ;
39
		$u = uniqid(getmypid() . $r . (double)microtime() * 1000000, 1);
40
		$uuid = md5 ($u);
41
		return $uuid;
42
	}
43
 
44
	function GetEbaySignInUrlFetch($RuName, $SecretId)
45
	{
46
		$s = $this->_cs->getSession();
47
		if ($s->getAppMode() == 0)
48
			$url = 'https://signin.' . $this->_getDomainnameBySiteId($s->getSiteId()) . '/ws/eBayISAPI.dll?SignIn&';
49
		else
50
			$url = 'https://signin.sandbox.' . $this->_getDomainnameBySiteId($s->getSiteId()) . '/ws/eBayISAPI.dll?SignIn&';
51
		$url .= 'runame=' . $RuName . '&sid=' . $SecretId;
52
		return $url;
53
	}
54
 
55
	function _getDomainnameBySiteId($siteid = 0)
56
	{
57
		switch ($siteid) {
58
			case 0:
59
				return 'ebay.com';
60
			case 2:
61
				return 'ebay.ca';
62
			case 3:
63
				return 'ebay.co.uk';
64
			case 15:
65
				return 'ebay.au';
66
			case 16:
67
				return 'ebay.at';
68
			case 23:
69
				return 'ebay.be';
70
			case 71:
71
				return 'ebay.fr';
72
			case 77:
73
				return 'ebay.de';
74
			case 100:
75
				return 'ebaymotors.com';
76
			case 101:
77
				return 'ebay.it';
78
			case 123:
79
				return 'ebay.be';
80
			case 146:
81
				return 'ebay.nl';
82
			case 186:
83
				return 'ebay.es';
84
			case 193:
85
				return 'ebay.ch';
86
			case 196:
87
				return 'ebay.tw';
88
			case 201:
89
				return 'ebay.hk';
90
			case 203:
91
				return 'ebay.in';
92
			case 207:
93
				return 'ebay.my';
94
			case 211:
95
				return 'ebay.ph';
96
			case 212:
97
				return 'ebay.pl';
98
			case 216:
99
				return 'ebay.sg';
100
			case 218:
101
				return 'ebay.se';
102
			case 223:
103
				return 'ebay.cn';
104
		}
105
		return 'ebay.com';
106
	}
107
 
108
}
109
 
110
?>