/** * @see SugarView::preDisplay() */ public function preDisplay() { global $current_user; if (!is_admin($current_user)) { sugar_die("Unauthorized access to administration."); } }
/** * static addActions($category, $type='module') * Adds all default actions for a category/type * * @param STRING $category - the category (e.g module name - Accounts, Contacts) * @param STRING $type - the type (e.g. 'module', 'field') */ function addActions($category, $type = 'module') { global $ACLActions; $db =& PearDatabase::getInstance(); if (isset($ACLActions[$type])) { foreach ($ACLActions[$type]['actions'] as $action_name => $action_def) { $action = new ACLAction(); $query = "SELECT * FROM " . $action->table_name . " WHERE name='{$action_name}' AND category = '{$category}' AND acltype='{$type}'"; $result = $db->query($query); //only add if an action with that name and category don't exist $row = $db->fetchByAssoc($result); if ($row == null) { $action->name = $action_name; $action->category = $category; $action->aclaccess = $action_def['default']; $action->acltype = $type; $action->modified_user_id = 1; $action->created_by = 1; $action->save(); } } } else { sugar_die("FAILED TO ADD: {$category} : {$name} - TYPE {$type} NOT DEFINED IN modules/ACLActions/actiondefs.php"); } }
/** * @see SugarController::loadBean() */ public function loadBean() { global $mod_strings; if (!isset($_REQUEST['import_module'])) { return; // there is no module to load } $this->importModule = $_REQUEST['import_module']; $this->bean = BeanFactory::getBean($this->importModule); if ($this->bean) { if (!$this->bean->importable) { $this->bean = false; } elseif ($_REQUEST['import_module'] == 'Users' && !is_admin($GLOBALS['current_user'])) { $this->bean = false; } elseif ($this->bean->bean_implements('ACL')) { if (!ACLController::checkAccess($this->bean->module_dir, 'import', true)) { ACLController::displayNoAccess(); sugar_die(''); } } } if (!$this->bean && $this->importModule != "Administration") { $_REQUEST['message'] = $mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP']; $this->view = 'error'; if (!isset($_REQUEST['import_map_id']) && !isset($_REQUEST['delete_map_id'])) { $this->_processed = true; } } else { $GLOBALS['FOCUS'] = $this->bean; } }
function __construct($view, $moduleName, $packageName = '', $client = '') { $GLOBALS['log']->debug(get_class($this) . ": __construct()"); // Set the client $this->client = $client; // Simple validation if (!in_array($view, $this->allowedViews)) { sugar_die("ListLayoutMetaDataParser: View {$view} is not supported"); } if (empty($packageName)) { require_once 'modules/ModuleBuilder/parsers/views/DeployedMetaDataImplementation.php'; $this->implementation = new DeployedMetaDataImplementation($view, $moduleName, $client); } else { require_once 'modules/ModuleBuilder/parsers/views/UndeployedMetaDataImplementation.php'; $this->implementation = new UndeployedMetaDataImplementation($view, $moduleName, $packageName, $client); } $this->view = $view; $this->_fielddefs = $this->implementation->getFielddefs(); //$this->_paneldefs = $this->implementation->getPanelDefs(); $this->_standardizeFieldLabels($this->_fielddefs); $this->_viewdefs = array_change_key_case($this->implementation->getViewdefs()); // force to lower case so don't have problems with case mismatches later // Set the module name $this->_moduleName = $moduleName; }
public function display() { global $current_user, $current_language, $sugar_flavor, $sugar_config; if (!$current_user->is_admin) { sugar_die(translate("LBL_MUST_BE_ADMIN")); } //RemoveTabSave: let dashboard pass since we are still altering it if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'RemoveTabSave') { if (isset($_REQUEST['TabToRemove'])) { $dashboardManager = BeanFactory::newBean("dash_DashboardManager"); $dashboardManager->temp_unencoded_pages = $dashboardManager->deletePageByKey($_REQUEST['TabToRemove'], $current_user->getPreference('pages', 'Home')); $dashboardManager->temp_unencoded_dashlets = $current_user->getPreference('dashlets', 'Home'); $dashboardManager->setDashboardForUser($current_user); $current_user->getPreference('pages', 'Home'); $current_user->getPreference('dashlets', 'Home'); } } elseif (isset($this->bean->fetched_row['id'])) { //set this dashboard for current user $this->bean->setDashboardForUser($current_user); } else { //set dashboard back to clean template $current_user->resetPreferences('Home'); } parent::display(); //get language for dashboard $mod_strings = return_module_language($current_language, 'Home'); //render dashboard $lock_homepage = $sugar_config['lock_homepage']; $sugar_config['lock_homepage'] = false; require_once "modules/Home/index.php"; $sugar_config['lock_homepage'] = $lock_homepage; }
function SubPanel($module, $record_id, $subpanel_id, $subpanelDef, $layout_def_key = '') { global $theme, $beanList, $beanFiles, $focus, $app_strings; $this->subpanel_defs = $subpanelDef; $this->subpanel_id = $subpanel_id; $this->parent_record_id = $record_id; $this->parent_module = $module; $this->layout_def_key = $layout_def_key; $this->parent_bean = $focus; $result = $focus; if (empty($result)) { $parent_bean_name = $beanList[$module]; $parent_bean_file = $beanFiles[$parent_bean_name]; require_once $parent_bean_file; $this->parent_bean = new $parent_bean_name(); $this->parent_bean->retrieve($this->parent_record_id); $result = $this->parent_bean; } if ($record_id != 'fab4' && $result == null) { sugar_die($app_strings['ERROR_NO_RECORD']); } if (empty($subpanelDef)) { //load the subpanel by name. if (!class_exists('MyClass')) { require_once 'include/SubPanel/SubPanelDefinitions.php'; } $panelsdef = new SubPanelDefinitions($result, $layout_def_key); $subpanelDef = $panelsdef->load_subpanel($subpanel_id); $this->subpanel_defs = $subpanelDef; } }
/** * @see SugarView::process() */ public function process() { global $current_user; if (!is_admin($current_user)) { sugar_die("Unauthorized access to administration."); } // Check if the theme is valid if (!isset($_REQUEST['theme']) || !in_array($_REQUEST['theme'], array_keys(SugarThemeRegistry::allThemes()))) { sugar_die("theme is invalid."); } if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'save') { $theme_config = SugarThemeRegistry::getThemeConfig($_REQUEST['theme']); $configurator = new Configurator(); foreach ($theme_config as $name => $def) { if (isset($_REQUEST[$name])) { if ($_REQUEST[$name] == 'true') { $_REQUEST[$name] = true; } else { if ($_REQUEST[$name] == 'false') { $_REQUEST[$name] = false; } } $configurator->config['theme_settings'][$_REQUEST['theme']][$name] = $_REQUEST[$name]; } } $configurator->handleOverride(); SugarApplication::redirect('index.php?module=Administration&action=ThemeSettings'); exit; } parent::process(); }
/** * @see SugarView::preDisplay() */ public function preDisplay() { global $current_user; if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Emails') && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) { sugar_die("Unauthorized access to administration."); } }
public function preDisplay() { if (!$this->bean->ACLAccess('edit')) { ACLController::displayNoAccess(); sugar_die(''); } }
public function preDisplay() { global $current_user; if (!is_admin($current_user)) { sugar_die("No access"); } }
/** * Searches through the installed relationships to find broken self referencing one-to-many relationships * (wrong field used in the subpanel, and the left link not marked as left) */ function upgrade_custom_relationships($modules = array()) { global $current_user, $moduleList; if (!is_admin($current_user)) { sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); } require_once "modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php"; require_once "modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php"; if (empty($modules)) { $modules = $moduleList; } foreach ($modules as $module) { $depRels = new DeployedRelationships($module); $relList = $depRels->getRelationshipList(); foreach ($relList as $relName) { $relObject = $depRels->get($relName); $def = $relObject->getDefinition(); //We only need to fix self referencing one to many relationships if ($def['lhs_module'] == $def['rhs_module'] && $def['is_custom'] && $def['relationship_type'] == "one-to-many") { $layout_defs = array(); if (!is_dir("custom/Extension/modules/{$module}/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/{$module}/Ext/Vardefs")) { continue; } //Find the extension file containing the vardefs for this relationship foreach (scandir("custom/Extension/modules/{$module}/Ext/Vardefs") as $file) { if (substr($file, 0, 1) != "." && strtolower(substr($file, -4)) == ".php") { $dictionary = array($module => array("fields" => array())); $filePath = "custom/Extension/modules/{$module}/Ext/Vardefs/{$file}"; include $filePath; if (isset($dictionary[$module]["fields"][$relName])) { $rhsDef = $dictionary[$module]["fields"][$relName]; //Update the vardef for the left side link field if (!isset($rhsDef['side']) || $rhsDef['side'] != 'left') { $rhsDef['side'] = 'left'; $fileContents = file_get_contents($filePath); $out = preg_replace('/\\$dictionary[\\w"\'\\[\\]]*?' . $relName . '["\'\\[\\]]*?\\s*?=\\s*?array\\s*?\\(.*?\\);/s', '$dictionary["' . $module . '"]["fields"]["' . $relName . '"]=' . var_export_helper($rhsDef) . ";", $fileContents); file_put_contents($filePath, $out); } } } } //Find the extension file containing the subpanel definition for this relationship foreach (scandir("custom/Extension/modules/{$module}/Ext/Layoutdefs") as $file) { if (substr($file, 0, 1) != "." && strtolower(substr($file, -4)) == ".php") { $layout_defs = array($module => array("subpanel_setup" => array())); $filePath = "custom/Extension/modules/{$module}/Ext/Layoutdefs/{$file}"; include $filePath; foreach ($layout_defs[$module]["subpanel_setup"] as $key => $subDef) { if ($layout_defs[$module]["subpanel_setup"][$key]['get_subpanel_data'] == $relName) { $fileContents = file_get_contents($filePath); $out = preg_replace('/[\'"]get_subpanel_data[\'"]\\s*=>\\s*[\'"]' . $relName . '[\'"],/s', "'get_subpanel_data' => '{$def["join_key_lhs"]}',", $fileContents); file_put_contents($filePath, $out); } } } } } } } }
/** * @see SugarView::display() */ public function display() { // no record, we should also provide a way out if (empty($this->bean->id)) { sugar_die($GLOBALS['app_strings']['ERROR_NO_RECORD']); } // set up Smarty variables $this->ss->assign('BEAN_ID', $this->bean->id); $this->ss->assign('BEAN_NAME', $this->bean->name); $this->ss->assign('MODULE', $this->module); $this->ss->assign('MODULE_NAME', translate('LBL_MODULE_NAME', $this->module)); //Get the fields to display $detailFields = $this->bean_details('WirelessDetailView'); $this->ss->assign('DETAILS', $detailFields); //Of the fields to display, highlight text based on match $matchedFields = $this->setMatchedFields($detailFields); $this->ss->assign('fields', $matchedFields); $this->ss->assign('ENABLE_FORM', $this->checkEditPermissions()); $this->ss->assign('LBL_GS_HELP', $GLOBALS['app_strings']['LBL_GS_HELP']); // display the detail view $file = 'include/MVC/View/tpls/gsdetail.tpl'; if (file_exists('custom/' . $file)) { $this->ss->display('custom/' . $file); } else { $this->ss->display($file); } }
/** * display the form */ public function display() { global $mod_strings, $app_list_strings, $app_strings, $current_user; $error = ""; if (!is_admin($current_user)) { sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); } $fontManager = new FontManager(); if (!$fontManager->listFontFiles()) { $error = implode("<br>", $fontManager->errors); } $this->ss->assign("MODULE_TITLE", getClassicModuleTitle($mod_strings['LBL_MODULE_ID'], array($mod_strings['LBL_FONTMANAGER_TITLE']), false)); if (!empty($_REQUEST['error'])) { $error .= "<br>" . $_REQUEST['error']; } $this->ss->assign("error", $error); $this->ss->assign("MOD", $mod_strings); $this->ss->assign("APP", $app_strings); $this->ss->assign("JAVASCRIPT", $this->_getJS()); if (isset($_REQUEST['return_action'])) { $this->ss->assign("RETURN_ACTION", $_REQUEST['return_action']); } else { $this->ss->assign("RETURN_ACTION", 'SugarpdfSettings'); } $this->ss->assign("K_PATH_FONTS", K_PATH_FONTS); // YUI List $this->ss->assign("COLUMNDEFS", $this->getYuiColumnDefs($fontManager->fontList)); $this->ss->assign("DATASOURCE", $this->getYuiDataSource($fontManager->fontList)); $this->ss->assign("RESPONSESCHEMA", $this->getYuiResponseSchema()); //display $this->ss->display('modules/Configurator/tpls/fontmanager.tpl'); }
/** * display * Override the display method to support customization for the buttons that display * a popup and allow you to copy the account's address into the selected contacts. * The custom_code_billing and custom_code_shipping Smarty variables are found in * include/SugarFields/Fields/Address/DetailView.tpl (default). If it's a English U.S. * locale then it'll use file include/SugarFields/Fields/Address/en_us.DetailView.tpl. */ function display() { if (empty($this->bean->id)) { global $app_strings; sugar_die($app_strings['ERROR_NO_RECORD']); } require_once 'modules/AOS_PDF_Templates/formLetter.php'; formLetter::DVPopupHtml('Accounts'); $this->dv->process(); global $mod_strings; if (ACLController::checkAccess('Contacts', 'edit', true)) { $push_billing = '<input class="button" title="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_LABEL'] . '" type="button" onclick=\'open_contact_popup("Contacts", 600, 600, "&account_name=' . $this->bean->name . '&html=change_address' . '&primary_address_street=' . str_replace(array("\rn", "\r", "\n"), array('', '', '<br>'), urlencode($this->bean->billing_address_street)) . '&primary_address_city=' . $this->bean->billing_address_city . '&primary_address_state=' . $this->bean->billing_address_state . '&primary_address_postalcode=' . $this->bean->billing_address_postalcode . '&primary_address_country=' . $this->bean->billing_address_country . '", true, false);\' value="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_TITLE'] . '">'; $push_shipping = '<input class="button" title="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_LABEL'] . '" type="button" onclick=\'open_contact_popup("Contacts", 600, 600, "&account_name=' . $this->bean->name . '&html=change_address' . '&primary_address_street=' . str_replace(array("\rn", "\r", "\n"), array('', '', '<br>'), urlencode($this->bean->shipping_address_street)) . '&primary_address_city=' . $this->bean->shipping_address_city . '&primary_address_state=' . $this->bean->shipping_address_state . '&primary_address_postalcode=' . $this->bean->shipping_address_postalcode . '&primary_address_country=' . $this->bean->shipping_address_country . '", true, false);\' value="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_TITLE'] . '">'; } else { $push_billing = ''; $push_shipping = ''; } $this->ss->assign("custom_code_billing", $push_billing); $this->ss->assign("custom_code_shipping", $push_shipping); if (empty($this->bean->id)) { global $app_strings; sugar_die($app_strings['ERROR_NO_RECORD']); } echo $this->dv->display(); }
/** * @see SugarView::preDisplay() */ public function preDisplay() { global $current_user, $mod_strings; if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) { sugar_die($mod_strings['LBL_UNAUTH_ACCESS']); } }
function add_create_assigned_user_name() { // global is defined in UsersLastImport.php global $imported_ids; global $current_user; if (empty($this->assigned_user_name)) { return; } $user_name = $this->assigned_user_name; // check if it already exists $focus = new User(); $query = "select * from {$focus->table_name} WHERE user_name='{$user_name}'"; $GLOBALS['log']->info($query); $result = $this->db->query($query) or sugar_die("Error selecting sugarbean: "); $row = $this->db->fetchByAssoc($result, -1, false); // we found a row with that id if (isset($row['id']) && $row['id'] != -1) { // if it exists but was deleted, just remove it entirely if (isset($row['deleted']) && $row['deleted'] == 1) { $query2 = "delete from {$focus->table_name} WHERE id='" . PearDatabase::quote($row['id']) . "'"; $GLOBALS['log']->info($query2); $result2 = $this->db->query($query2) or sugar_die("Error deleting existing sugarbean: "); } else { $focus->id = $row['id']; } } // now just link the account $this->assigned_user_id = $focus->id; $this->modified_user_id = $focus->id; }
public function display() { global $current_user, $current_language, $sugar_flavor, $sugar_config; if (!$current_user->is_admin) { sugar_die(translate("LBL_MUST_BE_ADMIN")); } parent::display(); }
public function preDisplay() { if (!is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Users')) { sugar_die("Unauthorized access to administration."); } $this->lv = new ListViewSmarty(); $this->lv->delete = false; }
public function preDisplay() { //bug #46690: Developer Access to Users/Teams/Roles if (!$GLOBALS['current_user']->isAdminForModule('Users') && !$GLOBALS['current_user']->isDeveloperForModule('Users')) { sugar_die("Unauthorized access to administration."); } parent::preDisplay(); }
public function preProcess() { global $current_user; $workflow_modules = get_workflow_admin_modules_for_user($current_user); if (!is_admin($current_user) && empty($workflow_modules)) { sugar_die("Unauthorized access to WorkFlow."); } }
public function display() { global $current_user; if (!$current_user->is_admin) { sugar_die(translate("LBL_MUST_BE_ADMIN")); } parent::display(); }
public function preProcess() { parent::preProcess(); global $current_user; if (!$current_user->isAdmin()) { sugar_die("Non-admin users are not allowed to access the admin area."); } }
/** * @see SugarView::display() */ public function display() { if (empty($this->bean->id)) { sugar_die($GLOBALS['app_strings']['ERROR_NO_RECORD']); } $this->dv->process(); echo $this->dv->display(); }
function display() { $this->populateTemplates(); $this->setDecodeHTML(); $this->displayPopupHtml(); global $mod_strings; global $app_strings; global $app_list_strings; global $gridline; $detailView = new DetailView(); $offset = 0; if (isset($_REQUEST['offset']) or isset($_REQUEST['record'])) { $result = $detailView->processSugarBean("CONTRACTLIQUIDATE", $this->bean, $offset); if ($result == null) { sugar_die($app_strings['ERROR_NO_RECORD']); } $this->bean = $result; } else { header("Location: index.php?module=ContractLiquidate&action=index"); } if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { $this->bean->id = ""; } global $theme; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; require_once $theme_path . 'layout_utils.php'; $GLOBALS['log']->info("ContractLiquidate detail view"); $this->dv->ss->assign("MOD", $mod_strings); $this->dv->ss->assign("APP", $app_strings); $this->dv->ss->assign("THEME", $theme); $this->dv->ss->assign("GRIDLINE", $gridline ? $gridline : 0); $this->dv->ss->assign("IMAGE_PATH", $image_path); $this->dv->ss->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']); $this->dv->ss->assign("ID", $this->bean->id); $this->dv->ss->assign("ASSIGNED_USER_NAME", $this->bean->assigned_user_name); $this->dv->ss->assign("NAME", $this->bean->name); $this->dv->ss->assign("NUMBER", $this->bean->number); $this->dv->ss->assign("DATE", $this->bean->date); $this->dv->ss->assign("CONTRACT", $this->bean->contract); $this->dv->ss->assign("CONTRACT_ID", $this->bean->contract_id); $this->dv->ss->assign("TONGCONG_CONTRACT_KEHOACH", number_format($this->bean->tongcong_contract_kehoach, '1', '.', '')); $this->dv->ss->assign("TONGCONG_CONTRACT_THUCTE", number_format($this->bean->tongcong_contract_thucte, '1', '.', '')); $this->dv->ss->assign("TONGCONG_TANG_KEHOACH", number_format($this->bean->tongcong_tang_kehoach, '1', '.', '')); $this->dv->ss->assign("TONGCONG_TANG_THUCTE", number_format($this->bean->tongcong_tang_thucte, '1', '.', '')); $this->dv->ss->assign("TONGCONG_GIAM_KEHOACH", number_format($this->bean->tongcong_giam_kehoach, '1', '.', '')); $this->dv->ss->assign("TONGCONG_GIAM_THUCTE", number_format($this->bean->tongcong_giam_thucte, '1', '.', '')); $this->dv->ss->assign("TONGTIEN_KEHOACH", number_format($this->bean->tongtien_kehoach, '1', '.', '')); $this->dv->ss->assign("TONGTIEN_THUCTE", number_format($this->bean->tongtien_thucte, '1', '.', '')); $this->dv->ss->assign("TIENTHANHTOAN", number_format($this->bean->tienthanhtoan, '1', '.', '')); $this->dv->ss->assign("TIENCONLAI", number_format($this->bean->tienconlai, '1', '.', '')); $this->dv->ss->assign("TIENTRALAI", number_format($this->bean->tientralai, '1', '.', '')); $this->dv->ss->assign("GIATRIHOPDONG", $this->bean->giatrihopdong_detail()); $this->dv->ss->assign("PHATSINHTANG", $this->bean->phatsinhtang_detail()); $this->dv->ss->assign("PHATSINHGIAM", $this->bean->phatsinhgiam_detail()); $this->dv->ss->assign("BANGCHU", $this->bean->bangchu); parent::display(); }
public function preDisplay() { if (!$GLOBALS['current_user']->isAdminForModule('Users')) { sugar_die('No Access'); } $this->lv = new ListViewSmarty(); $this->lv->export = false; $this->lv->showMassupdateFields = false; }
public function preDisplay() { global $current_user; if (!is_admin($current_user) && !is_admin_for_module($current_user, 'Forecasts')) { sugar_die("Unauthorized access to administration."); } $this->lv = new ListViewSmarty(); $this->lv->showMassupdateFields = false; }
function action_editview() { if (is_admin($GLOBALS['current_user']) || $_REQUEST['record'] == $GLOBALS['current_user']->id) { $this->view = 'edit'; } else { sugar_die("Unauthorized access to administration."); } return true; }
function display() { if (empty($this->bean->id)) { global $app_strings; sugar_die($app_strings['ERROR_NO_RECORD']); } $this->dv->process(); echo $this->dv->display(false, true); }
public function preDisplay() { if (!is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Users')) { sugar_die('No Access'); } $this->lv = new ListViewSmarty(); $this->lv->export = false; $this->lv->showMassupdateFields = false; }
/** * @see SugarView::preDisplay() */ public function preDisplay() { global $current_user; if (!is_admin($current_user)) { sugar_die("Unauthorized access to administration."); } if (isset($GLOBALS['sugar_config']['hide_admin_backup']) && $GLOBALS['sugar_config']['hide_admin_backup']) { sugar_die("Unauthorized access to backups."); } }