本文整理汇总了PHP中Cx\Core\Csrf\Controller\Csrf::header方法的典型用法代码示例。如果您正苦于以下问题:PHP Csrf::header方法的具体用法?PHP Csrf::header怎么用?PHP Csrf::header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Csrf\Controller\Csrf
的用法示例。
在下文中一共展示了Csrf::header方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Load your component.
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $objTemplate, $sessionObj;
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
if (!isset($sessionObj) || !is_object($sessionObj)) {
$sessionObj = \cmsSession::getInstance();
}
$objLogin = new \Cx\Core_Modules\Login\Controller\Login(\Env::get('cx')->getPage()->getContent());
$pageTitle = \Env::get('cx')->getPage()->getTitle();
$pageMetaTitle = \Env::get('cx')->getPage()->getMetatitle();
\Env::get('cx')->getPage()->setContent($objLogin->getContent($pageMetaTitle, $pageTitle));
break;
case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
if (\FWUser::getFWUserObject()->objUser->login(true)) {
\Cx\Core\Csrf\Controller\Csrf::header('location: index.php');
}
$this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
$objTemplate = $this->cx->getTemplate();
$objLoginManager = new \Cx\Core_Modules\Login\Controller\LoginManager();
$objLoginManager->getPage();
break;
default:
break;
}
}
示例2: login
/**
* Login to facebook and get the associated cloudrexx user.
*/
public function login()
{
$client = new \Google_Client();
$client->setApplicationName('Contrexx Login');
$client->setClientId($this->applicationData[0]);
$client->setClientSecret($this->applicationData[1]);
$client->setRedirectUri(\Cx\Lib\SocialLogin::getLoginUrl(self::OAUTH_PROVIDER));
$client->setDeveloperKey($this->applicationData[2]);
$client->setUseObjects(true);
$client->setApprovalPrompt('auto');
$client->setScopes(self::$scopes);
self::$google = new \Google_Oauth2Service($client);
self::$googleplus = new \Google_PlusService($client);
if (isset($_GET['code'])) {
try {
$client->authenticate();
} catch (\Google_AuthException $e) {
}
}
if (!$client->getAccessToken()) {
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . $client->createAuthUrl());
exit;
}
self::$userdata = $this->getUserData();
$this->getContrexxUser(self::$userdata['oauth_id']);
}
示例3: _downloadMediaOLD
/**
* downloads the media
*
* act: download
*/
function _downloadMediaOLD()
{
if (is_file($this->path . $this->getFile)) {
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . $this->webPath . $this->getFile);
exit;
}
}
示例4: preResolve
public function preResolve(\Cx\Core\Routing\Url $url)
{
if ($this->cx->getMode() != \Cx\Core\Core\Controller\Cx::MODE_FRONTEND) {
return;
}
$em = $this->cx->getDb()->getEntityManager();
$rewriteRuleRepo = $em->getRepository($this->getNamespace() . '\\Model\\Entity\\RewriteRule');
$rewriteRules = $rewriteRuleRepo->findAll(array(), array('order' => 'asc'));
$last = false;
$originalUrl = clone $url;
foreach ($rewriteRules as $rewriteRule) {
try {
$url = $rewriteRule->resolve($url, $last);
} catch (\Exception $e) {
// This is thrown if the regex of the rule is not valid
}
if ($last) {
break;
}
}
if ($originalUrl->toString() != $url->toString()) {
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . $url->toString(), true, $rewriteRule->getRewriteStatusCode());
die;
}
}
示例5: login
/**
* Login to facebook and get the associated contrexx user.
*/
public function login()
{
// fixing timestamp issue with twitter
// it is necessary that the twitter server has the same time as our system
date_default_timezone_set('UTC');
$tmhOAuth = new \tmhOAuth(array('consumer_key' => $this->applicationData[0], 'consumer_secret' => $this->applicationData[1]));
// set the timestamp
$tmhOAuth->config['force_timestamp'] = true;
$tmhOAuth->config['timestamp'] = time();
if (isset($_GET['oauth_verifier'])) {
$tmhOAuth->config['user_token'] = $_SESSION['oauth']['oauth_token'];
$tmhOAuth->config['user_secret'] = $_SESSION['oauth']['oauth_token_secret'];
$tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array('oauth_verifier' => $_GET['oauth_verifier'], 'x_auth_access_type' => 'read'));
$access_token = $tmhOAuth->extract_params($tmhOAuth->response['response']);
$tmhOAuth->config['user_token'] = $access_token['oauth_token'];
$tmhOAuth->config['user_secret'] = $access_token['oauth_token_secret'];
$tmhOAuth->request('GET', $tmhOAuth->url('1.1/account/verify_credentials'));
$resp = json_decode($tmhOAuth->response['response']);
unset($_SESSION['oauth']);
$name = explode(' ', $resp->name);
self::$userdata = array('first_name' => $name[0], 'last_name' => $name[1], 'email' => $resp->screen_name . '@twitter.com');
$this->getContrexxUser($resp->id);
} else {
$tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ""), array('oauth_callback' => \Cx\Lib\SocialLogin::getLoginUrl(self::OAUTH_PROVIDER)));
$_SESSION['oauth'] = $tmhOAuth->extract_params($tmhOAuth->response['response']);
$url = 'https://api.twitter.com/oauth/authenticate?oauth_token=' . $_SESSION['oauth']['oauth_token'];
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . $url);
exit;
}
}
示例6: noAccess
/**
* Redirects the browser to the noaccess webpage.
*
* @return void
*/
public static function noAccess($redirect = null)
{
global $objInit;
$objFWUser = FWUser::getFWUserObject();
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . CONTREXX_DIRECTORY_INDEX . '?' . ($objInit->mode == 'backend' ? '' : 'section=Login&' . (!empty($redirect) ? 'redirect=' . $redirect . '&' : '')) . ($objFWUser->objUser->login() ? 'cmd=noaccess' : ''));
exit;
}
示例7: login
/**
* Login to facebook and get the associated contrexx user.
*/
public function login()
{
self::$facebook = new \Facebook(array('appId' => $this->applicationData[0], 'secret' => $this->applicationData[1]));
$user = self::$facebook->getUser();
if (empty($user) && empty($_GET["state"])) {
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . self::$facebook->getLoginUrl(array('scope' => self::$permissions)));
exit;
}
self::$userdata = $this->getUserData();
$this->getContrexxUser($user);
}
示例8: getDetails
/**
* Entry details
* @global array
* @global ADONewConnection
* @global array
* @return string parsed content
*/
function getDetails()
{
global $objDatabase, $_ARRAYLANG;
$this->_objTpl->setTemplate($this->pageContent);
// Global module index for clones
$this->_objTpl->setGlobalVariable('MODULE_INDEX', MODULE_INDEX);
$id = intval($_GET['id']);
if ($id <= 0) {
\Cx\Core\Csrf\Controller\Csrf::header("Location: ?section=DocSys" . MODULE_INDEX);
exit;
}
$query = "\n SELECT id, source, changelog, url1, url2,\n text, date, changelog, title, author\n FROM " . DBPREFIX . "module_docsys" . MODULE_INDEX . "\n WHERE status = 1\n AND id = {$id}\n AND lang={$this->langId}\n AND (startdate<=" . time() . " OR startdate=0)\n AND (enddate>=" . time() . " OR enddate=0)";
$objResult = $objDatabase->SelectLimit($query, 1);
while ($objResult && !$objResult->EOF) {
$lastUpdate = stripslashes($objResult->fields['changelog']);
$date = stripslashes($objResult->fields['date']);
$source = stripslashes($objResult->fields['source']);
$url1 = stripslashes($objResult->fields['url1']);
$url2 = stripslashes($objResult->fields['url2']);
$docUrl = "";
$docSource = "";
$docLastUpdate = "";
if (!empty($url1)) {
$docUrl = $_ARRAYLANG['TXT_IMPORTANT_HYPERLINKS'] . '<br /><a target="new" href="' . $url1 . '" title="' . $url1 . '">' . $url1 . '</a><br />';
}
if (!empty($url2)) {
$docUrl .= '<a target="new" href="' . $url2 . '">' . $url2 . '</a><br />';
}
if (!empty($source)) {
$docSource = $_ARRAYLANG['TXT_SOURCE'] . '<br /><a target="new" href="' . $source . '" title="' . $source . '">' . $source . '</a><br />';
}
if (!empty($lastUpdate) and $lastUpdate != $date) {
$docLastUpdate = $_ARRAYLANG['TXT_LAST_UPDATE'] . "<br />" . date(ASCMS_DATE_FORMAT, $lastUpdate);
}
$title = $objResult->fields['title'];
$this->_objTpl->setVariable(array('DOCSYS_DATE' => date(ASCMS_DATE_FORMAT, $date), 'DOCSYS_TITLE' => stripslashes($title), 'DOCSYS_AUTHOR' => stripslashes($objResult->fields['author']), 'DOCSYS_TEXT' => stripslashes($objResult->fields['text']), 'DOCSYS_LASTUPDATE' => $docLastUpdate, 'DOCSYS_SOURCE' => $docSource, 'DOCSYS_URL' => $docUrl));
$objResult->MoveNext();
}
$this->docSysTitle = strip_tags(stripslashes($title));
return $this->_objTpl->get();
}
示例9: getDetails
/**
* Gets the news details
*
* @global array $_CONFIG
* @global array $_ARRAYLANG
* @global object $objDatabase
* @return string parsed content
*/
function getDetails()
{
global $_CONFIG, $objDatabase, $_ARRAYLANG;
$this->_objTpl->setTemplate($this->pageContent);
$id = intval($_GET['id']);
/**
*
* First get Settings and build footnote
*
*/
$footnotetext = "";
$footnotelink = "";
$footnote = "";
$link = "";
$url = "";
if ($id > 0) {
$query = "SELECT *\n\t FROM `" . DBPREFIX . "module_jobs_settings`\n\t WHERE name = 'footnote'\n\t OR name = 'link'\n\t OR name = 'url'\n\t ";
$objResult = $objDatabase->Execute($query);
while (!$objResult->EOF) {
if ($objResult->fields['name'] == "footnote") {
$footnote = stripslashes($objResult->fields['value']);
} elseif ($objResult->fields['name'] == "link") {
$link = stripslashes($objResult->fields['value']);
} elseif ($objResult->fields['name'] == "url") {
$url = stripslashes($objResult->fields['value']);
}
$objResult->movenext();
}
}
$this->_objTpl->setVariable(array('TXT_JOBS_AUTOR' => $_ARRAYLANG['TXT_JOBS_AUTOR'], 'TXT_JOBS_WORKLOC' => $_ARRAYLANG['TXT_JOBS_WORKLOC'], 'TXT_JOBS_WORK_START' => $_ARRAYLANG['TXT_JOBS_WORK_START'], 'TXT_JOBS_WORKLOAD' => $_ARRAYLANG['TXT_JOBS_WORKLOAD'], 'TXT_JOBS_PUBLISHED_AT' => $_ARRAYLANG['TXT_JOBS_PUBLISHED_AT']));
if ($id > 0) {
$query = "SELECT id,\n workloc,\n changelog,\n workload,\n work_start,\n text,\n date,\n changelog,\n title,\n author\n FROM " . DBPREFIX . "module_jobs\n WHERE status = 1\n AND id = {$id}\n AND lang=" . $this->langId . "\n AND (startdate<='" . date('Y-m-d') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d') . "' OR enddate='0000-00-00 00:00:00')";
$objResult = $objDatabase->SelectLimit($query, 1);
while (!$objResult->EOF) {
$lastUpdate = stripslashes($objResult->fields['changelog']);
$date = stripslashes($objResult->fields['date']);
$workloc = stripslashes($objResult->fields['workloc']);
$workload = stripslashes($objResult->fields['workload']);
$work_start = stripslashes($objResult->fields['work_start']);
if (empty($work_start) or time() >= $work_start) {
$work_start = $_ARRAYLANG['TXT_JOBS_WORK_START_NOW'];
} else {
$work_start = date("d.m.Y", $work_start);
}
$docLastUpdate = "";
if (!empty($lastUpdate) and $lastUpdate != $date) {
$this->_objTpl->setVariable(array('TXT_JOBS_LASTUPDATE' => $_ARRAYLANG['TXT_JOBS_LASTUPDATE'], 'JOBS_LASTUPDATE' => date(ASCMS_DATE_FORMAT, $lastUpdate)));
}
$title = stripslashes($objResult->fields['title']);
/*
* Replace self defined placeholders in $url
*/
if (!empty($footnote)) {
$footnotetext = nl2br($footnote);
}
if (!empty($link)) {
$url = str_replace("%URL%", urlencode($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']), $url);
$url = htmlspecialchars(str_replace("%TITLE%", urlencode(stripslashes($title)), $url), ENT_QUOTES, CONTREXX_CHARSET);
$footnotelink = "<a href='{$url}'>{$link}</a>";
}
$this->_objTpl->setVariable(array('JOBS_DATE' => date(ASCMS_DATE_FORMAT, $date), 'JOBS_TITLE' => stripslashes($title), 'JOBS_AUTHOR' => stripslashes($objResult->fields['author']), 'JOBS_TEXT' => stripslashes($objResult->fields['text']), 'JOBS_FOOTNOTE' => $footnotetext, 'JOBS_FOOTNOTE_LINK' => $footnotelink, 'JOBS_WORKLOC' => $workloc, 'JOBS_WORKLOAD' => $workload, 'JOBS_WORK_START' => $work_start));
$objResult->MoveNext();
}
} else {
\Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?section=Jobs");
exit;
}
$this->jobsTitle = strip_tags(stripslashes($title));
return $this->_objTpl->get();
}
示例10: editThumbnails
public function editThumbnails($post)
{
/**
* @var $cx \Cx\Core\Core\Controller\Cx
*/
$cx = \Env::get('cx');
$pdo = $cx->getDb()->getPdoConnection();
if (isset($_GET['deleteid'])) {
$sth = $pdo->prepare('DELETE FROM `' . DBPREFIX . 'settings_thumbnail` WHERE id = :id');
$sth->bindParam(':id', $_GET['deleteid']);
$sth->execute();
}
if (isset($_POST['name']) && isset($_POST['size'])) {
$stmt = $pdo->prepare('REPLACE INTO `' . DBPREFIX . 'settings_thumbnail`(id, name, size) VALUES (:id, :name, :size)');
$stmt->bindParam(':id', $_POST['id']);
$stmt->bindParam(':name', $_POST['name']);
$stmt->bindParam(':size', intval($_POST['size']));
$stmt->execute();
}
Csrf::header('Location: index.php?cmd=Config&act=image');
die;
}
示例11: download
private function download()
{
global $objInit;
$objDownload = new Download();
$objDownload->load(!empty($_GET['download']) ? intval($_GET['download']) : 0);
if (!$objDownload->EOF) {
// check if the download is expired
if ($objDownload->getExpirationDate() && $objDownload->getExpirationDate() < time() || !$objDownload->getActiveStatus()) {
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Error&id=404");
exit;
}
// check access to download-file
if (!$this->hasUserAccessToCategoriesOfDownload($objDownload)) {
\Permission::noAccess(base64_encode($objInit->getPageUri()));
}
// check access to download-file
if ($objDownload->getAccessId() && !\Permission::checkAccess(143, 'static', true) && !\Permission::checkAccess($objDownload->getAccessId(), 'dynamic', true) && $objDownload->getOwnerId() != $this->userId) {
\Permission::noAccess(base64_encode($objInit->getPageUri()));
}
$objDownload->incrementDownloadCount();
if ($objDownload->getType() == 'file') {
$objDownload->send();
} else {
// add socket -> prevent to hide the source from the customer
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . $objDownload->getSource());
}
}
}
示例12: getPage
/**
* Return the page depending on the $_GET-params
*
* @global $objPerm
* @global $objTemplate
* @global $_ARRAYLANG
*/
function getPage()
{
global $objPerm, $objTemplate, $_ARRAYLANG;
if (!isset($_GET['act'])) {
$_GET['act'] = '';
}
$_GET['section'] = empty($_GET['section']) ? "" : $_GET['section'];
switch ($_GET['section']) {
// The categories
case 'categories':
switch ($_GET['act']) {
case 'add':
\Permission::checkAccess(ACCESS_ID_EDIT_CATEGORIES, 'static');
$content = $this->editCategory(true);
$active = "add";
break;
case 'edit':
\Permission::checkAccess(ACCESS_ID_EDIT_CATEGORIES, 'static');
$content = $this->editCategory();
$active = "";
break;
case 'update':
\Permission::checkAccess(ACCESS_ID_EDIT_CATEGORIES, 'static');
$id = $this->updateCategory();
\Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?cmd=Knowledge" . MODULE_INDEX . "§ion=categories&act=overview&highlight=" . $id);
break;
case 'insert':
\Permission::checkAccess(ACCESS_ID_EDIT_CATEGORIES, 'static');
$id = $this->insertCategory();
\Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?cmd=Knowledge" . MODULE_INDEX . "§ion=categories&act=overview&highlight=" . $id);
break;
case 'delete':
\Permission::checkAccess(ACCESS_ID_EDIT_CATEGORIES, 'static');
$this->deleteCategory();
break;
case 'switchState':
$this->checkAjaxAccess(ACCESS_ID_EDIT_CATEGORIES);
$this->switchCategoryState();
break;
case 'sort':
$this->checkAjaxAccess(ACCESS_ID_EDIT_CATEGORIES);
$this->sortCategory();
break;
case 'overview':
default:
\Permission::checkAccess(ACCESS_ID_CATEGORIES, 'static');
$content = $this->categoriesOverview();
$active = "overview";
break;
}
$this->categories($content, $active);
break;
// The articles
// The articles
case 'articles':
switch ($_GET['act']) {
case 'add':
\Permission::checkAccess(ACCESS_ID_EDIT_ARTICLES, 'static');
$content = $this->editArticle(true);
$active = "add";
break;
case 'edit':
\Permission::checkAccess(ACCESS_ID_EDIT_ARTICLES, 'static');
$content = $this->editArticle();
$active = "";
break;
case 'insert':
\Permission::checkAccess(ACCESS_ID_EDIT_ARTICLES, 'static');
$id = $this->insertArticle();
$content = $this->articleOverview();
$active = "overview";
break;
case 'update':
\Permission::checkAccess(ACCESS_ID_EDIT_ARTICLES, 'static');
$id = $this->updateArticle();
$content = $this->articleOverview();
\Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?cmd=Knowledge" . MODULE_INDEX . "§ion=articles&act=edit&id=" . $id . "&updated=true");
break;
case 'getArticles':
\Permission::checkAccess(ACCESS_ID_OVERVIEW, 'static');
$this->getArticles();
break;
case 'sort':
$this->checkAjaxAccess(ACCESS_ID_EDIT_ARTICLES);
$this->sortArticles();
break;
case 'switchState':
$this->checkAjaxAccess(ACCESS_ID_EDIT_ARTICLES);
$this->switchArticleState();
break;
case 'getTags':
\Permission::checkAccess(ACCESS_ID_OVERVIEW, 'static');
$this->getTags();
//.........这里部分代码省略.........
示例13: modifyEntry
//.........这里部分代码省略.........
}
//get user data
$objFWUser = \FWUser::getFWUserObject();
$addedBy = isset($objEntry) ? $objEntry->arrEntries[$intEntryId]['entryAddedBy'] : '';
if (!empty($addedBy) && ($objUser = $objFWUser->objUser->getUser($addedBy))) {
$userId = $objUser->getId();
} else {
$userId = $objFWUser->objUser->getId();
}
$this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_OWNER' => $_ARRAYLANG['TXT_MEDIADIR_OWNER'], $this->moduleLangVar . '_OWNER_ROW' => $ownerRowClass, $this->moduleLangVar . '_OWNER_ID' => $userId));
\FWUser::getUserLiveSearch();
if ($intEntryId != 0) {
$intEntryDourationStart = 1;
$intEntryDourationEnd = 2;
//parse contact data
$objUser = $objFWUser->objUser;
$intUserId = intval($objUser->getId());
$strUserMail = '<a href="mailto:' . contrexx_raw2xhtml($objUser->getEmail()) . '">' . contrexx_raw2xhtml($objUser->getEmail()) . '</a>';
$intUserLang = intval($objUser->getFrontendLanguage());
if ($objUser = $objUser->getUser($id = $intUserId)) {
//get lang
foreach ($this->arrFrontendLanguages as $intKey => $arrLang) {
if ($arrLang['id'] == $intUserLang) {
$strUserLang = $arrLang['name'];
}
}
//get country
$arrCountry = \Cx\Core\Country\Controller\Country::getById(intval($objUser->getProfileAttribute('country')));
$strCountry = $arrCountry['name'];
//get title
$objTitle = $objDatabase->Execute("SELECT `title` FROM " . DBPREFIX . "access_user_title WHERE id = '" . intval($objUser->getProfileAttribute('title')) . "' LIMIT 1");
$strTitle = $objTitle->fields['title'];
$this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_CONTACT_DATA' => "Kontaktangaben", $this->moduleLangVar . '_CONTACT_ATTRIBUT_TITLE' => contrexx_raw2xhtml($strTitle), $this->moduleLangVar . '_CONTACT_ATTRIBUT_FIRSTNAME' => contrexx_raw2xhtml($objUser->getProfileAttribute('firstname')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_LASTNAME' => contrexx_raw2xhtml($objUser->getProfileAttribute('lastname')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_COMPANY' => contrexx_raw2xhtml($objUser->getProfileAttribute('company')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_ADRESS' => contrexx_raw2xhtml($objUser->getProfileAttribute('address')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_CITY' => contrexx_raw2xhtml($objUser->getProfileAttribute('city')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_ZIP' => contrexx_raw2xhtml($objUser->getProfileAttribute('zip')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_COUNTRY' => contrexx_raw2xhtml($strCountry), $this->moduleLangVar . '_CONTACT_ATTRIBUT_PHONE' => contrexx_raw2xhtml($objUser->getProfileAttribute('phone_office')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_FAX' => contrexx_raw2xhtml($objUser->getProfileAttribute('phone_fax')), $this->moduleLangVar . '_CONTACT_ATTRIBUT_WEBSITE' => '<a href="' . contrexx_raw2xhtml($objUser->getProfileAttribute('website')) . '" target="_blank">' . contrexx_raw2xhtml($objUser->getProfileAttribute('website')) . '</a>', $this->moduleLangVar . '_CONTACT_ATTRIBUT_MAIL' => $strUserMail, $this->moduleLangVar . '_CONTACT_ATTRIBUT_LANG' => $strUserLang));
}
$this->_objTpl->parse($this->moduleNameLC . 'ContactData');
} else {
$intEntryDourationStart = 1;
$intEntryDourationEnd = 2;
$this->_objTpl->hideBlock($this->moduleNameLC . 'ContactData');
}
//get display duration data
switch ($this->arrSettings['settingsEntryDisplaydurationValueType']) {
case 1:
$intDiffDay = $this->arrSettings['settingsEntryDisplaydurationValue'];
$intDiffMonth = 0;
$intDiffYear = 0;
break;
case 2:
$intDiffDay = 0;
$intDiffMonth = $this->arrSettings['settingsEntryDisplaydurationValue'];
$intDiffYear = 0;
break;
case 3:
$intDiffDay = 0;
$intDiffMonth = 0;
$intDiffYear = $this->arrSettings['settingsEntryDisplaydurationValue'];
break;
}
if ($intEntryId != 0) {
if (intval($objEntry->arrEntries[$intEntryId]['entryDurationType']) == 1) {
$intEntryDourationAlways = 'selected="selected"';
$intEntryDourationStart = date("d.m.Y", mktime());
$intEntryDourationEnd = date("d.m.Y", mktime(0, 0, 0, date("m") + $intDiffMonth, date("d") + $intDiffDay, date("Y") + $intDiffYear));
} else {
$intEntryDourationPeriod = 'selected="selected"';
$intEntryDourationShowPeriod = 'inline';
$intEntryDourationStart = date("d.m.Y", $objEntry->arrEntries[$intEntryId]['entryDurationStart']);
$intEntryDourationEnd = date("d.m.Y", $objEntry->arrEntries[$intEntryId]['entryDurationEnd']);
}
if (intval($objEntry->arrEntries[$intEntryId]['entryDurationNotification']) == 1) {
$this->_objTpl->setVariable(array($this->moduleLangVar . '_DISPLAYDURATION_RESET_NOTIFICATION_STATUS' => '<br /><input type="checkbox" name="durationResetNotification" value="1" /> ' . $_ARRAYLANG['TXT_MEDIADIR_DISPLAYDURATION_RESET_NOTIFICATION_STATUS']));
}
} else {
if (intval($this->arrSettings['settingsEntryDisplaydurationType']) == 1) {
$intEntryDourationAlways = 'selected="selected"';
} else {
$intEntryDourationPeriod = 'selected="selected"';
$intEntryDourationShowPeriod = 'inline';
}
$intEntryDourationStart = date("d.m.Y", mktime());
$intEntryDourationEnd = date("d.m.Y", mktime(0, 0, 0, date("m") + $intDiffMonth, date("d") + $intDiffDay, date("Y") + $intDiffYear));
}
//parse spez fields
$this->_objTpl->touchBlock($this->moduleNameLC . 'SpezfieldList');
//generate javascript
parent::setJavascript($this->getSelectorJavascript());
parent::setJavascript($objInputfields->getInputfieldJavascript());
//get form onsubmit
$strOnSubmit = parent::getFormOnSubmit($objInputfields->arrJavascriptFormOnSubmit);
$this->_objTpl->setVariable(array($this->moduleLangVar . '_ENTRY_STATUS' => $intEntryId && intval($objEntry->arrEntries[$intEntryId]['entryActive']) ? 'checked="checked"' : '', $this->moduleLangVar . '_MEDIABROWSER_BUTTON' => $this->getMediaBrowserButton($_ARRAYLANG['TXT_BROWSE'], array('type' => 'button', 'id' => 'mediabrowser_button', 'style' => 'display:none;'))));
//parse blocks
$this->_objTpl->hideBlock($this->moduleNameLC . 'FormList');
}
//parse global variables
$this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_PAGE_TITLE' => $pageTitle, $this->moduleLangVar . '_ENTRY_ID' => $intEntryId, $this->moduleLangVar . '_FORM_ID' => $intFormId, 'TXT_' . $this->moduleLangVar . '_SUBMIT' => $_ARRAYLANG['TXT_' . $this->moduleLangVar . '_SUBMIT'], $this->moduleLangVar . '_JAVASCRIPT' => $this->getJavascript(), $this->moduleLangVar . '_FORM_ONSUBMIT' => $strOnSubmit, 'TXT_' . $this->moduleLangVar . '_PLEASE_CHECK_INPUT' => $_ARRAYLANG['TXT_MEDIADIR_PLEASE_CHECK_INPUT'], $this->moduleLangVar . '_DEFAULT_LANG_ID' => $_LANGID, 'TXT_' . $this->moduleLangVar . '_SPEZ_FIELDS' => $_ARRAYLANG['TXT_MEDIADIR_SPEZ_FIELDS'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION' => $_ARRAYLANG['TXT_MEDIADIR_DISPLAYDURATION'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION_ALWAYS' => $_ARRAYLANG['TXT_MEDIADIR_DISPLAYDURATION_ALWAYS'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION_PERIOD' => $_ARRAYLANG['TXT_MEDIADIR_DISPLAYDURATION_PERIOD'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION_FROM' => $_CORELANG['TXT_FROM'], 'TXT_' . $this->moduleLangVar . '_DISPLAYDURATION_TO' => $_CORELANG['TXT_TO'], $this->moduleLangVar . '_DISPLAYDURATION_START' => $intEntryDourationStart, $this->moduleLangVar . '_DISPLAYDURATION_END' => $intEntryDourationEnd, $this->moduleLangVar . '_DISPLAYDURATION_SELECT_ALWAYS' => $intEntryDourationAlways, $this->moduleLangVar . '_DISPLAYDURATION_SELECT_PERIOD' => $intEntryDourationPeriod, $this->moduleLangVar . '_DISPLAYDURATION_SHOW_PERIOD' => $intEntryDourationShowPeriod, 'TXT_' . $this->moduleLangVar . '_TRANSLATION_STATUS' => $_ARRAYLANG['TXT_MEDIADIR_TRANSLATION_STATUS'], 'TXT_' . $this->moduleLangVar . '_ENTRY_STATUS' => $_ARRAYLANG['TXT_MEDIADIR_ACTIVE']));
} else {
\Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?cmd=" . $this->moduleName . "&act=settings&tpl=forms");
exit;
}
}
示例14: delEntry
function delEntry()
{
global $objDatabase, $_ARRAYLANG, $_CORELANG, $_CONFIG;
$this->_objTpl->setTemplate($this->pageContent, true, true);
if (!$this->settings['editEntry'] == '1' || !$this->communityModul && $this->settings['addEntry_only_community'] == '1') {
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market&cmd=detail&id=' . $_POST['id']);
exit;
} elseif ($this->settings['addEntry_only_community'] == '1') {
$objFWUser = \FWUser::getFWUserObject();
if ($objFWUser->objUser->login()) {
if (!\Permission::checkAccess(101, 'static', true)) {
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Login&cmd=noaccess");
exit;
}
} else {
$link = base64_encode(CONTREXX_DIRECTORY_INDEX . '?' . $_SERVER['QUERY_STRING']);
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Login&redirect=" . $link);
exit;
}
} else {
$objFWUser = \FWUser::getFWUserObject();
}
//get search
$this->getSearch();
if (isset($_GET['id'])) {
$entryId = contrexx_addslashes($_GET['id']);
$objResult = $objDatabase->Execute('SELECT id, userid, catid FROM ' . DBPREFIX . 'module_market WHERE id = ' . $entryId . ' LIMIT 1');
if ($objResult !== false) {
while (!$objResult->EOF) {
if ($objFWUser->objUser->login() && $objFWUser->objUser->getId() == $objResult->fields['userid'] || \Permission::hasAllAccess()) {
$this->_objTpl->setVariable(array('MARKET_ENTRY_ID' => $entryId, 'TXT_MARKET_DEL' => $_ARRAYLANG['TXT_MARKET_DELETE_ADVERTISEMENT'], 'TXT_MARKET_ABORT' => $_CORELANG['TXT_CANCEL'], 'TXT_MARKET_CONFIRM_DEL' => $_ARRAYLANG['TXT_MARKET_ADVERTISEMENT_DELETE']));
//get navigatin
$this->getNavigation($objResult->fields['catid']);
$objResult->MoveNext();
} else {
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market&cmd=detail&id=' . $_GET['id']);
exit;
}
}
}
} else {
if (isset($_POST['submitEntry'])) {
$arrDelete = array();
$arrDelete[0] = $_POST['id'];
$this->removeEntry($arrDelete);
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market');
exit;
} else {
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Market');
exit;
}
}
}
示例15: preResolve
public function preResolve(\Cx\Core\Routing\Url $url)
{
if ($this->cx->getMode() != \Cx\Core\Core\Controller\Cx::MODE_FRONTEND) {
return;
}
$em = $this->cx->getDb()->getEntityManager();
$rewriteRuleRepo = $em->getRepository($this->getNamespace() . '\\Model\\Entity\\RewriteRule');
$rewriteRules = $rewriteRuleRepo->findAll(array(), array('order' => 'asc'));
$last = false;
$originalUrl = clone $url;
foreach ($rewriteRules as $rewriteRule) {
try {
$url = $rewriteRule->resolve($url, $last);
} catch (\Exception $e) {
// This is thrown if the regex of the rule is not valid
}
if ($last) {
break;
}
}
if ($originalUrl->toString() != $url->toString()) {
if ($rewriteRule->getRewriteStatusCode() != \Cx\Core\Routing\Model\Entity\RewriteRule::REDIRECTION_TYPE_INTERN) {
$headers = array('Location' => $url->toString());
if ($rewriteRule->getRewriteStatusCode() == 301) {
array_push($headers, $_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
}
$this->getComponent('Cache')->writeCacheFileForRequest(null, $headers, '');
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . $url->toString(), true, $rewriteRule->getRewriteStatusCode());
die;
}
try {
\DBG::log('Fetching content from ' . $url->toString());
$request = new \HTTP_Request2($url->toString(), \HTTP_Request2::METHOD_GET);
$request->setConfig(array('follow_redirects' => true));
$response = $request->send();
$content = $response->getBody();
foreach ($response->getHeader() as $key => $value) {
if (in_array($key, array('content-encoding', 'transfer-encoding'))) {
continue;
}
\Cx\Core\Csrf\Controller\Csrf::header($key . ':' . $value);
}
$continue = false;
die($content);
} catch (\HTTP_Request2_Exception $e) {
\DBG::dump($e);
}
}
}