Update version numbers to 4.4 and lint php
[civicrm-core.git] / CRM / Utils / System / Soap.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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-2013
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 title for page
51 * @paqram string $pageTitle
52 *
53 * @return void
54 * @access public
55 */
56 function setTitle($title, $pageTitle) {
57 return;
58 }
59
60 /**
61 * given a permission string, check for access requirements
62 *
63 * @param string $str the permission to check
64 *
65 * @return boolean true if yes, else false
66 * @static
67 * @access public
68 */
69 function checkPermission($str) {
70 return TRUE;
71 }
72
73 /**
74 * Append an additional breadcrumb tag to the existing breadcrumb
75 *
76 * @param string $title
77 * @param string $url
78 *
79 * @return void
80 * @access public
81 */
82 function appendBreadCrumb($title, $url) {
83 return;
84 }
85
86 /**
87 * Append a string to the head of the html file
88 *
89 * @param string $head the new string to be appended
90 *
91 * @return void
92 * @access public
93 */
94 function addHTMLHead($head) {
95 return;
96 }
97
98 /**
99 * Generate an internal CiviCRM URL
100 *
101 * @param $path string The path being linked to, such as "civicrm/add"
102 * @param $query string A query string to append to the link.
103 * @param $absolute boolean Whether to force the output to be an absolute link (beginning with http:).
104 * Useful for links that will be displayed outside the site, such as in an
105 * RSS feed.
106 * @param $fragment string A fragment identifier (named anchor) to append to the link.
107 *
108 * @return string an HTML string containing a link to the given path.
109 * @access public
110 *
111 */
112 function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) {
113 if (isset(self::$ufClass)) {
114 $className = self::$ufClass;
115 $url = $className::url($path, $query, $absolute, $fragment);
116 return $url;
117 }
118 else {
119 return NULL;
120 }
121 }
122
123 /**
124 * figure out the post url for the form
125 *
126 * @param the default action if one is pre-specified
127 *
128 * @return string the url to post the form
129 * @access public
130 */
131 function postURL($action) {
132 return NULL;
133 }
134
135 /**
136 * Function to set the email address of the user
137 *
138 * @param object $user handle to the user object
139 *
140 * @return void
141 * @access public
142 */
143 function setEmail(&$user) {}
144
145 /**
146 * Authenticate a user against the real UF
147 *
148 * @param string $name Login name
149 * @param string $pass Login password
150 *
151 * @return array Result array
152 * @access public
153 */
154 function &authenticate($name, $pass) {
155 if (isset(self::$ufClass)) {
156 $className = self::$ufClass;
157 $result =& $className::authenticate($name, $pass);
158 return $result;
159 }
160 else {
161 return NULL;
162 }
163 }
164
165 /**
166 * Swap the current UF for soap
167 *
168 * @access public
169 */
170 public function swapUF() {
171 $config = CRM_Core_Config::singleton();
172
173 self::$uf = $config->userFramework;
174 $config->userFramework = 'Soap';
175
176 self::$ufClass = $config->userFrameworkClass;
177 $config->userFrameworkClass = 'CRM_Utils_System_Soap';
178 }
179
180 /**
181 * Get the locale set in the hosting CMS
182 *
183 * @return null as the language is set elsewhere
184 */
185 function getUFLocale() {
186 return NULL;
187 }
188
189 /**
190 * Get user login URL for hosting CMS (method declared in each CMS system class)
191 *
192 * @param string $destination - if present, add destination to querystring (works for Drupal only)
193 *
194 * @return string - loginURL for the current CMS
195 * @static
196 */
197 public function getLoginURL($destination = '') {
198 throw new Exception("Method not implemented: getLoginURL");
199 }
200 }
201