Merge pull request #4893 from colemanw/INFRA-132
[civicrm-core.git] / CRM / Utils / System / Soap.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2014
32 * $Id$
33 *
34 */
35
36 /**
37 * Soap specific stuff goes here
38 */
39 class CRM_Utils_System_Soap extends CRM_Utils_System_Base {
40
41 /**
42 * UF container variables
43 */
44 static $uf = NULL;
45 static $ufClass = NULL;
46
47 /**
48 * Sets the title of the page
49 *
50 * @param string $title
51 * Title for page.
52 * @param $pageTitle
53 *
54 * @paqram string $pageTitle
55 *
56 * @return void
57 */
58 public function setTitle($title, $pageTitle) {
59 return;
60 }
61
62 /**
63 * Given a permission string, check for access requirements
64 *
65 * @param string $str
66 * The permission to check.
67 *
68 * @return boolean
69 * true if yes, else false
70 * @static
71 */
72 public function checkPermission($str) {
73 return TRUE;
74 }
75
76 /**
77 * Append an additional breadcrumb tag to the existing breadcrumb
78 *
79 * @param string $title
80 * @param string $url
81 *
82 * @return void
83 */
84 public function appendBreadCrumb($title, $url) {
85 return;
86 }
87
88 /**
89 * Append a string to the head of the html file
90 *
91 * @param string $head
92 * The new string to be appended.
93 *
94 * @return void
95 */
96 public function addHTMLHead($head) {
97 return;
98 }
99
100 /**
101 * Generate an internal CiviCRM URL
102 *
103 * @param string $path
104 * The path being linked to, such as "civicrm/add".
105 * @param string $query
106 * A query string to append to the link.
107 * @param bool $absolute
108 * Whether to force the output to be an absolute link (beginning with http:).
109 * Useful for links that will be displayed outside the site, such as in an
110 * RSS feed.
111 * @param string $fragment
112 * A fragment identifier (named anchor) to append to the link.
113 *
114 * @return string
115 * an HTML string containing a link to the given path.
116 */
117 public function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) {
118 if (isset(self::$ufClass)) {
119 $className = self::$ufClass;
120 $url = $className::url($path, $query, $absolute, $fragment);
121 return $url;
122 }
123 else {
124 return NULL;
125 }
126 }
127
128 /**
129 * Figure out the post url for the form
130 *
131 * @param the default action if one is pre-specified
132 *
133 * @return string
134 * the url to post the form
135 */
136 public function postURL($action) {
137 return NULL;
138 }
139
140 /**
141 * Set the email address of the user
142 *
143 * @param object $user
144 * Handle to the user object.
145 *
146 * @return void
147 */
148 public function setEmail(&$user) {
149 }
150
151 /**
152 * Authenticate a user against the real UF
153 *
154 * @param string $name
155 * Login name.
156 * @param string $pass
157 * Login password.
158 *
159 * @return array
160 * Result array
161 */
162 public function &authenticate($name, $pass) {
163 if (isset(self::$ufClass)) {
164 $className = self::$ufClass;
165 $result =& $className::authenticate($name, $pass);
166 return $result;
167 }
168 else {
169 return NULL;
170 }
171 }
172
173 /**
174 * Swap the current UF for soap
175 */
176 public function swapUF() {
177 $config = CRM_Core_Config::singleton();
178
179 self::$uf = $config->userFramework;
180 $config->userFramework = 'Soap';
181
182 self::$ufClass = $config->userFrameworkClass;
183 $config->userFrameworkClass = 'CRM_Utils_System_Soap';
184 }
185
186 /**
187 * Get the locale set in the hosting CMS
188 *
189 * @return null
190 * as the language is set elsewhere
191 */
192 public function getUFLocale() {
193 return NULL;
194 }
195
196 /**
197 * Get user login URL for hosting CMS (method declared in each CMS system class)
198 *
199 * @param string $destination
200 * If present, add destination to querystring (works for Drupal only).
201 *
202 * @throws Exception
203 * @return string
204 * loginURL for the current CMS
205 * @static
206 */
207 public function getLoginURL($destination = '') {
208 throw new Exception("Method not implemented: getLoginURL");
209 }
210 }