Esempio n. 1
0
 /**
  * Deactivates banner for current user by name.
  * @param string $name Banner name.
  * @return bool
  */
 public static function deactivate($name)
 {
     global $USER;
     if ($USER->getId() <= 0) {
         return false;
     }
     return \CUserOptions::setOption(Driver::INTERNAL_MODULE_ID, '~banner-offer', array($name => true), false, $USER->getId());
 }
Esempio n. 2
0
 protected function processActionDefault()
 {
     if ($this->request->getPost('installDisk')) {
         \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
         $this->sendJsonSuccessResponse();
     }
     if ($this->request->getPost('uninstallDisk')) {
         \Bitrix\Disk\Desktop::setDesktopDiskUninstalled();
         $this->sendJsonSuccessResponse();
     }
     if ($this->request->getPost('reInstallDisk')) {
         \CUserOptions::setOption('disk', 'DesktopDiskReInstall', true, false, $this->getUser()->getId());
         \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
         $this->sendJsonSuccessResponse();
     }
 }
Esempio n. 3
0
 public static function onUserLoginSocserv($params)
 {
     global $USER;
     if ($params['EXTERNAL_AUTH_ID'] === \CSocServBitrix24Net::ID && \Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24')) {
         $notificationOptions = \CUserOptions::getOption("socialservices", "notifications", array());
         $lastDate = 0;
         if (isset($notificationOptions["CONTACTS_NOTIFY_DATE"])) {
             $lastDate = $notificationOptions["CONTACTS_NOTIFY_DATE"];
         }
         if ($lastDate < time() - 86400) {
             static::notifyPossible($USER->getId());
             $notificationOptions["CONTACTS_NOTIFY_DATE"] = time();
             \CUserOptions::setOption("socialservices", "notifications", $notificationOptions);
         }
     }
 }
Esempio n. 4
0
 private function storeViewMode($mode)
 {
     $mode = strtolower($mode);
     if ($mode != 'grid' && $mode != 'tile') {
         $mode = 'grid';
     }
     \CUserOptions::setOption(Driver::INTERNAL_MODULE_ID, 'grid', array('viewMode' => $mode));
 }
Esempio n. 5
0
 /**
  * Stores sort mode for folder list.
  * @param string $mode
  * @return void
  */
 public function storeSortMode($mode)
 {
     $mode = strtolower($mode);
     if ($mode !== self::SORT_MODE_ORDINARY && $mode !== self::SORT_MODE_MIX) {
         $mode = self::SORT_MODE_ORDINARY;
     }
     \CUserOptions::setOption(Driver::INTERNAL_MODULE_ID, 'grid', array('sortMode' => $mode, 'viewMode' => $this->getViewMode()));
 }
Esempio n. 6
0
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
if (!CModule::IncludeModule('webdav')) {
    return;
}
global $USER, $APPLICATION;
if (!$USER->IsAuthorized() || !check_bitrix_sessid() || $_SERVER['REQUEST_METHOD'] != 'POST') {
    return;
}
CUtil::JSPostUnescape();
if ($_POST['installDisk']) {
    CWebDavTools::setDesktopDiskInstalled();
    if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
        \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
    }
    CWebDavTools::sendJsonResponse(array('status' => 'success'));
}
if ($_POST['uninstallDisk']) {
    CWebDavTools::setDesktopDiskUninstalled();
    if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
        \Bitrix\Disk\Desktop::setDesktopDiskUninstalled();
    }
    CWebDavTools::sendJsonResponse(array('status' => 'success'));
}
if ($_POST['reInstallDisk']) {
    CWebDavTools::setDesktopDiskUninstalled();
    if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
        \CUserOptions::setOption('disk', 'DesktopDiskReInstall', true, false, $USER->getId());
        \Bitrix\Disk\Desktop::setDesktopDiskInstalled();
    }
    CWebDavTools::sendJsonResponse(array('status' => 'success'));
}
Esempio n. 7
0
 public static function resetDocumentServiceCode()
 {
     \CUserOptions::setOption(Driver::INTERNAL_MODULE_ID, 'doc_service', array('default' => ''));
 }
 private function saveFirstRun($userId)
 {
     \CUserOptions::setOption(Driver::INTERNAL_MODULE_ID, 'recently_used', array('r' => '1'), false, $userId);
 }
Esempio n. 9
0
 /**
  * Sets option for current user for disk uninstall.
  */
 public static function setDesktopDiskUninstalled()
 {
     global $USER;
     \CUserOptions::setOption(Driver::INTERNAL_MODULE_ID, self::OPT_DESKTOP_DISK_INSTALL, false, false, $USER->getId());
     UserConfiguration::resetDocumentServiceCode();
 }
Esempio n. 10
0
 protected function processActionSaveAjax()
 {
     $this->request->addFilter(new PostDecodeFilter());
     if ($this->request->getQuery('saveuserparams') == 'Y') {
         $serializeValue = serialize($this->request->getPost('USER_PARAMS'));
         if (strlen($serializeValue) > 64000) {
             $response = "\n\t\t\t\t\t<script>\n\t\t\t\t\t\talert('" . Loc::getMessage('BIZPROC_USER_PARAMS_SAVE_ERROR') . "');\n\t\t\t\t\t</script>\n\t\t\t\t";
             $this->sendResponse($response);
         }
         CUserOptions::setOption('~bizprocdesigner', 'activity_settings', $serializeValue);
         $this->getApplication()->restartBuffer();
         $this->end();
     }
     $fields = array('DOCUMENT_TYPE' => $this->arResult['DOCUMENT_COMPLEX_TYPE'], 'AUTO_EXECUTE' => $this->request->getPost('workflowTemplateAutostart'), 'NAME' => $this->request->getPost('workflowTemplateName'), 'DESCRIPTION' => $this->request->getPost('workflowTemplateDescription'), 'TEMPLATE' => $this->request->getPost('arWorkflowTemplate'), 'PARAMETERS' => $this->request->getPost('arWorkflowParameters'), 'VARIABLES' => $this->request->getPost('arWorkflowVariables'), 'CONSTANTS' => $this->request->getPost('arWorkflowConstants'), 'USER_ID' => intval($this->getUser()->getID()), 'MODIFIER_USER' => new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (!is_array($fields["VARIABLES"])) {
         $fields['VARIABLES'] = array();
     }
     if (!is_array($fields["CONSTANTS"])) {
         $fields['CONSTANTS'] = array();
     }
     if ($this->arResult['TEMPLATE'] != $fields['TEMPLATE']) {
         $fields['SYSTEM_CODE'] = '';
     }
     try {
         if ($this->arResult['ID'] > 0) {
             CBPWorkflowTemplateLoader::update($this->arResult['ID'], $fields);
         } else {
             $this->arResult['ID'] = CBPWorkflowTemplateLoader::add($fields);
         }
     } catch (Exception $e) {
         $response = "\n\t\t\t\t<script>\n\t\t\t\t\talert('" . Loc::getMessage('BIZPROC_WFEDIT_SAVE_ERROR') . "\\n " . preg_replace("#\\.\\W?#", ".\\n", AddSlashes(htmlspecialcharsbx($e->getMessage()))) . "');\n\t\t\t\t</script>\n\t\t\t";
         $this->sendResponse($response);
     }
     $response = "\n\t\t\t<script>\n\t\t\t\twindow.location = '" . ($this->request->getQuery('apply') == 'Y' ? str_replace('#ID#', $this->arResult['ID'], $this->arResult['EDIT_PAGE_TEMPLATE']) : CUtil::JSEscape($this->arResult['LIST_PAGE_URL'])) . "';\n\t\t\t</script>\n\t\t";
     $this->sendResponse($response);
 }