view = 'fontmanager'; } /** * Delete a font and go back to the font manager */ function action_deleteFont(){ global $current_user; if(!is_admin($current_user)){ sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); } $urlSTR = 'index.php?module=Configurator&action=FontManager'; if(!empty($_REQUEST['filename'])){ require_once('include/Sugarpdf/FontManager.php'); $fontManager = new FontManager(); $fontManager->filename = $_REQUEST['filename']; if(!$fontManager->deleteFont()){ $urlSTR .='&error='.urlencode(implode("
",$fontManager->errors)); } } header("Location: $urlSTR"); } function action_listview(){ $this->view = 'edit'; } /** * Show the addFont view */ function action_addFontView(){ $this->view = 'addFontView'; } /** * Add a new font and show the addFontResult view */ function action_addFont(){ global $current_user, $mod_strings; if(!is_admin($current_user)){ sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); } if(empty($_FILES['pdf_metric_file']['name'])){ $this->errors[]=translate("ERR_MISSING_REQUIRED_FIELDS")." ".translate("LBL_PDF_METRIC_FILE", "Configurator"); $this->view = 'addFontView'; return; } if(empty($_FILES['pdf_font_file']['name'])){ $this->errors[]=translate("ERR_MISSING_REQUIRED_FIELDS")." ".translate("LBL_PDF_FONT_FILE", "Configurator"); $this->view = 'addFontView'; return; } $path_info = pathinfo($_FILES['pdf_font_file']['name']); $path_info_metric = pathinfo($_FILES['pdf_metric_file']['name']); if(($path_info_metric['extension']!="afm" && $path_info_metric['extension']!="ufm") || ($path_info['extension']!="ttf" && $path_info['extension']!="otf" && $path_info['extension']!="pfb")){ $this->errors[]=translate("JS_ALERT_PDF_WRONG_EXTENSION", "Configurator"); $this->view = 'addFontView'; return; } if($_REQUEST['pdf_embedded'] == "false"){ if(empty($_REQUEST['pdf_cidinfo'])){ $this->errors[]=translate("ERR_MISSING_CIDINFO", "Configurator"); $this->view = 'addFontView'; return; } $_REQUEST['pdf_embedded']=false; }else{ $_REQUEST['pdf_embedded']=true; $_REQUEST['pdf_cidinfo']=""; } if(empty($_REQUEST['pdf_patch'])){ $_REQUEST['pdf_patch']="return array();"; }else{ $_REQUEST['pdf_patch']="return {$_REQUEST['pdf_patch']};"; } $this->view = 'addFontResult'; } function action_saveadminwizard() { $focus = new Administration(); $focus->retrieveSettings(); $focus->saveConfig(); $configurator = new Configurator(); $configurator->populateFromPost(); $configurator->handleOverride(); $configurator->parseLoggerSettings(); $configurator->saveConfig(); SugarApplication::redirect('index.php?module=Users&action=Wizard&skipwelcome=1'); } function action_saveconfig() { $configurator = new Configurator(); $configurator->saveConfig(); $focus = new Administration(); $focus->saveConfig(); // Clear the Contacts file b/c portal flag affects rendering if (file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/Contacts/EditView.tpl')) unlink($GLOBALS['sugar_config']['cache_dir'].'modules/Contacts/EditView.tpl'); SugarApplication::redirect('index.php?module=Administration&action=index'); } function action_detail() { $this->view = 'edit'; } }