本文整理汇总了PHP中contrexx_input2raw函数的典型用法代码示例。如果您正苦于以下问题:PHP contrexx_input2raw函数的具体用法?PHP contrexx_input2raw怎么用?PHP contrexx_input2raw使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contrexx_input2raw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
public function getData($element = null, &$data = array())
{
$internalRequest = true;
if (!$element) {
$element = $this;
$internalRequest = false;
}
foreach ($element->getChildren() as $subElement) {
if ($subElement instanceof \Cx\Core\Html\Model\Entity\DataElement) {
$data[$subElement->getIdentifier()] = $subElement->getData();
if (isset($_POST[$subElement->getIdentifier()])) {
if ($subElement->getValidator()->isValid(contrexx_input2raw($_POST[$subElement->getIdentifier()]))) {
$data[$subElement->getIdentifier()] = contrexx_input2raw($_POST[$subElement->getIdentifier()]);
$subElement->setData(contrexx_input2raw($_POST[$subElement->getIdentifier()]));
}
}
} else {
$this->getData($subElement, $data);
}
}
if ($internalRequest) {
return $data;
}
return new \Cx\Core_Modules\Listing\Model\Entity\DataSet(array($data));
}
示例2: checkAuth
/**
* Verify user authentication
* @return boolean True if authentication is okay,
* false otherwise
*/
function checkAuth()
{
global $sessionObj, $_CORELANG;
$username = isset($_POST['USERNAME']) && $_POST['USERNAME'] != '' ? contrexx_stripslashes($_POST['USERNAME']) : null;
$password = isset($_POST['PASSWORD']) && $_POST['PASSWORD'] != '' ? md5(contrexx_stripslashes($_POST['PASSWORD'])) : null;
$authToken = !empty($_GET['auth-token']) ? contrexx_input2raw($_GET['auth-token']) : null;
$userId = !empty($_GET['user-id']) ? contrexx_input2raw($_GET['user-id']) : null;
if ((!isset($username) || !isset($password)) && (!isset($authToken) || !isset($userId))) {
return false;
}
if (empty($sessionObj)) {
$sessionObj = cmsSession::getInstance();
}
if (!isset($_SESSION['auth'])) {
$_SESSION['auth'] = array();
}
if (isset($username) && isset($password) && $this->objUser->auth($username, $password, $this->isBackendMode(), \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) || isset($authToken) && isset($userId) && $this->objUser->authByToken($userId, $authToken, $this->isBackendMode())) {
if ($this->isBackendMode()) {
$this->log();
}
$this->loginUser($this->objUser);
return true;
}
$_SESSION['auth']['loginLastAuthFailed'] = 1;
User::registerFailedLogin($username);
$this->arrStatusMsg['error'][] = $_CORELANG['TXT_PASSWORD_OR_USERNAME_IS_INCORRECT'];
$_SESSION->cmsSessionUserUpdate();
$_SESSION->cmsSessionStatusUpdate($this->isBackendMode() ? 'backend' : 'frontend');
return false;
}
示例3: getAllNews
/**
* get all news list
*
* @return json result
*/
public function getAllNews($data = array())
{
global $objDatabase;
$searchTerm = isset($data['get']['term']) ? contrexx_input2raw($data['get']['term']) : '';
$id = isset($data['get']['id']) ? contrexx_input2int($data['get']['id']) : 0;
$langId = isset($data['get']['langId']) ? contrexx_input2int($data['get']['langId']) : 0;
if (empty($searchTerm)) {
$this->messages[] = '';
//TODO Show error message
}
$query = '
SELECT
n.`id`,
nl.`title`
FROM `' . DBPREFIX . 'module_news` AS `n`
LEFT JOIN ' . DBPREFIX . 'module_news_locale AS `nl`
ON nl.`news_id` = n.`id`
WHERE nl.`is_active`="1"
AND n.`status`="1"' . (!empty($id) ? ' AND n.`id`!="' . $id . '"' : '') . (!empty($langId) ? ' AND nl.`lang_id`="' . $langId . '"' : '') . ' AND (
nl.title LIKE "%' . contrexx_raw2db($searchTerm) . '%"
OR nl.teaser_text LIKE "%' . contrexx_raw2db($searchTerm) . '%"
)
ORDER BY nl.`title`';
$result = array();
$objResult = $objDatabase->Execute($query);
if ($objResult && $objResult->RecordCount() > 0) {
while (!$objResult->EOF) {
$result[$objResult->fields['id']] = $objResult->fields['title'];
$objResult->MoveNext();
}
}
return $result;
}
示例4: getPage
public function getPage($pos, $page_content)
{
global $_CONFIG, $_ARRAYLANG;
$objTpl = new \Cx\Core\Html\Sigma('.');
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTpl);
$objTpl->setErrorHandling(PEAR_ERROR_DIE);
$objTpl->setTemplate($page_content);
$objTpl->setGlobalVariable($_ARRAYLANG);
$term = isset($_REQUEST['term']) ? trim(contrexx_input2raw($_REQUEST['term'])) : '';
if (strlen($term) >= 3) {
$term = trim(contrexx_input2raw($_REQUEST['term']));
$this->setTerm($term);
$eventHandlerInstance = \Env::get('cx')->getEvents();
$eventHandlerInstance->triggerEvent('SearchFindContent', array($this));
if ($this->result->size() == 1) {
$arraySearchResults[] = $this->result->toArray();
} else {
$arraySearchResults = $this->result->toArray();
}
usort($arraySearchResults, function ($a, $b) {
if ($a['Score'] == $b['Score']) {
if (isset($a['Date'])) {
if ($a['Date'] == $b['Date']) {
return 0;
}
if ($a['Date'] > $b['Date']) {
return -1;
}
return 1;
}
return 0;
}
if ($a['Score'] > $b['Score']) {
return -1;
}
return 1;
});
$countResults = sizeof($arraySearchResults);
if (!is_numeric($pos)) {
$pos = 0;
}
$paging = getPaging($countResults, $pos, '&section=Search&term=' . contrexx_raw2encodedUrl($term), '<b>' . $_ARRAYLANG['TXT_SEARCH_RESULTS'] . '</b>', true);
$objTpl->setVariable('SEARCH_PAGING', $paging);
$objTpl->setVariable('SEARCH_TERM', contrexx_raw2xhtml($term));
if ($countResults > 0) {
$searchComment = sprintf($_ARRAYLANG['TXT_SEARCH_RESULTS_ORDER_BY_RELEVANCE'], contrexx_raw2xhtml($term), $countResults);
$objTpl->setVariable('SEARCH_TITLE', $searchComment);
$arraySearchOut = array_slice($arraySearchResults, $pos, $_CONFIG['corePagingLimit']);
foreach ($arraySearchOut as $details) {
$objTpl->setVariable(array('COUNT_MATCH' => $_ARRAYLANG['TXT_RELEVANCE'] . ' ' . $details['Score'] . '%', 'LINK' => '<b><a href="' . $details['Link'] . '" title="' . contrexx_raw2xhtml($details['Title']) . '">' . contrexx_raw2xhtml($details['Title']) . '</a></b>', 'SHORT_CONTENT' => contrexx_raw2xhtml($details['Content'])));
$objTpl->parse('search_result');
}
return $objTpl->get();
}
}
$noresult = $term != '' ? sprintf($_ARRAYLANG['TXT_NO_SEARCH_RESULTS'], $term) : $_ARRAYLANG['TXT_PLEASE_ENTER_SEARCHTERM'];
$objTpl->setVariable('SEARCH_TITLE', $noresult);
return $objTpl->get();
}
示例5: __construct
/**
* Constructor
*
* @param string $act
* @param \Cx\Core\Html\Sigma $tpl
* @param \Cx\Core_Modules\License\License $license
*/
public function __construct(&$act, \Cx\Core\Html\Sigma $tpl, \Cx\Core_Modules\License\License $license)
{
global $_ARRAYLANG;
$this->defaultAct = 'getSearchResults';
$this->em = \Env::get('em');
$this->act = $act;
$this->template = $tpl;
$this->license = $license;
$this->term = !empty($_GET['term']) ? contrexx_input2raw($_GET['term']) : '';
$this->pos = !empty($_GET['pos']) ? contrexx_input2raw($_GET['pos']) : 0;
$this->template->setVariable(array('CONTENT_TITLE' => $_ARRAYLANG['TXT_OVERVIEW'], 'CONTENT_NAVIGATION' => '<a href="index.php?cmd=Search" class="active">' . $_ARRAYLANG['TXT_OVERVIEW'] . '</a>'));
}
示例6: modifyQuestions
public function modifyQuestions()
{
$objQuestion = new SurveyQuestion();
$objQuestion->id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$objQuestion->surveyId = isset($_GET['surveyId']) ? (int) $_GET['surveyId'] : 0;
$objQuestion->questionType = isset($_POST['questionType']) ? (int) $_POST['questionType'] : 0;
$objQuestion->question = isset($_POST['Question']) ? contrexx_input2raw($_POST['Question']) : '';
$objQuestion->questionRow = isset($_POST['QuestionRow']) ? contrexx_input2raw($_POST['QuestionRow']) : '';
$objQuestion->questionChoice = isset($_POST['ColumnChoices']) ? contrexx_input2raw($_POST['ColumnChoices']) : '';
$objQuestion->questionAnswers = isset($_POST['QuestionAnswers']) ? contrexx_input2raw($_POST['QuestionAnswers']) : '';
$objQuestion->isCommentable = isset($_POST['Iscomment']) ? (int) $_POST['Iscomment'] : 0;
$objQuestion->save();
}
示例7: getPage
/**
* This is called by the default ComponentController and does all the repeating work
*
* This loads a template named after current $act and calls parsePage($actTemplate)
* @todo $this->cx->getTemplate()->setVariable() should not be called here but in Cx class
* @global array $_ARRAYLANG Language data
* @param \Cx\Core\ContentManager\Model\Entity\Page $page Resolved page
*/
public function getPage(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $_ARRAYLANG, $subMenuTitle;
$subMenuTitle = $_ARRAYLANG['TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName())];
$cmd = array('');
if (isset($_GET['act'])) {
$cmd = explode('/', contrexx_input2raw($_GET['act']));
}
$actTemplate = new \Cx\Core\Html\Sigma($this->getDirectory(true) . '/View/Template/Backend');
$filename = $cmd[0] . '.html';
$testFilename = $cmd[0];
if (!\Env::get('ClassLoader')->getFilePath($actTemplate->getRoot() . '/' . $filename)) {
$filename = 'Default.html';
$testFilename = 'Default';
}
foreach ($cmd as $index => $name) {
if ($index == 0) {
continue;
}
$testFilename .= $name;
if (\Env::get('ClassLoader')->getFilePath($actTemplate->getRoot() . '/' . $testFilename . '.html')) {
$filename = $testFilename . '.html';
} else {
break;
}
}
$actTemplate->loadTemplateFile($filename);
// todo: Messages
$navigation = $this->parseNavigation($cmd);
$this->parsePage($actTemplate, $cmd);
$txt = $cmd[0];
if (empty($txt)) {
$txt = 'DEFAULT';
}
// default css and js
if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Style/Backend.css'))) {
\JS::registerCSS(substr($this->getDirectory(false, true) . '/View/Style/Backend.css', 1));
}
if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Script/Backend.js'))) {
\JS::registerJS(substr($this->getDirectory(false, true) . '/View/Script/Backend.js', 1));
}
// finish
$actTemplate->setGlobalVariable($_ARRAYLANG);
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($actTemplate);
$page->setContent($actTemplate->get());
$cachedRoot = $this->cx->getTemplate()->getRoot();
$this->cx->getTemplate()->setRoot(\Env::get('cx')->getCodeBaseCorePath() . '/Core/View/Template/Backend');
$this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'ContentMaster.html');
$this->cx->getTemplate()->setRoot($cachedRoot);
$this->cx->getTemplate()->setVariable(array('CONTENT_NAVIGATION' => $navigation->get(), 'ADMIN_CONTENT' => $page->getContent(), 'CONTENT_TITLE' => $_ARRAYLANG['TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName() . '_ACT_' . $txt)]));
}
示例8: getPage
/**
* get the page
*
* @return string html code of the page
* @throws FileSharingException
*/
public function getPage()
{
$hash = isset($this->uriParams["hash"]) ? contrexx_input2raw($this->uriParams["hash"]) : '';
$check = isset($this->uriParams["check"]) ? contrexx_input2raw($this->uriParams["check"]) : '';
$uploadId = isset($this->uriParams["uploadId"]) ? contrexx_input2raw($this->uriParams["uploadId"]) : 0;
if (!empty($uploadId)) {
$this->files = $this->getSharedFiles($uploadId);
}
$act = isset($this->uriParams["act"]) ? $this->uriParams["act"] : '';
switch ($act) {
case "image":
$this->loadImage($hash);
break;
default:
try {
if (!empty($hash) && !empty($check)) {
$fileDeleted = $this->deleteFile($hash, $check);
} elseif (!empty($hash)) {
$this->downloadFile($hash);
} else {
if (empty($this->files) && is_array($this->files)) {
throw new FileSharingException('no_files_uploaded');
}
}
$this->objTemplate->hideBlock('error_file_not_found');
$this->objTemplate->hideBlock('error_no_files_uploaded');
} catch (FileSharingException $e) {
switch ($e->getMessage()) {
case 'file_not_found':
$this->objTemplate->touchBlock('error_file_not_found');
$this->objTemplate->hideBlock('error_no_files_uploaded');
break;
case 'no_files_uploaded':
$this->objTemplate->touchBlock('error_no_files_uploaded');
$this->objTemplate->hideBlock('error_file_not_found');
break;
}
}
// don't show for delete page
if (empty($hash) || isset($fileDeleted) && $fileDeleted) {
$this->uploadPage();
}
break;
}
FileSharingLib::cleanUp();
return $this->objTemplate->get();
}
示例9: showOrders
public function showOrders()
{
global $_ARRAYLANG;
$term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : '';
$filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0;
$objFilterUser = null;
if (!empty($term) || !empty($filterUserId)) {
if ($filterUserId) {
$objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId);
}
$orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser);
} else {
$orders = $this->orderRepository->getAllByDesc();
}
$view = new \Cx\Core\Html\Controller\ViewGenerator($orders, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('contactId' => array('header' => 'contactId', 'table' => array('parse' => function ($value) {
global $_ARRAYLANG;
$userId = \Cx\Modules\Crm\Controller\CrmLibrary::getUserIdByCrmUserId($value);
$userName = \FWUser::getParsedUserTitle($userId);
$crmDetailLink = "<a href='index.php?cmd=Crm&act=customers&tpl=showcustdetail&id={$value}' \n title='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'>\n <img \n src='" . \Env::get('cx')->getCodeBaseCoreWebPath() . "/Core/View/Media/navigation_level_1_189.png' \n width='16' height='16' \n alt='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'\n />\n </a>";
$url = "<a href='index.php?cmd=Access&act=user&tpl=modify&id={$userId}'\n title='{$_ARRAYLANG['TXT_MODULE_ORDER_MODIY_USER_ACCOUNT']}'>" . $userName . "</a>" . $crmDetailLink;
return $url;
})), 'subscriptions' => array('header' => 'subscriptions', 'table' => array('parse' => function ($subscriptions) {
$result = array();
foreach ($subscriptions as $subscription) {
$productEntity = $subscription->getProductEntity();
$productEntityName = $subscription->getProduct()->getName();
if (!$productEntity) {
continue;
}
$productEditLink = $productEntity;
if (method_exists($productEntity, 'getEditLink')) {
$productEditLink = $productEntity->getEditLink();
}
$subscriptionEditUrl = '<a href=index.php?cmd=Order&act=subscription&editid=' . $subscription->getId() . '>' . $productEntityName . '</a>';
$result[] = $subscriptionEditUrl . ' (' . $productEditLink . ')';
}
return implode(', ', $result);
})))));
if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) {
$this->template->hideBlock("order_filter");
} else {
\FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true));
$this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : ''));
}
$this->template->setVariable('ORDERS_CONTENT', $view->render());
}
示例10: getDetailPage
public function getDetailPage()
{
global $_ARRAYLANG, $objDatabase;
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$file = str_replace($cx->getWebsiteOffsetPath(), '', $_GET["path"]) . $_GET["file"];
$objResult = $objDatabase->Execute("SELECT `id`, `file`, `source`, `hash`, `check`, `expiration_date` FROM " . DBPREFIX . "module_filesharing WHERE `source` = '" . contrexx_raw2db($file) . "'");
$existing = $objResult !== false && $objResult->RecordCount() > 0;
if ($_GET["switch"]) {
if ($existing) {
$objDatabase->Execute("DELETE FROM " . DBPREFIX . "module_filesharing WHERE `source` = '" . contrexx_raw2db($file) . "'");
} else {
$hash = FileSharingLib::createHash();
$check = FileSharingLib::createCheck($hash);
$source = str_replace($cx->getWebsiteOffsetPath(), '', $_GET["path"]) . $_GET["file"];
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_filesharing (`file`, `source`, `hash`, `check`) VALUES ('" . contrexx_raw2db($source) . "', '" . contrexx_raw2db($source) . "', '" . contrexx_raw2db($hash) . "', '" . contrexx_raw2db($check) . "')");
}
$existing = !$existing;
}
if ($existing) {
$this->_objTpl->setVariable(array('FILE_STATUS' => $_ARRAYLANG["TXT_FILESHARING_SHARED"], 'FILE_STATUS_SWITCH' => $_ARRAYLANG["TXT_FILESHARING_STOP_SHARING"], 'FILE_STATUS_SWITCH_HREF' => 'index.php?cmd=Media&archive=FileSharing&act=filesharing&path=' . $_GET["path"] . '&file=' . $_GET["file"] . '&switch=1'));
$this->_objTpl->touchBlock('shared');
} else {
$this->_objTpl->setVariable(array('FILE_STATUS' => $_ARRAYLANG["TXT_FILESHARING_NOT_SHARED"], 'FILE_STATUS_SWITCH' => $_ARRAYLANG["TXT_FILESHARING_START_SHARING"], 'FILE_STATUS_SWITCH_HREF' => 'index.php?cmd=Media&archive=FileSharing&act=filesharing&path=' . $_GET["path"] . '&file=' . $_GET["file"] . '&switch=1'));
$this->_objTpl->hideBlock('shared');
}
if ($_POST["shareFiles"]) {
$emails = array();
foreach (preg_split('/[;,\\s]+/', $_POST["email"]) as $email) {
if (\FWValidator::isEmail($email)) {
$emails[] = contrexx_input2raw($email);
}
}
if (count($emails) > 0) {
FileSharingLib::sendMail($objResult->fields["id"], $_POST["subject"], $emails, $_POST["message"]);
}
} elseif ($_POST["saveExpiration"]) {
if ($_POST["expiration"]) {
$objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing SET `expiration_date` = NULL WHERE `id` = " . $objResult->fields["id"]);
} else {
$objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing SET `expiration_date` = '" . date('Y-m-d H:i:s', strtotime($_POST["expirationDate"])) . "' WHERE `id` = " . $objResult->fields["id"]);
}
}
$objResult = $objDatabase->Execute("SELECT `id`, `hash`, `check`, `expiration_date` FROM " . DBPREFIX . "module_filesharing WHERE `source` = '" . contrexx_raw2db($file) . "'");
$this->_objTpl->setVariable(array('FORM_ACTION' => 'index.php?cmd=Media&archive=FileSharing&act=filesharing&path=' . $_GET["path"] . '&file=' . $_GET["file"], 'FORM_METHOD' => 'POST', 'FILESHARING_INFO' => $_ARRAYLANG['TXT_FILESHARING_INFO'], 'FILESHARING_LINK_BACK_HREF' => 'index.php?cmd=Media&archive=FileSharing&path=' . $_GET["path"], 'FILESHARING_LINK_BACK' => $_ARRAYLANG['TXT_FILESHARING_LINK_BACK'], 'FILESHARING_DOWNLOAD_LINK' => $_ARRAYLANG['TXT_FILESHARING_DOWNLOAD_LINK'], 'FILE_DOWNLOAD_LINK_HREF' => FileSharingLib::getDownloadLink($objResult->fields["id"]), 'FILE_DELETE_LINK_HREF' => FileSharingLib::getDeleteLink($objResult->fields["id"]), 'FILESHARING_DELETE_LINK' => $_ARRAYLANG['TXT_FILESHARING_DELETE_LINK'], 'FILESHARING_STATUS' => $_ARRAYLANG['TXT_FILESHARING_STATUS'], 'FILESHARING_EXPIRATION' => $_ARRAYLANG['TXT_FILESHARING_EXPIRATION'], 'FILESHARING_NEVER' => $_ARRAYLANG['TXT_FILESHARING_NEVER'], 'FILESHARING_EXPIRATION_CHECKED' => htmlentities($objResult->fields["expiration_date"] == NULL ? 'checked="checked"' : '', ENT_QUOTES, CONTREXX_CHARSET), 'FILESHARING_EXPIRATION_DATE' => htmlentities($objResult->fields["expiration_date"] != NULL ? date('d.m.Y H:i', strtotime($objResult->fields["expiration_date"])) : date('d.m.Y H:i', time() + 3600 * 24 * 7), ENT_QUOTES, CONTREXX_CHARSET), 'FILESHARING_SEND_MAIL' => $_ARRAYLANG['TXT_FILESHARING_SEND_MAIL'], 'FILESHARING_EMAIL' => $_ARRAYLANG["TXT_FILESHARING_EMAIL"], 'FILESHARING_EMAIL_INFO' => $_ARRAYLANG["TXT_FILESHARING_EMAIL_INFO"], 'FILESHARING_SUBJECT' => $_ARRAYLANG["TXT_FILESHARING_SUBJECT"], 'FILESHARING_SUBJECT_INFO' => $_ARRAYLANG["TXT_FILESHARING_SUBJECT_INFO"], 'FILESHARING_MESSAGE' => $_ARRAYLANG["TXT_FILESHARING_MESSAGE"], 'FILESHARING_MESSAGE_INFO' => $_ARRAYLANG["TXT_FILESHARING_MESSAGE_INFO"], 'FILESHARING_SEND' => $_ARRAYLANG["TXT_FILESHARING_SEND"], 'FILESHARING_SAVE' => $_ARRAYLANG["TXT_FILESHARING_SAVE"], 'TXT_CORE_MAILTEMPLATE_NOTE_TO' => $_ARRAYLANG['TXT_CORE_MAILTEMPLATE_NOTE_TO']));
}
示例11: preContentLoad
/**
* Do something before content is loaded from DB
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function preContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $section;
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
if ($section == 'JsonData') {
// TODO: move this code to /core/Json/...
// TODO: handle expired sessions in any xhr callers.
$json = new \Cx\Core\Json\JsonData();
// TODO: Verify that the arguments are actually present!
$adapter = contrexx_input2raw($_GET['object']);
$method = contrexx_input2raw($_GET['act']);
// TODO: Replace arguments by something reasonable
$arguments = array('get' => $_GET, 'post' => $_POST);
echo $json->jsondata($adapter, $method, $arguments);
die;
}
break;
}
}
示例12: initialize
protected function initialize(&$arguments)
{
switch ($this->mode) {
case self::MODE_DQL:
$this->code = 'SELECT p FROM Cx\\Core\\ContentManager\\Model\\Entity\\Page p WHERE p.id < 10';
if (!empty($arguments['code'])) {
$this->code = contrexx_input2raw($arguments['code']);
}
$this->result = '';
break;
case self::MODE_PHP:
default:
$this->code = 'return $em->getRepository(\'Cx\\Core\\ContentManager\\Model\\Entity\\Node\')->verify();';
if (!empty($arguments['code'])) {
$this->code = contrexx_input2raw($arguments['code']);
}
$this->result = '';
break;
}
}
示例13: searchContacts
/**
* get customer search result
*
* @global array $_ARRAYLANG
* @global object $objDatabase
* @return json result
*/
public function searchContacts()
{
global $objDatabase;
$searchFields = array('companyname_filter' => isset($_REQUEST['companyname_filter']) ? contrexx_input2raw($_REQUEST['companyname_filter']) : '', 'contactSearch' => isset($_REQUEST['contactSearch']) ? (array) $_REQUEST['contactSearch'] : array(1, 2), 'advanced-search' => $_REQUEST['advanced-search'], 's_name' => $_REQUEST['s_name'], 's_email' => $_REQUEST['s_email'], 's_address' => $_REQUEST['s_address'], 's_city' => $_REQUEST['s_city'], 's_postal_code' => $_REQUEST['s_postal_code'], 's_notes' => $_REQUEST['s_notes'], 'customer_type' => $_REQUEST['customer_type'], 'filter_membership' => $_REQUEST['filter_membership'], 'term' => isset($_REQUEST['term']) ? contrexx_input2raw($_REQUEST['term']) : '', 'sorto' => $_REQUEST['sorto'], 'sortf' => $_REQUEST['sortf']);
$objCrmLibrary = new CrmLibrary($this->getName());
$query = $objCrmLibrary->getContactsQuery($searchFields);
$objResult = $objDatabase->Execute($query);
$result = array();
if ($objResult) {
while (!$objResult->EOF) {
if ($objResult->fields['contact_type'] == 1) {
$contactName = $objResult->fields['customer_name'];
} else {
$contactName = $objResult->fields['customer_name'] . " " . $objResult->fields['contact_familyname'];
}
$result[] = array('id' => (int) $objResult->fields['id'], 'label' => html_entity_decode(stripslashes($contactName), ENT_QUOTES, CONTREXX_CHARSET), 'value' => html_entity_decode(stripslashes($contactName), ENT_QUOTES, CONTREXX_CHARSET));
$objResult->MoveNext();
}
}
return $result;
}
示例14: _handleUpload
/**
* Handle the calendar image upload
*
* @param string $id unique form id
*
* @return string image path
*/
function _handleUpload($fieldName, $id)
{
$tup = self::getTemporaryUploadPath($fieldName, $id);
$tmpUploadDir = \Env::get('cx')->getWebsitePath() . $tup[1] . '/' . $tup[2] . '/';
//all the files uploaded are in here
$depositionTarget = $this->uploadImgPath;
//target folder
$pic = '';
//move all files
if (!\Cx\Lib\FileSystem\FileSystem::exists($tmpUploadDir)) {
throw new \Exception("could not find temporary upload directory '{$tmpUploadDir}'");
}
$h = opendir($tmpUploadDir);
if ($h) {
while (false !== ($f = readdir($h))) {
// skip folders and thumbnails
if ($f == '..' || $f == '.' || preg_match("/(?:\\.(?:thumb_thumbnail|thumb_medium|thumb_large)\\.[^.]+\$)|(?:\\.thumb)\$/i", $f)) {
continue;
}
//do not overwrite existing files.
$prefix = '';
while (file_exists($depositionTarget . $prefix . $f)) {
if (empty($prefix)) {
$prefix = 0;
}
$prefix++;
}
// move file
try {
$objFile = new \Cx\Lib\FileSystem\File($tmpUploadDir . $f);
$fileInfo = pathinfo($tmpUploadDir . $f);
$objFile->move($depositionTarget . $prefix . $f, false);
$imageName = $prefix . $f;
if (in_array($fileInfo['extension'], array('gif', 'jpg', 'jpeg', 'png'))) {
$objImage = new \ImageManager();
$objImage->_createThumb($this->uploadImgPath, $this->uploadImgWebPath, $imageName, 180);
}
$pic = contrexx_input2raw($this->uploadImgWebPath . $imageName);
// abort after one file has been fetched, as all event upload
// fields do allow a single file only anyway
break;
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
\DBG::msg($e->getMessage());
}
}
}
return $pic;
}
示例15: update_shipments_from_post
/**
* Updates shippers and shipments that have been changed in the form
*
* Backend use only.
* @return boolean True on success, false an failure,
* null on noop.
* @static
*/
static function update_shipments_from_post()
{
if (empty($_POST['bshipment'])) {
return null;
}
$success = true;
$changed = false;
// Update all shipment conditions
if (!empty($_POST['max_weight'])) {
foreach ($_POST['max_weight'] as $shipment_id => $max_weight) {
$max_weight = Weight::getWeight(contrexx_input2raw($max_weight));
$shipper_id = intval($_POST['sid'][$shipment_id]);
$fee = floatval($_POST['fee'][$shipment_id]);
$free_from = floatval($_POST['free_from'][$shipment_id]);
if ($max_weight == Weight::getWeight(self::$arrShipments[$shipper_id][$shipment_id]['max_weight']) && $free_from == self::$arrShipments[$shipper_id][$shipment_id]['free_from'] && $fee == self::$arrShipments[$shipper_id][$shipment_id]['fee']) {
continue;
}
//DBG::log("Shipment::update_shipments_from_post(): max_weight $max_weight == ".self::$arrShipments[$shipper_id][$shipment_id]['max_weight'].", free_from $free_from == ".self::$arrShipments[$shipper_id][$shipment_id]['free_from'].", fee $fee == ".self::$arrShipments[$shipper_id][$shipment_id]['fee']);
$changed = true;
$success &= self::_update_shipment($shipment_id, $shipper_id, $fee, $free_from, $max_weight);
}
}
foreach ($_POST['shipper_name'] as $shipper_id => $shipper_name) {
$shipper_name = contrexx_input2raw($shipper_name);
$active = !empty($_POST['active'][$shipper_id]);
$zone_id = intval($_POST['zone_id'][$shipper_id]);
$zone_id_old = Zones::getZoneIdByShipperId($shipper_id);
if ($shipper_name == self::$arrShippers[$shipper_id]['name'] && $active == self::$arrShippers[$shipper_id]['active'] && $zone_id == $zone_id_old) {
continue;
}
$changed = true;
$success &= self::_update_shipper($shipper_id, $active);
$success &= self::_rename_shipper($shipper_id, $shipper_name);
$success &= Zones::update_shipper_relation($zone_id, $shipper_id);
}
if ($changed) {
return $success;
}
return null;
}