2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
39 require_once('include/MVC/Controller/SugarController.php');
40 class ConfiguratorController extends SugarController
43 * Go to the font manager view
45 function action_FontManager(){
46 $this->view = 'fontmanager';
50 * Delete a font and go back to the font manager
52 function action_deleteFont(){
54 if(!is_admin($current_user)){
55 sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
57 $urlSTR = 'index.php?module=Configurator&action=FontManager';
58 if(!empty($_REQUEST['filename'])){
59 require_once('include/Sugarpdf/FontManager.php');
60 $fontManager = new FontManager();
61 $fontManager->filename = $_REQUEST['filename'];
62 if(!$fontManager->deleteFont()){
63 $urlSTR .='&error='.urlencode(implode("<br>",$fontManager->errors));
66 header("Location: $urlSTR");
69 function action_listview(){
73 * Show the addFont view
75 function action_addFontView(){
76 $this->view = 'addFontView';
79 * Add a new font and show the addFontResult view
81 function action_addFont(){
82 global $current_user, $mod_strings;
83 if(!is_admin($current_user)){
84 sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
86 if(empty($_FILES['pdf_metric_file']['name'])){
87 $this->errors[]=translate("ERR_MISSING_REQUIRED_FIELDS")." ".translate("LBL_PDF_METRIC_FILE", "Configurator");
88 $this->view = 'addFontView';
91 if(empty($_FILES['pdf_font_file']['name'])){
92 $this->errors[]=translate("ERR_MISSING_REQUIRED_FIELDS")." ".translate("LBL_PDF_FONT_FILE", "Configurator");
93 $this->view = 'addFontView';
96 $path_info = pathinfo($_FILES['pdf_font_file']['name']);
97 $path_info_metric = pathinfo($_FILES['pdf_metric_file']['name']);
98 if(($path_info_metric['extension']!="afm" && $path_info_metric['extension']!="ufm") ||
99 ($path_info['extension']!="ttf" && $path_info['extension']!="otf" && $path_info['extension']!="pfb")){
100 $this->errors[]=translate("JS_ALERT_PDF_WRONG_EXTENSION", "Configurator");
101 $this->view = 'addFontView';
105 if($_REQUEST['pdf_embedded'] == "false"){
106 if(empty($_REQUEST['pdf_cidinfo'])){
107 $this->errors[]=translate("ERR_MISSING_CIDINFO", "Configurator");
108 $this->view = 'addFontView';
111 $_REQUEST['pdf_embedded']=false;
113 $_REQUEST['pdf_embedded']=true;
114 $_REQUEST['pdf_cidinfo']="";
116 if(empty($_REQUEST['pdf_patch'])){
117 $_REQUEST['pdf_patch']="return array();";
119 $_REQUEST['pdf_patch']="return {$_REQUEST['pdf_patch']};";
121 $this->view = 'addFontResult';
123 function action_saveadminwizard()
125 $focus = new Administration();
126 $focus->retrieveSettings();
127 $focus->saveConfig();
129 $configurator = new Configurator();
130 $configurator->populateFromPost();
131 $configurator->handleOverride();
132 $configurator->parseLoggerSettings();
133 $configurator->saveConfig();
135 SugarApplication::redirect('index.php?module=Users&action=Wizard&skipwelcome=1');
138 function action_saveconfig()
140 $configurator = new Configurator();
141 $configurator->saveConfig();
143 $focus = new Administration();
144 $focus->saveConfig();
146 // Clear the Contacts file b/c portal flag affects rendering
147 if (file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/Contacts/EditView.tpl'))
148 unlink($GLOBALS['sugar_config']['cache_dir'].'modules/Contacts/EditView.tpl');
150 SugarApplication::redirect('index.php?module=Administration&action=index');
153 function action_detail()
155 $this->view = 'edit';