Ejemplo n.º 1
1
 function process()
 {
     if (!is_admin($GLOBALS['current_user']) && in_array($this->action, $this->admin_actions)) {
         $this->hasAccess = false;
     }
     parent::process();
 }
 /**
  * Obtain an instance of the correct controller.
  * 
  * @return an instance of SugarController
  */
 function getController($module)
 {
     $class = ucfirst($module) . 'Controller';
     if (file_exists('custom/modules/' . $module . '/controller.php')) {
         $customClass = 'Custom' . $class;
         require_once 'custom/modules/' . $module . '/controller.php';
         if (class_exists($customClass)) {
             $controller = new $customClass();
         } else {
             if (class_exists($class)) {
                 $controller = new $class();
             }
         }
     } elseif (file_exists('modules/' . $module . '/controller.php')) {
         require_once 'modules/' . $module . '/controller.php';
         if (class_exists($class)) {
             $controller = new $class();
         }
     } else {
         $controller = new SugarController();
     }
     //setup the controller
     $controller->setup($module);
     return $controller;
 }
Ejemplo n.º 3
0
 /**
  * Perform execution of the application. This method is called from index2.php
  *
  * @param Request $request
  */
 function execute(Request $request)
 {
     global $sugar_config;
     if (!empty($sugar_config['default_module'])) {
         $this->default_module = $sugar_config['default_module'];
     }
     $module = $this->default_module;
     if (!empty($_REQUEST['module'])) {
         $module = $_REQUEST['module'];
     }
     insert_charset_header();
     $this->setupPrint();
     $this->controller = ControllerFactory::getController($module);
     // if the entry point is defined to not need auth, then don't authenicate
     if (!$request->has('entryPoint') || $this->controller->checkEntryPointRequiresAuth($request->query('entryPoint'))) {
         $this->loadUser();
         $this->ACLFilter();
         $this->preProcess();
         $this->getController()->preProcess();
         $this->checkHTTPReferer();
     }
     SugarThemeRegistry::buildRegistry();
     $this->loadLanguages();
     $this->checkDatabaseVersion();
     $this->loadDisplaySettings();
     $this->loadLicense();
     $this->loadGlobals();
     $this->setupResourceManagement($module);
     $this->getController()->execute();
     sugar_cleanup();
 }
Ejemplo n.º 4
0
 public function pre_save()
 {
     require_once 'include/upload_file.php';
     $upload_file = new UploadFile('filename_file');
     if (isset($_FILES['filename_file']) && $upload_file->confirm_upload()) {
         $filename = $upload_file->get_stored_file_name();
         $file_ext = $upload_file->file_ext;
         if (empty($this->bean->id)) {
             $this->bean->id = create_guid();
             $this->bean->new_with_id = true;
         }
         $account = null;
         if (isset($_POST['xphotobucketaccount_id'])) {
             $account = BeanFactory::getBean('xPhotobucketAccounts', $_POST['xphotobucketaccount_id']);
         }
         // $resp = $account->upload_media('image', $upload_file->temp_file_location, "{$this->bean->id}.{$file_ext}", $_POST['name']);
         $resp = $account->upload_media('base64', base64_encode(file_get_contents($upload_file->temp_file_location)), "{$this->bean->id}.{$file_ext}", $_POST['name']);
         $this->bean->browse_url = $resp['browseurl'];
         $this->bean->image_url = $resp['url'];
         $this->bean->thumb_url = $resp['thumb'];
     } else {
         echo "Upload file error";
         sugar_cleanup(true);
     }
     parent::pre_save();
 }
Ejemplo n.º 5
0
 public function process()
 {
     if (!is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Contracts')) {
         $this->hasAccess = false;
     }
     parent::process();
 }
Ejemplo n.º 6
0
 public function process()
 {
     if (!is_admin($GLOBALS['current_user'])) {
         $this->hasAccess = false;
     }
     parent::process();
 }
 function action_listview()
 {
     if ($_REQUEST['state_in_chart']) {
         $this->correctStateFilterFromChart();
     }
     parent::action_listview();
 }
Ejemplo n.º 8
0
 function display()
 {
     $this->dv->process();
     echo '<style type="text/css">@import url("custom/modules/ACLRoles/styles/securitygroups.css"); </style>';
     $file = SugarController::getActionFilename($this->action);
     $this->includeClassicFile('modules/' . $this->module . '/' . $file . '.php');
 }
 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.");
     }
 }
Ejemplo n.º 10
0
 /**
  * Obtain an instance of the correct controller.
  *
  * @return an instance of SugarController
  */
 function getController($module)
 {
     if (SugarAutoLoader::requireWithCustom("modules/{$module}/controller.php")) {
         $class = SugarAutoLoader::customClass(ucfirst($module) . 'Controller');
     } else {
         SugarAutoLoader::requireWithCustom('include/MVC/Controller/SugarController.php');
         $class = SugarAutoLoader::customClass('SugarController');
     }
     if (class_exists($class, false)) {
         $controller = new $class();
     }
     if (empty($controller)) {
         $controller = new SugarController();
     }
     //setup the controller
     $controller->setup($module);
     return $controller;
 }
Ejemplo n.º 11
0
 protected function post_delete()
 {
     if (!empty($_REQUEST['return_url'])) {
         $_REQUEST['return_url'] = urldecode($_REQUEST['return_url']);
         $this->redirect_url = $_REQUEST['return_url'];
     } else {
         parent::post_delete();
     }
 }
Ejemplo n.º 12
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     // Call SugarController::getActionFilename to handle case sensitive file names
     $file = SugarController::getActionFilename($this->action);
     $classic = SugarAutoLoader::existingCustomOne('modules/' . $this->module . '/' . $file . '.php');
     if ($classic) {
         $this->includeClassicFile($classic);
         return true;
     }
     return false;
 }
Ejemplo n.º 13
0
 function process()
 {
     $GLOBALS['log']->info(get_class($this) . ":");
     global $current_user;
     $access = $current_user->getDeveloperModules();
     if ($current_user->isAdmin() || $current_user->isDeveloperForAnyModule() && !isset($_REQUEST['view_module']) && (isset($_REQUEST['action']) && $_REQUEST['action'] != 'package') || isset($_REQUEST['view_module']) && (in_array($_REQUEST['view_module'], $access) || empty($_REQUEST['view_module'])) || isset($_REQUEST['type']) && ($_REQUEST['type'] == 'dropdowns' && $current_user->isDeveloperForAnyModule() || $_REQUEST['type'] == 'studio' && displayStudioForCurrentUser() == true)) {
         $this->hasAccess = true;
     } else {
         $this->hasAccess = false;
     }
     parent::process();
 }
Ejemplo n.º 14
0
 function process()
 {
     $GLOBALS['log']->info(get_class($this) . ":");
     global $current_user;
     $access = get_admin_modules_for_user($current_user);
     if (is_admin($current_user) || is_admin_for_any_module($current_user) && !isset($_REQUEST['view_module']) && (isset($_REQUEST['action']) && $_REQUEST['action'] != 'package') || isset($_REQUEST['view_module']) && (in_array($_REQUEST['view_module'], $access) || empty($_REQUEST['view_module'])) || isset($_REQUEST['type']) && ($_REQUEST['type'] == 'dropdowns' && is_admin_for_any_module($current_user) || $_REQUEST['type'] == 'studio' && displayStudioForCurrentUser() == true)) {
         $this->hasAccess = true;
     } else {
         $this->hasAccess = false;
     }
     parent::process();
 }
Ejemplo n.º 15
0
 function process()
 {
     if (isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'basic_search') {
         $this->modifySearch('subject_basic');
         $this->modifySearch('description_basic');
     } else {
         if (isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
             $this->modifySearch('name_advanced');
             $this->modifySearch('description_advanced');
         }
     }
     parent::process();
 }
Ejemplo n.º 16
0
 function process()
 {
     $GLOBALS['log']->info(get_class($this) . ":");
     global $current_user;
     $access = get_admin_modules_for_user($current_user);
     //Non admins can still execute functions
     if (!empty($_REQUEST['action']) && in_array($_REQUEST['action'], $this->non_admin_actions) || $this->isModuleAdmin($access)) {
         $this->hasAccess = true;
     } else {
         $this->hasAccess = false;
     }
     parent::process();
 }
Ejemplo n.º 17
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     // Call SugarController::getActionFilename to handle case sensitive file names
     $file = SugarController::getActionFilename($this->action);
     if (file_exists('custom/modules/' . $this->module . '/' . $file . '.php')) {
         $this->includeClassicFile('custom/modules/' . $this->module . '/' . $file . '.php');
         return true;
     } elseif (file_exists('modules/' . $this->module . '/' . $file . '.php')) {
         $this->includeClassicFile('modules/' . $this->module . '/' . $file . '.php');
         return true;
     }
     return false;
 }
Ejemplo n.º 18
0
 public function process()
 {
     if ($this->action == 'EditView' && empty($_REQUEST['record'])) {
         $this->action = 'WizardHome';
     } else {
         if ($this->action == 'EditView' && !empty($_REQUEST['record'])) {
             // Show Send Email and Summary
             $this->action = 'WizardHome';
             // modules/Campaigns/WizardHome.php isWizardSummary
             $_REQUEST['action'] = 'WizardHome';
         }
     }
     parent::process();
 }
Ejemplo n.º 19
0
 public function pre_save()
 {
     if (!empty($_REQUEST['session_id'])) {
         $x = new FetchToken();
         $res = $x->dispatchCall(array('SessionID' => $_REQUEST['session_id']));
         if ($res !== false) {
             $this->bean->ebay_auth_token = $res['AuthToken'];
             $this->bean->hard_expiration_time = $res['ExpireTime'];
         } else {
             sugar_cleanup(true);
         }
     }
     parent::pre_save();
 }
Ejemplo n.º 20
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     if ($this->bean instanceof SugarBean && isset($this->view_object_map['remap_action']) && !$this->bean->ACLAccess($this->view_object_map['remap_action'])) {
         ACLController::displayNoAccess(true);
         return false;
     }
     // Call SugarController::getActionFilename to handle case sensitive file names
     $file = SugarController::getActionFilename($this->action);
     $classic_file = SugarAutoLoader::existingCustomOne('modules/' . $this->module . '/' . $file . '.php');
     if ($classic_file) {
         $this->includeClassicFile($classic_file);
         return true;
     }
     return false;
 }
 public function pre_save()
 {
     parent::pre_save();
     require_once 'modules/Workflows/includes/WorkflowBaseAction.php';
     if (isset($this->bean->accion) && isset($this->record)) {
         $accion = WorkflowBaseAction::obtener_accion_por_nombre($this->bean->accion);
         try {
             $accion->verificar_parametros($this->bean->parametros);
         } catch (Exception $e) {
             sugar_set_message("No se encontraron los parametros: " . implode(', ', $accion->parametros_requeridos()) . "; para la acción: {$accion->nombre}. No se Guardaron los cambios", "error");
             $args = array('module' => $this->module, 'action' => "EditView", 'record' => $this->record);
             $this->set_redirect(create_url($args));
             $this->redirect();
             die;
         }
     }
 }
Ejemplo n.º 22
0
 function action_save()
 {
     if (empty($this->bean->id)) {
         parent::action_save();
     }
     $this->removeCategories();
     // NOTE: call from_html _before_ calling $json->decode... WTF!
     $json = getJSONobj();
     // workaround for #276
     $hiddenFieldContent = $_POST['categoryHiddenField'];
     if (!empty($hiddenFieldContent)) {
         $categoryHiddenField = $json->decode(from_html($hiddenFieldContent));
         //$GLOBALS['log']->error("product catalog tree structure: ". var_export($categoryHiddenField,true));
         // for each category store its subcategories in the subcategories attribute (saveCategories()) and store the ids of the root categories in the category_ids fields of the product catalog
         $this->bean->category_ids = implode(' ', $this->saveCategories($categoryHiddenField));
     } else {
         $GLOBALS['log']->warn("field 'item' which is neccessary for creating category structure does not exist");
     }
     parent::action_save();
 }
Ejemplo n.º 23
0
 protected function callLegacyCode()
 {
     if (strtolower($this->do_action) == 'convertlead') {
         if (file_exists('modules/Leads/ConvertLead.php') && !file_exists('custom/modules/Leads/metadata/convertdefs.php')) {
             if (!empty($_REQUEST['emailAddressWidget'])) {
                 foreach ($_REQUEST as $key => $value) {
                     if (preg_match('/^Leads.*?emailAddress[\\d]+$/', $key)) {
                         $_REQUEST['Leads_email_widget_id'] = 0;
                         break;
                     }
                 }
             }
             $this->action_default();
             $this->_processed = true;
         } else {
             $this->view = 'convertlead';
             $this->_processed = true;
         }
     } else {
         parent::callLegacyCode();
     }
 }
Ejemplo n.º 24
0
 function action_save()
 {
     $old_id = null;
     $isLinked = false;
     if (isset($_POST['isLinked'])) {
         $isLinked = $_POST['isLinked'] == 'true' ? true : false;
     }
     // create new version of Addition and update Contract idsofadditions field	since we are creating new version of Addition
     if (!$isLinked && !empty($this->bean->contractid)) {
         if (!$this->bean->is_latest) {
             $latestVersion = $this->bean->getLatestRevision();
             $old_id = $latestVersion->id;
             $this->bean->version = intval($latestVersion->version + 1);
         } else {
             $old_id = $this->bean->id;
             $this->bean->version = intval($this->bean->version + 1);
         }
         //$GLOBALS['log']->fatal('going branch 1');
         unset($this->bean->id);
         unset($this->bean->{$this->bean->table_name . '_number'});
         $this->bean->deleted = 0;
         $this->bean->nextrevisions = '';
         $this->bean->is_latest = 1;
         //1.7.6
         $this->bean->previousrevision = $old_id;
         SugarController::action_save();
         //retrieve saved bean for oqc...number that is created during save
         $oqc_fld_number = $this->bean->table_name . '_number';
         $savedBean = new $this->bean->object_name();
         if ($savedBean->retrieve($this->bean->id)) {
             $this->bean->{$oqc_fld_number} = intval($savedBean->{$oqc_fld_number});
         }
         // 1.7.6 Keep generated svnumber for all future references
         if (empty($this->bean->svnumber)) {
             $this->bean->fill_in_svnumber();
         }
         $this->bean->oqc_delete_relationships($this->bean->id);
         // deleting documents and services- will be recreated during save
         //Recreate relationship to original contract
         $contract = 'oqc_contract';
         $this->bean->load_relationship($contract);
         $this->bean->oqc_contract->add($this->bean->contractid);
         //Update idsofadditions linked of contract
         $linkedContract = new oqc_Contract();
         if ($linkedContract->retrieve($this->bean->contractid)) {
             $linkedContract->idsofadditions = str_replace($old_id, $this->bean->id, $linkedContract->idsofadditions);
             $linkedContract->save();
         }
     } elseif ($isLinked) {
         if ($this->bean->deleted == 1) {
             $this->bean->mark_undeleted($this->bean->id);
         }
         $this->bean->deleted = 0;
         $this->bean->is_latest = 1;
         //$GLOBALS['log']->fatal('going branch 3');
         //retrieve saved bean for oqc...number that is created during save
         $oqc_fld_number = $this->bean->table_name . '_number';
         $savedBean = new $this->bean->object_name();
         if ($savedBean->retrieve($this->bean->id)) {
             $this->bean->{$oqc_fld_number} = intval($savedBean->{$oqc_fld_number});
         }
         // 1.7.6 Keep generated svnumber for all future references
         if (empty($this->bean->svnumber)) {
             $this->bean->fill_in_svnumber();
         }
         $this->bean->oqc_delete_relationships($this->bean->id);
         // deleting documents and services- will be recreated during save
         //Recreate relationship to original contract
         $contract = 'oqc_contract';
         $this->bean->load_relationship($contract);
         $this->bean->oqc_contract->add($this->bean->contractid);
         // Add new addition to the list of idsofadditions
         $linkedContract = new oqc_Contract();
         if ($linkedContract->retrieve($this->bean->contractid)) {
             $linkedContract->idsofadditions = $linkedContract->idsofadditions . " " . $this->bean->id;
             $linkedContract->save();
         }
     }
     if (isset($_POST['servicesVAT'])) {
         $this->bean->vat = $_POST['servicesVAT'];
     } else {
         if (isset($_POST['servicesOnceVAT'])) {
             $this->bean->vat = $_POST['servicesOnceVAT'];
         }
     }
     $this->saveAttachedDocuments();
     $this->saveTextblocks();
     $this->saveServices();
     if (!isset($_POST['assigned_user_id'])) {
         $this->bean->assigned_user_id = $this->bean->created_by;
     }
     //2.1 set this only if it is not in $_POST
     SugarController::action_save();
     // redirect to new version
     $this->return_id = $this->bean->id;
     $this->return_module = $this->module;
     // If previous version exist, hide it and update nextrevision field
     if ($old_id != '') {
         $oldBean = new $this->bean->object_name();
         if ($oldBean->retrieve($old_id)) {
             $oldBean->addNextRevisionId($this->bean->id);
             $oldBean->save();
             $this->bean->oqc_mark_deleted($old_id);
             //1.7.6
         }
     }
 }
Ejemplo n.º 25
0
 /**
  * Constructor
  */
 function __construct()
 {
     parent::__construct();
     // Admin Config Setting
     $this->configuration();
 }
Ejemplo n.º 26
0
 function MailMergeController()
 {
     parent::SugarController();
 }
Ejemplo n.º 27
0
 function action_save()
 {
     $isDuplicate = empty($_REQUEST['record']) && empty($_REQUEST['return_id']);
     // check if there are any modifications
     $modified = hasBeenModified($this->bean, array());
     if (!$isDuplicate && !$modified) {
         return;
         // skip save if this is not a duplicate and nothing been modified
     }
     //2.0 We determine to what catalog category belongs
     if (!empty($this->bean->relatedcategory_id)) {
         $category = new oqc_Category();
         if ($category->retrieve($this->bean->relatedcategory_id)) {
             $this->bean->catalog_id = $category->catalog_id;
         }
     }
     // save id of user that created the old version
     global $timedate;
     $dateCreated = $timedate->to_db($this->bean->date_entered);
     $createdById = $this->bean->created_by;
     $old_id = $this->begin_new_version();
     parent::action_save();
     $this->end_new_version($old_id);
     $this->initializeUniqueIdentifier();
     $this->save_packaged_products();
     $this->saveAttachedDocuments();
     $this->saveProductOptions();
     $this->saveImageWithResize();
     $this->updateRelatedProducts($old_id);
     //$GLOBALS['log']->error("Dates are: ". $this->bean->date_entered );
     // the new contract should have the same creator and creation date as the previous version, fix for #486
     if ($dateCreated) {
         $this->bean->date_entered = $dateCreated;
     }
     if ($createdById) {
         $this->bean->created_by = $createdById;
     }
     if (!isset($_POST['assigned_user_id'])) {
         $this->bean->assigned_user_id = $this->bean->created_by;
     }
     //2.1 set this only if it is not in $_POST
     parent::action_save();
 }
 public function KReportsController()
 {
     ini_set('display_errors', '0');
     parent::SugarController();
 }
Ejemplo n.º 29
0
 public function process() {
     if($this->action == 'EditView' && empty($_REQUEST['record'])) {
         $this->action = 'WizardHome';
     }
     parent::process();
 }
Ejemplo n.º 30
0
 function EmployeesController()
 {
     parent::SugarController();
 }