CRM-13863 - Whitelist open-inline contribution links
[civicrm-core.git] / CRM / Admin / Page / Admin.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 * Page for displaying Administer CiviCRM Control Panel
38 */
39 class CRM_Admin_Page_Admin extends CRM_Core_Page {
40 function run() {
41 $errorMessage = '';
42 // ensure that all CiviCRM tables are InnoDB, else abort
43 // this is not a very fast operation, so we do it randomly 10% of the times
44 // but we do it for most / all tables
45 // http://bugs.mysql.com/bug.php?id=43664
46 if (rand(1, 10) == 3 &&
47 CRM_Core_DAO::isDBMyISAM(150)
48 ) {
49 $errorMessage = ts('Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues.');
50 CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert");
51 }
52
53 if (!CRM_Utils_System::isDBVersionValid($errorMessage)) {
54 CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert", array('expires' => 0));
55 }
56
57 $groups = array('Customize Data and Screens' => ts('Customize Data and Screens'),
58 'Communications' => ts('Communications'),
59 'Localization' => ts('Localization'),
60 'Users and Permissions' => ts('Users and Permissions'),
61 'System Settings' => ts('System Settings'),
62 );
63
64 $config = CRM_Core_Config::singleton();
65 if (in_array('CiviContribute', $config->enableComponents)) {
66 $groups['CiviContribute'] = ts('CiviContribute');
67 }
68
69 if (in_array('CiviMember', $config->enableComponents)) {
70 $groups['CiviMember'] = ts('CiviMember');
71 }
72
73 if (in_array('CiviEvent', $config->enableComponents)) {
74 $groups['CiviEvent'] = ts('CiviEvent');
75 }
76
77 if (in_array('CiviMail', $config->enableComponents)) {
78 $groups['CiviMail'] = ts('CiviMail');
79 }
80
81 if (in_array('CiviCase', $config->enableComponents)) {
82 $groups['CiviCase'] = ts('CiviCase');
83 }
84
85 if (in_array('CiviReport', $config->enableComponents)) {
86 $groups['CiviReport'] = ts('CiviReport');
87 }
88
89 if (in_array('CiviCampaign', $config->enableComponents)) {
90 $groups['CiviCampaign'] = ts('CiviCampaign');
91 }
92
93 $values = CRM_Core_Menu::getAdminLinks();
94
95 $this->_showHide = new CRM_Core_ShowHideBlocks();
96 foreach ($groups as $group => $title) {
97 $groupId = str_replace(' ', '_', $group);
98
99 $this->_showHide->addShow("id_{$groupId}_show");
100 $this->_showHide->addHide("id_{$groupId}");
101 $v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
102 if (isset($values[$group])) {
103 $adminPanel[$groupId] = $values[$group];
104 $adminPanel[$groupId]['show'] = $v['show'];
105 $adminPanel[$groupId]['hide'] = $v['hide'];
106 $adminPanel[$groupId]['title'] = $title;
107 } else {
108 $adminPanel[$groupId] = array();
109 $adminPanel[$groupId]['show'] = '';
110 $adminPanel[$groupId]['hide'] = '';
111 $adminPanel[$groupId]['title'] = $title;
112 }
113 }
114 $this->assign('adminPanel', $adminPanel);
115 $this->_showHide->addToTemplate();
116 return parent::run();
117 }
118 }
119