本文整理汇总了PHP中sugar_die函数的典型用法代码示例。如果您正苦于以下问题:PHP sugar_die函数的具体用法?PHP sugar_die怎么用?PHP sugar_die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sugar_die函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDisplay
/**
* @see SugarView::preDisplay()
*/
public function preDisplay()
{
global $current_user;
if (!is_admin($current_user)) {
sugar_die("Unauthorized access to administration.");
}
}
示例2: addActions
/**
* 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");
}
}
示例3: loadBean
/**
* @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;
}
}
示例4: __construct
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;
}
示例5: display
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;
}
示例6: SubPanel
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;
}
}
示例7: process
/**
* @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();
}
示例8: preDisplay
/**
* @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.");
}
}
示例9: preDisplay
public function preDisplay()
{
if (!$this->bean->ACLAccess('edit')) {
ACLController::displayNoAccess();
sugar_die('');
}
}
示例10: preDisplay
public function preDisplay()
{
global $current_user;
if (!is_admin($current_user)) {
sugar_die("No access");
}
}
示例11: upgrade_custom_relationships
/**
* 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);
}
}
}
}
}
}
}
}
示例12: display
/**
* @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);
}
}
示例13: display
/**
* 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');
}
示例14: display
/**
* 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();
}
示例15: preDisplay
/**
* @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']);
}
}