public function getImageLink(&$record, $width = null, $height = null, $ignoreProportions = null, $crop = null, $backgroundColor = null, $keepSmall = null) { $options = $this->getCommonOptions($record); if ($width) { $options[] = 'width'; $options[] = $width; } if ($height) { $options[] = 'height'; $options[] = $height; } if ($ignoreProportions) { $options[] = 'ignoreProportions'; $options[] = $ignoreProportions; } if ($crop) { $options[] = 'crop'; $options[] = $crop; } if ($backgroundColor) { $options[] = 'backgroundColor'; $options[] = $backgroundColor; } if ($keepSmall) { $options[] = 'keepSmall'; $options[] = $keepSmall; } return CoreServices2::getUrl()->createAddress($options); }
public function createHTML(&$record) { $params = array('_m', $record['subpageModule'], '_o', $record['subpageMode']); if ($record['subpageModule'] == 'Subpage' && $record['subpageMode'] == 'Website') { $params = array_merge($params, array('id', $record['id'])); } return CoreServices2::getUrl()->createHTML($params); }
protected function redirectToPage($url, $layoutType) { switch ($layoutType) { case 'standard': CoreUtils::redirect(CoreServices2::getUrl()->createAddress('_m', 'Helper', '_o', 'WebsiteThickboxParentRedirect', 'url', $url)); case 'thickbox': CoreUtils::redirect($url); default: throw new CoreException('Invalid layout type ' . $layoutType); } }
protected function handleRequest() { $this->errorMessageContainer = $this->form->getValidationResults(); if (!$this->errorMessageContainer->isAnyErrorMessage()) { $userEmail = $this->form->getField('userEmail')->getValue(); $record = $this->dao->getActiveUserByEmail($userEmail); if ($record['userState'] != 'active') { $this->errorMessageContainer->addMessage('errorInvalidUserEmail'); } else { $record['userPasswordChangeCode'] = $this->dao->getNewPasswordChangeCode($record); $this->dao->save($record); $this->sendPasswordRecoveryEmail($record); $this->redirectAddress = CoreServices2::getUrl()->getCurrentPageUrl('_sm', 'SendLink'); } } }
protected function initRecord() { $id = CoreServices::get('request')->getFromRequest('id'); if (!empty($id)) { $this->record = $this->dao->getRecordById($id); if (!$this->record['id']) { CoreServices::get('db')->transactionCommit(); CoreUtils::redirect($this->getListPageAddress()); } } else { CoreUtils::redirect(CoreServices2::getUrl()->createAddress('_m', 'Settings', '_o', 'CMSList')); } $this->initMultiselectRelations(); $this->recordOldValues = $this->record; // clone! $this->checkUserPermissionsForRecord(); }
protected function checkHTTPS() { $httpsOn = CoreServices2::getUrl()->isHTTPSOn(); if ($this->getSessionName() == 'CMSSession') { $httpsRequired = CoreConfig::get('Environment', 'httpsForCMS'); } elseif ($this->getSessionName() == 'WebsiteSession') { $httpsRequired = CoreConfig::get('Environment', 'httpsForWebsite'); } else { $httpsRequired = False; // i tak nie ma sesji! } if ($httpsRequired && !$httpsOn) { CoreUtils::redirect(CoreServices::get('url')->getCurrentExactAddress('https')); } if (!$httpsRequired && $httpsOn) { CoreUtils::redirect(CoreServices::get('url')->getCurrentExactAddress('http')); } }
protected function handleLoginForm() { if (!empty($this->currentUser)) { // jeżeli ktoś jest już zalogowany a mimo to trafił na stronę logowania, // to być może chciał na przykład oglądać cudze dane. W takim przypadku // nie można go przekierować tam skąd przyszedł bo prawdopodobnie spowoduje // to zapętlenie przekierowań. Bezpiecznie i sensownie jest skierować // delikwenta na stronę główną. $this->redirectToHomePage(); } else { $this->loginForm = new CoreForm('post', CoreServices2::getUrl()->getCurrentExactAddress(), 'loginForm'); $this->createLoginFormFields(); if ($this->loginForm->isSubmitted()) { $this->addLoginFormValidators(); CoreServices2::getAccess()->logout(); $this->loginForm->setFieldValuesFromRequest(); $this->loginErrorMessageContainer = $this->loginForm->getValidationResults(); if (!$this->loginErrorMessageContainer->isAnyErrorMessage()) { $this->loginAndReload(); } } } }
protected function redirectToStep2() { $this->redirectToPage(CoreServices2::getUrl()->createAddress('_m', 'User', '_o', 'WebsiteRegister2'), 'thickbox'); }
protected function assignDisplayVariables() { $this->display->assign('globalCharset', strtolower(CoreConfig::get('CoreDisplay', 'globalCharset'))); $this->display->assign('url', CoreServices2::getUrl()); }
protected function handleDeleteRequest() { parent::handleDeleteRequest(); $this->setRedirectAddress(CoreServices2::getUrl()->createAddress('_m', 'Home', '_o', 'CMSEdit')); }
protected function getNoPermissionsAddress() { return CoreServices2::getUrl()->createAddress(); }
public function assignDisplayVariables() { parent::assignDisplayVariables(); $display = CoreServices2::getDisplay(); $display->assign('fileUrl', CoreServices2::getAttachmentLocationManager()); $display->assign('subpageUrl', CoreServices::get('websiteMenuManager')); $display->assign('subpage', $this->subpage); $menuStruct = $this->getMenuStruct(); if (!empty($menuStruct)) { $display->assign('menu', $menuStruct); } if (!empty($this->showCancelNewsletterSubscriptionLink)) { $display->assign('showCancelNewsletterSubscriptionLink', 1); } $display->assign('newsletterForm', $this->newsletterForm); $display->assign('bannerList', $this->bannerList); $display->assign('bannerImageList', $this->bannerImageList); $display->assign('loginForm', $this->loginForm); $display->assign('loginErrorMessages', $this->loginErrorMessageContainer); $display->assign('filterForm', $this->filterForm); $display->assign('fullUrl', CoreServices2::getUrl()->getCurrentExactAddress()); $display->assign('paginationForm', $this->paginationForm); }
protected function redirectToHomePage() { $this->redirectToPage(CoreServices2::getUrl()->createAddress(), 'standard'); }
protected function handleRequest() { $this->errorMessageContainer = $this->form->getValidationResults(); if (!$this->errorMessageContainer->isAnyErrorMessage()) { $this->setRecordValuesFromForm(); $this->dao->save($this->record); $this->saveFileLists(); $optimaInterface = Optima_Interface::getInstance(); $optimaInterface->updateUserData($this->record); // Trzeba odświeżyć dane o użytkowniku przechowywane w sesji CoreServices2::getAccess()->logout(); if (!CoreServices2::getAccess()->login($this->record['userEmail'], $this->record['userPassword'])) { throw new CoreException('Unable to refresh user data stored in session'); } else { $this->redirectAddress = CoreServices2::getUrl()->getCurrentPageUrl('_sm', 'Save'); } } }
protected function getFirstAccessiblePage() { $fullMenuStruct = CoreConfig::get('Structure', 'cmsMenu'); $menuStruct = $fullMenuStruct[$this->currentUser['adminRole']]; $firstMenuItem = each($menuStruct); return CoreServices2::getUrl()->createAddress($firstMenuItem['value']); }
protected function handleRequest() { $this->errorMessageContainer = $this->form->getValidationResults(); if (!$this->errorMessageContainer->isAnyErrorMessage()) { if ($this->record['id']) { $this->record['userPasswordChangeCode'] = null; $this->record['userPassword'] = $this->form->getField('userPassword')->getValue(); $this->dao->save($this->record); CoreServices2::getAccess()->login($this->record['userEmail'], $this->record['userPassword']); $this->redirectAddress = CoreServices2::getUrl()->getCurrentPageUrl('_sm', 'Save', 'id', $this->record['id']); } } }