本文整理汇总了PHP中SugarApplication类的典型用法代码示例。如果您正苦于以下问题:PHP SugarApplication类的具体用法?PHP SugarApplication怎么用?PHP SugarApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SugarApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: action_optimise
function action_optimise()
{
set_time_limit(6000);
$index = BeanFactory::getBean("AOD_Index")->getIndex();
$index->optimise();
SugarApplication::redirect('index.php?module=AOD_Index');
}
示例3: oauthLogin
/**
* OAuth Login
*
* @return bool Success or failure
*/
public function oauthLogin()
{
global $sugar_config;
$apiKey = $this->getConnector()->getProperty('oauth_consumer_key');
if (!isset($_REQUEST['code'])) {
$callback = $sugar_config['site_url'] . '/index.php?module=EAPM&action=oauth&record=' . $this->eapmBean->id;
$callback = $this->formatCallbackURL($callback);
$queryData = array('client_id' => $apiKey, 'redirect_uri' => $callback);
SugarApplication::redirect($this->getOauthAuthURL() . '?' . http_build_query($queryData));
} else {
$code = $_REQUEST['code'];
$queryData = array('grant_type' => 'authorization_code', 'code' => $code, 'client_id' => $apiKey);
$accReq = $this->getOauthAccessURL() . '?' . http_build_query($queryData);
$rawResponse = $this->makeRequest($accReq);
if ($rawResponse && $rawResponse->isSuccessful()) {
$response = json_decode($rawResponse->getBody(), true);
if (!empty($response['access_token'])) {
$this->eapmBean->oauth_token = $response['access_token'];
$this->eapmBean->validated = 1;
$this->eapmBean->save();
return true;
}
}
return false;
}
}
示例4: logout
public function logout()
{
session_destroy();
ob_clean();
$this->box->deleteSession();
SugarApplication::redirect($this->box->loginUrl());
}
示例5: action_archived
function action_archived()
{
$this->bean->archived = 'true';
$this->bean->won = '';
$this->bean->save();
SugarApplication::redirect('index.php?module=TILKEE_TILKS&action=DetailView&record=' . $this->bean->id);
}
示例6: pre_login
/**
* pre_login
*
* Override the pre_login function from SugarAuthenticate so that user is
* redirected to SAML entry point if other is not specified
*/
function pre_login()
{
parent::pre_login();
if (empty($_REQUEST['no_saml'])) {
SugarApplication::redirect('?entryPoint=SAML');
}
}
示例7: save
public function save(&$bean, $params, $field, $vardef, $prefix = '')
{
$fakeDisplayParams = array();
$this->fillInOptions($vardef, $fakeDisplayParams);
require_once 'include/upload_file.php';
$upload_file = new UploadFile($prefix . $field . '_file');
//remove file
if (isset($_REQUEST['remove_file_' . $field]) && $params['remove_file_' . $field] == 1) {
$upload_file->unlink_file($bean->{$field});
$bean->{$field} = "";
}
$move = false;
if (isset($_FILES[$prefix . $field . '_file']) && $upload_file->confirm_upload()) {
if ($this->verify_image($upload_file)) {
$bean->{$field} = $upload_file->get_stored_file_name();
$move = true;
} else {
//not valid image.
$GLOBALS['log']->fatal("Image Field : Not a Valid Image.");
$temp = $vardef['vname'];
$temp = translate($temp, $bean->module_name);
SugarApplication::appendErrorMessage($temp . " Field : Not a valid image format.");
}
}
if (empty($bean->id)) {
$bean->id = create_guid();
$bean->new_with_id = true;
}
if ($move) {
$upload_file->final_move($bean->id . '_' . $field);
//BEAN ID IS THE FILE NAME IN THE INSTANCE.
$upload_file->upload_doc($bean, $bean->id, $params[$prefix . $vardef['docType']], $bean->{$field}, $upload_file->mime_type);
} else {
if (!empty($old_id)) {
// It's a duplicate, I think
if (empty($params[$prefix . $vardef['docUrl']])) {
$upload_file->duplicate_file($old_id, $bean->id, $bean->{$field});
} else {
$docType = $vardef['docType'];
$bean->{$docType} = $params[$prefix . $field . '_old_doctype'];
}
} else {
if (!empty($params[$prefix . $field . '_remoteName'])) {
// We aren't moving, we might need to do some remote linking
$displayParams = array();
$this->fillInOptions($vardef, $displayParams);
if (isset($params[$prefix . $vardef['docId']]) && !empty($params[$prefix . $vardef['docId']]) && isset($params[$prefix . $vardef['docType']]) && !empty($params[$prefix . $vardef['docType']])) {
$bean->{$field} = $params[$prefix . $field . '_remoteName'];
require_once 'include/utils/file_utils.php';
$extension = get_file_extension($bean->{$field});
if (!empty($extension)) {
$bean->file_ext = $extension;
$bean->file_mime_type = get_mime_content_type_from_filename($bean->{$field});
}
}
}
}
}
}
示例8: preDisplay
public function preDisplay()
{
?>
<link rel="stylesheet" href="modules/Nexmo/views/style.css" /><?php
if (isset($this->view_object_map['val_error'])) {
SugarApplication::appendErrorMessage($this->view_object_map['val_error']);
}
}
示例9: action_desarchived
function action_desarchived()
{
//$this->bean->status = 'activated';
//$this->bean->won = '';
//$this->bean->save();
$this->bean->update_from_API('', 'false');
SugarApplication::redirect('index.php?module=TILKEE_PROJECTS&action=DetailView&record=' . $this->bean->id);
}
示例10: preDisplay
public function preDisplay()
{
if (!$GLOBALS['current_user']->isAdminForModule('Users')) {
//instead of just dying here with unauthorized access will send the user back to his/her settings
SugarApplication::redirect('index.php?module=Users&action=DetailView&record=' . $GLOBALS['current_user']->id);
}
$this->lv = new ListViewSmarty();
$this->lv->delete = false;
$this->lv->email = false;
}
示例11: display
/**
* @see SugarView::display()
*/
public function display()
{
if (isset($_FILES['vcard']['tmp_name']) && isset($_FILES['vcard']['size']) > 0) {
$vcard = new vCard();
$record = $vcard->importVCard($_FILES['vcard']['tmp_name'], $_REQUEST['module']);
SugarApplication::redirect("index.php?action=DetailView&module={$_REQUEST['module']}&record={$record}");
} else {
SugarApplication::redirect("index.php?action=Importvcard&module={$_REQUEST['module']}");
}
}
示例12: action_generatePdfJava
function action_generatePdfJava()
{
global $mod_string;
$id = $_REQUEST['uid'];
$templateID = $_REQUEST['templateID'];
$path = "/var/www/vhosts/portadainmobiliaria.iatech.com.co/httpdocs/crm/custom/modules/AOS_Contracts/ReportGenerator.jar";
$command = "/usr/bin/java -Djava.awt.headless=true -jar {$path} {$id} {$templateID}";
exec($command, $output);
$this->printRequest($_REQUEST, $path, $id, $templateID, $output, $command);
//SugarApplication::redirect('index.php?entryPoint=download&id='.$id.'&type=Notes');
SugarApplication::redirect('index.php?module=AOS_Contracts&action=DetailView&record=' . $id . '#history');
}
示例13: display
public function display()
{
if (!SugarOAuthServer::enabled()) {
sugar_die($GLOBALS['mod_strings']['LBL_OAUTH_DISABLED']);
}
global $current_user;
if (!isset($_REQUEST['token']) && isset($_REQUEST['oauth_token'])) {
$_REQUEST['token'] = $_REQUEST['oauth_token'];
}
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('APP', $GLOBALS['app_strings']);
$sugar_smarty->assign('MOD', $GLOBALS['mod_strings']);
$sugar_smarty->assign('token', $_REQUEST['token']);
$sugar_smarty->assign('sid', session_id());
$token = OAuthToken::load($_REQUEST['token']);
if (empty($token) || empty($token->consumer) || $token->tstate != OAuthToken::REQUEST || empty($token->consumer_obj)) {
sugar_die('Invalid token');
}
if (empty($_REQUEST['confirm'])) {
$sugar_smarty->assign('consumer', sprintf($GLOBALS['mod_strings']['LBL_OAUTH_CONSUMERREQ'], $token->consumer_obj->name));
// SM: roles disabled for now
// $roles = array('' => '');
// $allroles = ACLRole::getAllRoles();
// foreach($allroles as $role) {
// $roles[$role->id] = $role->name;
// }
// $sugar_smarty->assign('roles', $roles);
$hash = md5(rand());
$_SESSION['oauth_hash'] = $hash;
$sugar_smarty->assign('hash', $hash);
echo $sugar_smarty->fetch('modules/OAuthTokens/tpl/authorize.tpl');
} else {
if ($_REQUEST['sid'] != session_id() || $_SESSION['oauth_hash'] != $_REQUEST['hash']) {
sugar_die('Invalid request');
}
$verify = $token->authorize(array("user" => $current_user->id));
if (!empty($token->callback_url)) {
$redirect_url = $token->callback_url;
if (strchr($redirect_url, "?") !== false) {
$redirect_url .= '&';
} else {
$redirect_url .= '?';
}
$redirect_url .= "oauth_verifier=" . $verify . '&oauth_token=' . $_REQUEST['token'];
SugarApplication::redirect($redirect_url);
}
$sugar_smarty->assign('VERIFY', $verify);
$sugar_smarty->assign('token', '');
echo $sugar_smarty->fetch('modules/OAuthTokens/tpl/authorized.tpl');
}
}
示例14: action_delete
protected function action_delete()
{
if ($_REQUEST['record'] != $GLOBALS['current_user']->id && $GLOBALS['current_user']->isAdminForModule('Users')) {
$u = new User();
$u->retrieve($_REQUEST['record']);
$u->deleted = 1;
$u->status = 'Inactive';
$u->employee_status = 'Terminated';
$u->save();
$GLOBALS['log']->info("User id: {$GLOBALS['current_user']->id} deleted user record: {$_REQUEST['record']}");
SugarApplication::redirect("index.php?module=Employees&action=index");
} else {
sugar_die("Unauthorized access to administration.");
}
}
示例15: action_log_autonote
public function action_log_autonote()
{
//Load a notes bean
$notes_bean = BeanFactory::getBean("Notes");
//Create a new note and save it
$notes_bean->name = "Leads autonote";
$notes_bean->description = "This note is autologged for a lead.";
$note_id = $notes_bean->save();
//Load leads-notes relationship
$lead_bean = BeanFactory::getBean("Leads", $_REQUEST["record"]);
$lead_bean->load_relationship("notes");
//Save relationship record
$lead_bean->notes->add($note_id);
$lead_bean->save();
SugarApplication::redirect('index.php?module=Leads&action=DetailView&record=' . $_REQUEST["record"]);
}