Merge pull request #12677 from civicrm/5.5
[civicrm-core.git] / CRM / Utils / System / Base.php
1 <?php
2
3 /**
4 * Base class for UF system integrations
5 */
6 abstract class CRM_Utils_System_Base {
7
8 /**
9 * Deprecated property to check if this is a drupal install.
10 *
11 * The correct method is to have functions on the UF classes for all UF specific
12 * functions and leave the codebase oblivious to the type of CMS
13 *
14 * @deprecated
15 * @var bool
16 * TRUE, if the CMS is Drupal.
17 */
18 var $is_drupal = FALSE;
19
20 /**
21 * Deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific
22 * functions and leave the codebase oblivious to the type of CMS
23 *
24 * @deprecated
25 * @var bool
26 * TRUE, if the CMS is Joomla!.
27 */
28 var $is_joomla = FALSE;
29
30 /**
31 * deprecated property to check if this is a wordpress install. The correct method is to have functions on the UF classes for all UF specific
32 * functions and leave the codebase oblivious to the type of CMS
33 *
34 * @deprecated
35 * @var bool
36 * TRUE, if the CMS is WordPress.
37 */
38 var $is_wordpress = FALSE;
39
40 /**
41 * Does this CMS / UF support a CMS specific logging mechanism?
42 * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions
43 * @var bool
44 */
45 var $supports_UF_Logging = FALSE;
46
47 /**
48 * @var bool
49 * TRUE, if the CMS allows CMS forms to be extended by hooks.
50 */
51 var $supports_form_extensions = FALSE;
52
53 public function initialize() {
54 if (\CRM_Utils_System::isSSL()) {
55 $this->mapConfigToSSL();
56 }
57 }
58
59 /**
60 * Append an additional breadcrumb tag to the existing breadcrumb.
61 *
62 * @param array $breadCrumbs
63 */
64 public function appendBreadCrumb($breadCrumbs) {
65 }
66
67 /**
68 * Reset an additional breadcrumb tag to the existing breadcrumb.
69 */
70 public function resetBreadCrumb() {
71 }
72
73 /**
74 * Append a string to the head of the html file.
75 *
76 * @param string $head
77 * The new string to be appended.
78 */
79 public function addHTMLHead($head) {
80 }
81
82 /**
83 * Rewrite various system urls to https.
84 */
85 public function mapConfigToSSL() {
86 // dont need to do anything, let CMS handle their own switch to SSL
87 }
88
89 /**
90 * Figure out the post url for QuickForm.
91 *
92 * @param string $action
93 * The default url if one is pre-specified.
94 *
95 * @return string
96 * The url to post the form.
97 */
98 public function postURL($action) {
99 $config = CRM_Core_Config::singleton();
100 if (!empty($action)) {
101 return $action;
102 }
103
104 return $this->url(CRM_Utils_Array::value($config->userFrameworkURLVar, $_GET),
105 NULL, TRUE, NULL, FALSE
106 );
107 }
108
109 /**
110 * Generate the url string to a CiviCRM path.
111 *
112 * @param string $path
113 * The path being linked to, such as "civicrm/add".
114 * @param string $query
115 * A query string to append to the link.
116 * @param bool $absolute
117 * Whether to force the output to be an absolute link (beginning with http).
118 * Useful for links that will be displayed outside the site, such as in an RSS feed.
119 * @param string $fragment
120 * A fragment identifier (named anchor) to append to the link.
121 * @param bool $frontend
122 * This link should be to the CMS front end (applies to WP & Joomla).
123 * @param bool $forceBackend
124 * This link should be to the CMS back end (applies to WP & Joomla).
125 *
126 * @return string
127 */
128 public function url(
129 $path = NULL,
130 $query = NULL,
131 $absolute = FALSE,
132 $fragment = NULL,
133 $frontend = FALSE,
134 $forceBackend = FALSE
135 ) {
136 return NULL;
137 }
138
139 /**
140 * Authenticate the user against the CMS db.
141 *
142 * @param string $name
143 * The user name.
144 * @param string $password
145 * The password for the above user.
146 * @param bool $loadCMSBootstrap
147 * Load cms bootstrap?.
148 * @param string $realPath
149 * Filename of script
150 *
151 * @return array|bool
152 * [contactID, ufID, unique string] else false if no auth
153 */
154 public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
155 return FALSE;
156 }
157
158 /**
159 * Set a message in the CMS to display to a user.
160 *
161 * @param string $message
162 * The message to set.
163 */
164 public function setMessage($message) {
165 }
166
167 /**
168 * Load user into session.
169 *
170 * @param obj $user
171 *
172 * @return bool
173 */
174 public function loadUser($user) {
175 return TRUE;
176 }
177
178 /**
179 * Immediately stop script execution and display a 401 "Access Denied" page.
180 */
181 public function permissionDenied() {
182 CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
183 }
184
185 /**
186 * Immediately stop script execution, log out the user and redirect to the home page.
187 *
188 * @deprecated
189 * This function should be removed in favor of linking to the CMS's logout page
190 */
191 public function logout() {
192 }
193
194 /**
195 * Clear CMS caches related to the user registration/profile forms.
196 * Used when updating/embedding profiles on CMS user forms.
197 * @see CRM-3600
198 */
199 public function updateCategories() {
200 }
201
202 /**
203 * Get the locale set in the CMS.
204 *
205 * @return string|null
206 * Locale or null for none
207 */
208 public function getUFLocale() {
209 return NULL;
210 }
211
212 /**
213 * If we are using a theming system, invoke theme, else just print the content.
214 *
215 * @param string $content
216 * The content that will be themed.
217 * @param bool $print
218 * Are we displaying to the screen or bypassing theming?.
219 * @param bool $maintenance
220 * For maintenance mode.
221 *
222 * @throws Exception
223 * @return string|null
224 * NULL, If $print is FALSE, and some other criteria match up.
225 * The themed string, otherwise.
226 *
227 * @todo The return value is inconsistent.
228 * @todo Better to always return, and never print.
229 */
230 public function theme(&$content, $print = FALSE, $maintenance = FALSE) {
231 $ret = FALSE;
232
233 // TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
234 // but the parts should be copied into cleaner subclass implementations
235 $config = CRM_Core_Config::singleton();
236 if (
237 $config->userSystem->is_drupal &&
238 function_exists('theme') &&
239 !$print
240 ) {
241 if ($maintenance) {
242 drupal_set_breadcrumb('');
243 drupal_maintenance_theme();
244 if ($region = CRM_Core_Region::instance('html-header', FALSE)) {
245 CRM_Utils_System::addHTMLHead($region->render(''));
246 }
247 print theme('maintenance_page', array('content' => $content));
248 exit();
249 }
250 // TODO: Figure out why D7 returns but everyone else prints
251 $ret = TRUE;
252 }
253 $out = $content;
254
255 $config = &CRM_Core_Config::singleton();
256 if (
257 !$print &&
258 $config->userFramework == 'WordPress'
259 ) {
260 if (!function_exists('is_admin')) {
261 throw new \Exception('Function "is_admin()" is missing, even though WordPress is the user framework.');
262 }
263 if (!defined('ABSPATH')) {
264 throw new \Exception('Constant "ABSPATH" is not defined, even though WordPress is the user framework.');
265 }
266 if (is_admin()) {
267 require_once ABSPATH . 'wp-admin/admin-header.php';
268 }
269 else {
270 // FIXME: we need to figure out to replace civicrm content on the frontend pages
271 }
272 }
273
274 if ($ret) {
275 return $out;
276 }
277 else {
278 print $out;
279 return NULL;
280 }
281 }
282
283 /**
284 * @return string
285 */
286 public function getDefaultBlockLocation() {
287 return 'left';
288 }
289
290 /**
291 * Get the absolute path to the site's base url.
292 *
293 * @return bool|mixed|string
294 */
295 public function getAbsoluteBaseURL() {
296 if (!defined('CIVICRM_UF_BASEURL')) {
297 return FALSE;
298 }
299
300 $url = CRM_Utils_File::addTrailingSlash(CIVICRM_UF_BASEURL, '/');
301
302 //format url for language negotiation, CRM-7803
303 $url = $this->languageNegotiationURL($url);
304
305 if (CRM_Utils_System::isSSL()) {
306 $url = str_replace('http://', 'https://', $url);
307 }
308
309 return $url;
310 }
311
312 /**
313 * Get the relative path to the sites base url.
314 *
315 * @return bool
316 */
317 public function getRelativeBaseURL() {
318 $absoluteBaseURL = $this->getAbsoluteBaseURL();
319 if ($absoluteBaseURL === FALSE) {
320 return FALSE;
321 }
322 $parts = parse_url($absoluteBaseURL);
323 return $parts['path'];
324 //$this->useFrameworkRelativeBase = empty($base['path']) ? '/' : $base['path'];
325 }
326
327 /**
328 * Get CMS Version.
329 *
330 * @return string
331 */
332 public function getVersion() {
333 return 'Unknown';
334 }
335
336 /**
337 * Format the url as per language Negotiation.
338 *
339 * @param string $url
340 * @param bool $addLanguagePart
341 * @param bool $removeLanguagePart
342 *
343 * @return string
344 * Formatted url.
345 */
346 public function languageNegotiationURL(
347 $url,
348 $addLanguagePart = TRUE,
349 $removeLanguagePart = FALSE
350 ) {
351 return $url;
352 }
353
354 /**
355 * Determine the location of the CMS root.
356 *
357 * @return string|null
358 * Local file system path to CMS root, or NULL if it cannot be determined
359 */
360 public function cmsRootPath() {
361 return NULL;
362 }
363
364 /**
365 * Create a user in the CMS.
366 *
367 * @param array $params
368 * @param string $mail
369 * Email id for cms user.
370 *
371 * @return int|bool
372 * uid if user exists, false otherwise
373 */
374 public function createUser(&$params, $mail) {
375 return FALSE;
376 }
377
378 /**
379 * Update a user's email address in the CMS.
380 *
381 * @param int $ufID
382 * User ID in CMS.
383 * @param string $email
384 * Primary contact email address.
385 */
386 public function updateCMSName($ufID, $email) {
387 }
388
389 /**
390 * Check if user is logged in to the CMS.
391 *
392 * @return bool
393 */
394 public function isUserLoggedIn() {
395 return FALSE;
396 }
397
398 /**
399 * Check if user registration is permitted.
400 *
401 * @return bool
402 */
403 public function isUserRegistrationPermitted() {
404 return FALSE;
405 }
406
407 /**
408 * Check if user can create passwords or is initially assigned a system-generated one.
409 *
410 * @return bool
411 */
412 public function isPasswordUserGenerated() {
413 return FALSE;
414 }
415
416 /**
417 * Get user login URL for hosting CMS (method declared in each CMS system class)
418 *
419 * @param string $destination
420 * If present, add destination to querystring (works for Drupal only).
421 *
422 * @return string
423 * loginURL for the current CMS
424 */
425 public abstract function getLoginURL($destination = '');
426
427 /**
428 * Get the login destination string.
429 *
430 * When this is passed in the URL the user will be directed to it after filling in the CMS form.
431 *
432 * @param CRM_Core_Form $form
433 * Form object representing the 'current' form - to which the user will be returned.
434 *
435 * @return string|NULL
436 * destination value for URL
437 */
438 public function getLoginDestination(&$form) {
439 return NULL;
440 }
441
442 /**
443 * Determine the native ID of the CMS user.
444 *
445 * @param string $username
446 *
447 * @throws CRM_Core_Exception
448 */
449 public function getUfId($username) {
450 $className = get_class($this);
451 throw new CRM_Core_Exception("Not implemented: {$className}->getUfId");
452 }
453
454 /**
455 * Set the localisation from the user framework.
456 *
457 * @param string $civicrm_language
458 *
459 * @return bool
460 */
461 public function setUFLocale($civicrm_language) {
462 return TRUE;
463 }
464
465 /**
466 * Set a init session with user object.
467 *
468 * @param array $data
469 * Array with user specific data
470 */
471 public function setUserSession($data) {
472 list($userID, $ufID) = $data;
473 $session = CRM_Core_Session::singleton();
474 $session->set('ufID', $ufID);
475 $session->set('userID', $userID);
476 }
477
478 /**
479 * Reset any system caches that may be required for proper CiviCRM integration.
480 */
481 public function flush() {
482 // nullop by default
483 }
484
485 /**
486 * Flush css/js caches.
487 */
488 public function clearResourceCache() {
489 // nullop by default
490 }
491
492 /**
493 * Add a script file.
494 *
495 * Note: This function is not to be called directly
496 * @see CRM_Core_Region::render()
497 *
498 * @param string $url absolute path to file
499 * @param string $region
500 * location within the document: 'html-header', 'page-header', 'page-footer'.
501 *
502 * @return bool
503 * TRUE if we support this operation in this CMS, FALSE otherwise
504 */
505 public function addScriptUrl($url, $region) {
506 return FALSE;
507 }
508
509 /**
510 * Add an inline script.
511 *
512 * Note: This function is not to be called directly
513 * @see CRM_Core_Region::render()
514 *
515 * @param string $code javascript code
516 * @param string $region
517 * location within the document: 'html-header', 'page-header', 'page-footer'.
518 *
519 * @return bool
520 * TRUE if we support this operation in this CMS, FALSE otherwise
521 */
522 public function addScript($code, $region) {
523 return FALSE;
524 }
525
526 /**
527 * Add a css file.
528 *
529 * Note: This function is not to be called directly
530 * @see CRM_Core_Region::render()
531 *
532 * @param string $url absolute path to file
533 * @param string $region
534 * location within the document: 'html-header', 'page-header', 'page-footer'.
535 *
536 * @return bool
537 * TRUE if we support this operation in this CMS, FALSE otherwise
538 */
539 public function addStyleUrl($url, $region) {
540 return FALSE;
541 }
542
543 /**
544 * Add an inline style.
545 *
546 * Note: This function is not to be called directly
547 * @see CRM_Core_Region::render()
548 *
549 * @param string $code css code
550 * @param string $region
551 * location within the document: 'html-header', 'page-header', 'page-footer'.
552 *
553 * @return bool
554 * TRUE if we support this operation in this CMS, FALSE otherwise
555 */
556 public function addStyle($code, $region) {
557 return FALSE;
558 }
559
560 /**
561 * Sets the title of the page.
562 *
563 * @param string $title
564 * Title to set in html header
565 * @param string|null $pageTitle
566 * Title to set in html body (if different)
567 */
568 public function setTitle($title, $pageTitle = NULL) {
569 }
570
571 /**
572 * Return default Site Settings.
573 *
574 * @param string $dir
575 *
576 * @return array
577 * - $url, (Joomla - non admin url)
578 * - $siteName,
579 * - $siteRoot
580 */
581 public function getDefaultSiteSettings($dir) {
582 $config = CRM_Core_Config::singleton();
583 $url = $config->userFrameworkBaseURL;
584 return array($url, NULL, NULL);
585 }
586
587 /**
588 * Determine the default location for file storage.
589 *
590 * FIXME:
591 * 1. This was pulled out from a bigger function. It should be split
592 * into even smaller pieces and marked abstract.
593 * 2. This would be easier to compute by a calling a CMS API, but
594 * for whatever reason Civi gets it from config data.
595 *
596 * @return array
597 * - url: string. ex: "http://example.com/sites/foo.com/files/civicrm"
598 * - path: string. ex: "/var/www/sites/foo.com/files/civicrm"
599 */
600 public function getDefaultFileStorage() {
601 global $civicrm_root;
602 $config = CRM_Core_Config::singleton();
603 $baseURL = CRM_Utils_System::languageNegotiationURL($config->userFrameworkBaseURL, FALSE, TRUE);
604
605 $filesURL = NULL;
606 $filesPath = NULL;
607
608 if ($config->userFramework == 'Joomla') {
609 // gross hack
610 // we need to remove the administrator/ from the end
611 $tempURL = str_replace("/administrator/", "/", $baseURL);
612 $filesURL = $tempURL . "media/civicrm/";
613 }
614 elseif ($config->userFramework == 'UnitTests') {
615 $filesURL = $baseURL . "sites/default/files/civicrm/";
616 }
617 else {
618 throw new CRM_Core_Exception("Failed to locate default file storage ($config->userFramework)");
619 }
620
621 return array(
622 'url' => $filesURL,
623 'path' => CRM_Utils_File::baseFilePath(),
624 );
625 }
626
627 /**
628 * Determine the location of the CiviCRM source tree.
629 *
630 * FIXME:
631 * 1. This was pulled out from a bigger function. It should be split
632 * into even smaller pieces and marked abstract.
633 * 2. This would be easier to compute by a calling a CMS API, but
634 * for whatever reason we take the hard way.
635 *
636 * @return array
637 * - url: string. ex: "http://example.com/sites/all/modules/civicrm"
638 * - path: string. ex: "/var/www/sites/all/modules/civicrm"
639 */
640 public function getCiviSourceStorage() {
641 global $civicrm_root;
642 $config = CRM_Core_Config::singleton();
643
644 // Don't use $config->userFrameworkBaseURL; it has garbage on it.
645 // More generally, w shouldn't be using $config here.
646 if (!defined('CIVICRM_UF_BASEURL')) {
647 throw new RuntimeException('Undefined constant: CIVICRM_UF_BASEURL');
648 }
649 $baseURL = CRM_Utils_File::addTrailingSlash(CIVICRM_UF_BASEURL, '/');
650 if (CRM_Utils_System::isSSL()) {
651 $baseURL = str_replace('http://', 'https://', $baseURL);
652 }
653
654 if ($config->userFramework == 'Joomla') {
655 $userFrameworkResourceURL = $baseURL . "components/com_civicrm/civicrm/";
656 }
657 elseif ($config->userFramework == 'WordPress') {
658 $userFrameworkResourceURL = CIVICRM_PLUGIN_URL . "civicrm/";
659 }
660 elseif ($this->is_drupal) {
661 // Drupal setting
662 // check and see if we are installed in sites/all (for D5 and above)
663 // we dont use checkURL since drupal generates an error page and throws
664 // the system for a loop on lobo's macosx box
665 // or in modules
666 $cmsPath = $config->userSystem->cmsRootPath();
667 $userFrameworkResourceURL = $baseURL . str_replace("$cmsPath/", '',
668 str_replace('\\', '/', $civicrm_root)
669 );
670
671 $siteName = $config->userSystem->parseDrupalSiteNameFromRoot($civicrm_root);
672 if ($siteName) {
673 $civicrmDirName = trim(basename($civicrm_root));
674 $userFrameworkResourceURL = $baseURL . "sites/$siteName/modules/$civicrmDirName/";
675 }
676 }
677 else {
678 $userFrameworkResourceURL = NULL;
679 }
680
681 return array(
682 'url' => CRM_Utils_File::addTrailingSlash($userFrameworkResourceURL),
683 'path' => CRM_Utils_File::addTrailingSlash($civicrm_root),
684 );
685 }
686
687 /**
688 * Perform any post login activities required by the CMS.
689 *
690 * e.g. for drupal: records a watchdog message about the new session, saves the login timestamp,
691 * calls hook_user op 'login' and generates a new session.
692 *
693 * @param array $params
694 *
695 * FIXME: Document values accepted/required by $params
696 */
697 public function userLoginFinalize($params = array()) {
698 }
699
700 /**
701 * Set timezone in mysql so that timestamp fields show the correct time.
702 */
703 public function setMySQLTimeZone() {
704 $timeZoneOffset = $this->getTimeZoneOffset();
705 if ($timeZoneOffset) {
706 $sql = "SET time_zone = '$timeZoneOffset'";
707 CRM_Core_DAO::executequery($sql);
708 }
709 }
710
711
712 /**
713 * Get timezone from CMS.
714 *
715 * @return string|false|null
716 */
717 public function getTimeZoneOffset() {
718 $timezone = $this->getTimeZoneString();
719 if ($timezone) {
720 if ($timezone == 'UTC' || $timezone == 'Etc/UTC') {
721 // CRM-17072 Let's short-circuit all the zero handling & return it here!
722 return '+00:00';
723 }
724 $tzObj = new DateTimeZone($timezone);
725 $dateTime = new DateTime("now", $tzObj);
726 $tz = $tzObj->getOffset($dateTime);
727
728 if ($tz === 0) {
729 // CRM-21422
730 return '+00:00';
731 }
732
733 if (empty($tz)) {
734 return FALSE;
735 }
736
737 $timeZoneOffset = sprintf("%02d:%02d", $tz / 3600, abs(($tz / 60) % 60));
738
739 if ($timeZoneOffset > 0) {
740 $timeZoneOffset = '+' . $timeZoneOffset;
741 }
742 return $timeZoneOffset;
743 }
744 return NULL;
745 }
746
747 /**
748 * Get timezone as a string.
749 * @return string
750 * Timezone string e.g. 'America/Los_Angeles'
751 */
752 public function getTimeZoneString() {
753 return date_default_timezone_get();
754 }
755
756 /**
757 * Get Unique Identifier from UserFramework system (CMS).
758 *
759 * @param object $user
760 * Object as described by the User Framework.
761 *
762 * @return mixed
763 * Unique identifier from the user Framework system
764 */
765 public function getUniqueIdentifierFromUserObject($user) {
766 return NULL;
767 }
768
769 /**
770 * Get User ID from UserFramework system (CMS).
771 *
772 * @param object $user
773 *
774 * Object as described by the User Framework.
775 * @return null|int
776 */
777 public function getUserIDFromUserObject($user) {
778 return NULL;
779 }
780
781 /**
782 * Get an array of user details for a contact, containing at minimum the user ID & name.
783 *
784 * @param int $contactID
785 *
786 * @return array
787 * CMS user details including
788 * - id
789 * - name (ie the system user name.
790 */
791 public function getUser($contactID) {
792 $ufMatch = civicrm_api3('UFMatch', 'getsingle', array(
793 'contact_id' => $contactID,
794 'domain_id' => CRM_Core_Config::domainID(),
795 ));
796 return array(
797 'id' => $ufMatch['uf_id'],
798 'name' => $ufMatch['uf_name'],
799 );
800 }
801
802 /**
803 * Get currently logged in user uf id.
804 *
805 * @return int|null
806 * logged in user uf id.
807 */
808 public function getLoggedInUfID() {
809 return NULL;
810 }
811
812 /**
813 * Get currently logged in user unique identifier - this tends to be the email address or user name.
814 *
815 * @return string|null
816 * logged in user unique identifier
817 */
818 public function getLoggedInUniqueIdentifier() {
819 return NULL;
820 }
821
822 /**
823 * Return a UFID (user account ID from the UserFramework / CMS system.
824 *
825 * ID is based on the user object passed, defaulting to the logged in user if not passed.
826 *
827 * Note that ambiguous situation occurs in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would
828 * seem to be resolving the user id before calling the function.
829 *
830 * Note there is already a function getUFId which takes $username as a param - we could add $user
831 * as a second param to it but it seems messy - just overloading it because the name is taken.
832 *
833 * @param object $user
834 *
835 * @return int
836 * User ID of UF System
837 */
838 public function getBestUFID($user = NULL) {
839 if ($user) {
840 return $this->getUserIDFromUserObject($user);
841 }
842 return $this->getLoggedInUfID();
843 }
844
845 /**
846 * Return a unique identifier (usually an email address or username) from the UserFramework / CMS system.
847 *
848 * This is based on the user object passed, defaulting to the logged in user if not passed.
849 *
850 * Note that ambiguous situation occurs in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would seem to be
851 * resolving the unique identifier before calling the function.
852 *
853 * @param object $user
854 *
855 * @return string
856 * unique identifier from the UF System
857 */
858 public function getBestUFUniqueIdentifier($user = NULL) {
859 if ($user) {
860 return $this->getUniqueIdentifierFromUserObject($user);
861 }
862 return $this->getLoggedInUniqueIdentifier();
863 }
864
865 /**
866 * List modules installed in the CMS, including enabled and disabled ones.
867 *
868 * @return array
869 * [CRM_Core_Module]
870 */
871 public function getModules() {
872 return array();
873 }
874
875 /**
876 * Get Url to view user record.
877 *
878 * @param int $contactID
879 * Contact ID.
880 *
881 * @return string|null
882 */
883 public function getUserRecordUrl($contactID) {
884 return NULL;
885 }
886
887 /**
888 * Is the current user permitted to add a user.
889 *
890 * @return bool
891 */
892 public function checkPermissionAddUser() {
893 return FALSE;
894 }
895
896 /**
897 * Output code from error function.
898 *
899 * @param string $content
900 */
901 public function outputError($content) {
902 echo CRM_Utils_System::theme($content);
903 }
904
905 /**
906 * Log error to CMS.
907 *
908 * @param string $message
909 */
910 public function logger($message) {
911 }
912
913 /**
914 * Append to coreResourcesList.
915 *
916 * @param array $list
917 */
918 public function appendCoreResources(&$list) {
919 }
920
921 /**
922 * @param string $name
923 * @param string $value
924 */
925 public function setHttpHeader($name, $value) {
926 header("$name: $value");
927 }
928
929 /**
930 * Create CRM contacts for all existing CMS users
931 *
932 * @return array
933 * @throws \Exception
934 */
935 public function synchronizeUsers() {
936 throw new Exception('CMS user creation not supported for this framework');
937 return array();
938 }
939
940 }