-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathadmin.civicrm.php
122 lines (105 loc) · 4.43 KB
/
admin.civicrm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('No direct access allowed');
// check for php version and ensure its greater than 5.
// do a fatal exit if
if ((int ) substr(PHP_VERSION, 0, 1) < 5) {
echo "CiviCRM requires PHP Version 5.2 or greater. You are running PHP Version " . PHP_VERSION . "<p>";
exit();
}
define('CIVICRM_SETTINGS_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'civicrm.settings.php');
include_once CIVICRM_SETTINGS_PATH;
civicrm_invoke();
/**
* This was the original name of the initialization function and is
* retained for backward compatibility
*/
function civicrm_init() {
return civicrm_initialize();
}
/**
* Initialize CiviCRM. Call this function from other modules too if
* they use the CiviCRM API.
*/
function civicrm_initialize() {
// Check for php version and ensure its greater than minPhpVersion
$minPhpVersion = '8.0.0';
if (version_compare(PHP_VERSION, $minPhpVersion) < 0) {
echo "CiviCRM requires PHP version $minPhpVersion or greater. You are running PHP version " . PHP_VERSION . "<p>";
exit();
}
require_once 'CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader::singleton()->register();
require_once 'PEAR.php';
$config = CRM_Core_Config::singleton();
// Set the time zone in both PHP and database
$joomlaUserTimezone = CRM_Core_Config::singleton()->userSystem->getTimeZoneString();
date_default_timezone_set($joomlaUserTimezone);
CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
}
function plugin_init() {
//invoke plugins.
JPluginHelper::importPlugin('civicrm');
$app = JFactory::getApplication();
$app->triggerEvent('onCiviLoad');
// set page title
JToolBarHelper::title('CiviCRM');
// We lose the PHP time zone default setting,so try to set it again.
$joomlaUserTimezone = CRM_Core_Config::singleton()->userSystem->getTimeZoneString();
date_default_timezone_set($joomlaUserTimezone);
}
function civicrm_invoke() {
civicrm_initialize();
plugin_init();
$user = JFactory::getUser();
/* bypass synchronize if running upgrade
* to avoid any serious non-recoverable error
* which might hinder the upgrade process.
*/
if (CRM_Utils_Array::value('task', $_REQUEST) != 'civicrm/upgrade') {
CRM_Core_BAO_UFMatch::synchronize($user, FALSE, 'Joomla', 'Individual', TRUE);
}
// Add our standard css & js
$resources = CRM_Core_Resources::singleton();
$resources->addCoreResources();
$config = CRM_Core_Config::singleton();
if (!$config->userFrameworkFrontend) {
$resources->addStyleFile('civicrm', 'css/joomla.css', -101, 'html-header');
}
else {
$resources->addStyleFile('civicrm', 'css/joomla_frontend.css', -97, 'html-header');
}
if (isset($_GET['task'])) {
$args = explode('/', trim($_GET['task']));
}
else {
$_GET['task'] = 'civicrm/dashboard';
$_GET['reset'] = 1;
$args = array('civicrm', 'dashboard');
}
define('CIVICRM_UF_HEAD', TRUE);
CRM_Core_Invoke::invoke($args);
}