本文整理汇总了PHP中contrexx_raw2db函数的典型用法代码示例。如果您正苦于以下问题:PHP contrexx_raw2db函数的具体用法?PHP contrexx_raw2db怎么用?PHP contrexx_raw2db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contrexx_raw2db函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteNetwork
/**
* Disconnect from a network
*
* @param string $oauth_provider the name of the provider to disconnect from
*/
public function deleteNetwork($oauth_provider)
{
global $objDatabase;
if (!empty($this->networks[$oauth_provider])) {
$objDatabase->Execute("DELETE FROM `" . DBPREFIX . "access_user_network` WHERE `user_id` = " . intval($this->userId) . " AND `oauth_provider` = '" . contrexx_raw2db($oauth_provider) . "'");
unset($this->networks[$oauth_provider]);
}
}
示例2: update
/**
* Update settings.
*
* @access public
* @param array $arrYellowpay
*/
public function update($arrYellowpay)
{
foreach ($arrYellowpay as $name => $value) {
$objResult = $this->objDatabase->Execute('
UPDATE `' . DBPREFIX . 'module_checkout_settings_yellowpay`
SET `value`="' . contrexx_raw2db($value) . '"
WHERE `name`="' . $name . '"
');
if (!$objResult) {
return false;
}
}
return true;
}
示例3: SearchFindContent
/**
* Global search event listener
* Appends the News search results to the search object
*
* @param array $eventArgs
*/
private function SearchFindContent(array $eventArgs)
{
$search = current($eventArgs);
$term_db = contrexx_raw2db($search->getTerm());
$newsLib = new \Cx\Core_Modules\News\Controller\NewsLibrary();
$newsLib->getSettings();
$query = '
SELECT
`id`,
`text` AS "content",
`title`,
`date`,
`redirect`,
MATCH (
`text`,`title`,`teaser_text`
) AGAINST (
"%' . $term_db . '%"
) AS `score`
FROM
`' . DBPREFIX . 'module_news` AS `tblN`
INNER JOIN
`' . DBPREFIX . 'module_news_locale` AS `nl`
ON
`nl`.`news_id` = `tblN`.`id`
WHERE
(
`text` LIKE ("%' . $term_db . '%")
OR `title` LIKE ("%' . $term_db . '%")
OR `teaser_text` LIKE ("%' . $term_db . '%")
)' . $newsLib->getNewsFilterQuery('tblN', '', '');
$pageUrl = function ($pageUri, $searchData) {
static $objNewsLib = null;
if (!$objNewsLib) {
$objNewsLib = new \Cx\Core_Modules\News\Controller\NewsLibrary();
}
if (empty($searchData['redirect'])) {
$newsId = $searchData['id'];
$newsCategories = $objNewsLib->getCategoriesByNewsId($newsId);
$objUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('News', $objNewsLib->findCmdById('details', array_keys($newsCategories)), FRONTEND_LANG_ID, array('newsid' => $newsId));
$pageUrlResult = $objUrl->toString();
} else {
$pageUrlResult = $searchData['redirect'];
}
return $pageUrlResult;
};
$result = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($search->getResultArray($query, 'News', '', $pageUrl, $search->getTerm()));
$search->appendResult($result);
}
示例4: SearchFindContent
/**
* Global search event listener
* Appends the News search results to the search object
*
* @param array $eventArgs
*/
private function SearchFindContent(array $eventArgs)
{
$search = current($eventArgs);
$term_db = contrexx_raw2db($search->getTerm());
$query = "SELECT id, text AS content, title, date, redirect,\n MATCH (text,title,teaser_text) AGAINST ('%{$term_db}%') AS score\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id = tblN.id\n WHERE ( text LIKE ('%{$term_db}%')\n OR title LIKE ('%{$term_db}%')\n OR teaser_text LIKE ('%{$term_db}%'))\n AND lang_id=" . FRONTEND_LANG_ID . "\n AND status=1\n AND is_active=1\n AND (startdate<='" . date('Y-m-d') . "' OR startdate='0000-00-00')\n AND (enddate>='" . date('Y-m-d') . "' OR enddate='0000-00-00')";
$pageUrl = function ($pageUri, $searchData) {
static $objNewsLib = null;
if (!$objNewsLib) {
$objNewsLib = new \Cx\Core_Modules\News\Controller\NewsLibrary();
}
if (empty($searchData['redirect'])) {
$newsId = $searchData['id'];
$newsCategories = $objNewsLib->getCategoriesByNewsId($newsId);
$objUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('News', $objNewsLib->findCmdById('details', array_keys($newsCategories)), FRONTEND_LANG_ID, array('newsid' => $newsId));
$pageUrlResult = $objUrl->toString();
} else {
$pageUrlResult = $searchData['redirect'];
}
return $pageUrlResult;
};
$result = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($search->getResultArray($query, 'News', '', $pageUrl, $search->getTerm()));
$search->appendResult($result);
}
示例5: fixAutoIncrement
/**
* Fix the auto increment for the content_page table
* Ticket #1070 in bug tracker
*
* The last content page have been deleted and the website was moved to another server, in this case
* the auto increment does not match the log's last object_id. This will cause a duplicate primary key.
*/
private function fixAutoIncrement()
{
$database = \Env::get('db');
$result = $database->Execute("SELECT MAX(CONVERT(`object_id`, UNSIGNED)) AS `oldAutoIncrement`\n FROM `" . DBPREFIX . "log_entry`\n WHERE `object_class` = 'Cx\\\\Core\\\\ContentManager\\\\Model\\\\Entity\\\\Page'");
if ($result === false) {
return;
}
$oldAutoIncrement = $result->fields['oldAutoIncrement'] + 1;
$result = $database->Execute("SHOW TABLE STATUS LIKE '" . DBPREFIX . "content_page'");
if ($result !== false && $result->fields['Auto_increment'] < $oldAutoIncrement) {
$result = $database->Execute("ALTER TABLE `" . DBPREFIX . "content_page` AUTO_INCREMENT = " . contrexx_raw2db($oldAutoIncrement));
}
}
示例6: addUser
/**
* Add User in the time of adding a customer based on the account settings
*
* @param String $email user email id
* @param String $password user password
* @param Boolean $sendLoginDetails status
*
* @return boolean
*/
function addUser($email, $password, $sendLoginDetails = false, $result = array(), $id)
{
global $objDatabase, $_CORELANG, $_ARRAYLANG;
$settings = $this->getSettings();
if (!isset($this->contact)) {
$this->contact = new \Cx\Modules\Crm\Model\Entity\CrmContact();
}
$objFWUser = \FWUser::getFWUserObject();
$modify = isset($this->contact->id) && !empty($this->contact->id);
$accountId = 0;
if (!empty($id)) {
$objUsers = $objFWUser->objUser->getUsers($filter = array('id' => intval($id)));
if ($objUsers) {
$accountId = $objUsers->getId();
$email = $objUsers->getEmail();
}
} else {
if (empty($id)) {
$objUsers = $objFWUser->objUser->getUsers($filter = array('email' => addslashes($email)));
if ($objUsers) {
$accountId = $objUsers->getId();
}
}
}
if ($modify) {
$useralExists = $objDatabase->SelectLimit("SELECT id FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_contacts` WHERE user_account = {$accountId}", 1);
if ($useralExists && !empty($useralExists->fields['id']) && !empty($accountId) && intval($useralExists->fields['id']) != $this->contact->id) {
$existId = (int) $useralExists->fields['id'];
$custDetails = $this->getExistCrmDetail($existId);
$existLink = "<a href='index.php?cmd=" . $this->moduleName . "&act=customers&tpl=showcustdetail&id={$existId}' target='_blank'>{$custDetails['customer_name']} {$custDetails['contact_familyname']}</a>";
$this->_strErrMessage = sprintf($_ARRAYLANG['TXT_CRM_CONTACT_ALREADY_EXIST_ERROR'], $existLink);
return false;
}
$this->contact->account_id = $objDatabase->getOne("SELECT user_account FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_contacts` WHERE id = {$this->contact->id}");
if (empty($this->contact->account_id) && !empty($accountId)) {
$objUser = $objFWUser->objUser->getUser($accountId);
// $objUser = new \User($accountId);
} elseif ((!empty($this->contact->account_id) && ($objUser = $objFWUser->objUser->getUser($this->contact->account_id))) === false) {
if (!empty($accountId)) {
$objUser = $objFWUser->objUser->getUser($accountId);
} else {
$objUser = new \User();
$objUser->setPassword($password);
}
} elseif (!empty($accountId) && $useralExists && $useralExists->RecordCount() == 0) {
$objUser = $objFWUser->objUser->getUser($accountId);
} else {
if ((!empty($this->contact->account_id) && ($objUser = $objFWUser->objUser->getUser($this->contact->account_id))) === true) {
if (empty($accountId)) {
$objUser = new \User();
$objUser->setPassword($password);
} else {
$objUser = $objFWUser->objUser->getUser($this->contact->account_id);
}
} else {
if (empty($this->contact->account_id) && empty($accountId)) {
$objUser = new \User();
$objUser->setPassword($password);
}
}
}
} else {
if (empty($accountId)) {
$objUser = new \User();
$objUser->setPassword($password);
} else {
$userExists = $objDatabase->getOne("SELECT id FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_contacts` WHERE user_account = {$accountId}");
if (empty($userExists)) {
$objUser = $objFWUser->objUser->getUser($accountId);
} else {
$custDetails = $this->getExistCrmDetail($userExists);
$existLink = "<a href='index.php?cmd=" . $this->moduleName . "&act=customers&tpl=showcustdetail&id={$userExists}' target='_blank'>{$custDetails['customer_name']} {$custDetails['contact_familyname']}</a>";
$this->_strErrMessage = sprintf($_ARRAYLANG['TXT_CRM_CONTACT_ALREADY_EXIST_ERROR'], $existLink);
return false;
}
}
}
//update/insert additional fields
//company
if (!empty($result['company'])) {
$company = $objDatabase->getOne("SELECT customer_name FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_contacts` WHERE id = '" . $result['company'] . "'");
}
//get default website
foreach ($result['contactwebsite'] as $value) {
if (!empty($value['value']) && $value['primary'] == '1') {
$website = contrexx_raw2db($value['value']);
}
}
//get default phone
foreach ($result['contactphone'] as $value) {
if (!empty($value['value']) && $value['primary'] == '1') {
//.........这里部分代码省略.........
示例7: findBy
/**
* Get multiple themes
* @param array $crit the criterias
* @param array $order the order, e.g. array( 'field' => 'ASC|DESC' )
* @param int $languageId filter by language id
* @return array theme objects
*/
public function findBy($crit = array(), $order = array(), $languageId = null)
{
$query = 'SELECT `id`, `themesname`, `foldername`, `expert` FROM `' . DBPREFIX . 'skins`';
if (!empty($crit)) {
$wheres = array();
foreach ($crit as $field => $value) {
$wheres[] = '`' . $field . '` = \'' . contrexx_raw2db($value) . '\'';
}
$query .= ' WHERE ' . implode(' AND ', $wheres);
}
if (!empty($order)) {
$query .= ' ORDER BY ' . implode(',', $order);
}
$result = $this->db->Execute($query);
$themes = array();
if ($result !== false) {
while (!$result->EOF) {
$themes[] = $this->getTheme($result->fields['id'], $result->fields['themesname'], $result->fields['foldername'], $result->fields['expert'], $languageId);
$result->MoveNext();
}
}
return $themes;
}
示例8: reportIntrusion
/**
* Reports a possible intrusion attempt to the administrator
* @param $type The type of intrusion attempt to report.
* @param $file The file requesting the report (defaults to "Filename not available")
* @param $line The line number requesting the report (defaults to "Linenumber not available")
**/
function reportIntrusion($type, $file = "Filename not available", $line = "Linenumber not available")
{
$objDatabase = \Env::get('db');
$config = \Env::get('config');
$remoteaddr = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "Not set";
$httpxforwardedfor = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : "Not set";
$httpvia = isset($_SERVER['HTTP_VIA']) ? $_SERVER['HTTP_VIA'] : "Not set";
$httpclientip = isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : "Not set";
$gethostbyname = gethostbyname($remoteaddr);
if ($gethostbyname == $remoteaddr) {
$gethostbyname = "No matching hostname";
}
// Add all the user's info to $user
$user = "REMOTE_ADDR : {$remoteaddr}\r\n" . "HTTP_X_FORWARDED_FOR : {$httpxforwardedfor}\r\n" . "HTTP_VIA : {$httpvia}\r\n" . "HTTP_CLIENT_IP : {$httpclientip}\r\n" . "GetHostByName : {$gethostbyname}\r\n";
// Add all requested information
foreach ($this->criticalServerVars as $serverVar) {
$_SERVERlite[$serverVar] = $_SERVER[$serverVar];
}
$httpheaders = function_exists('getallheaders') ? getallheaders() : null;
$gpcs = "";
$gpcs .= $this->getRequestInfo($httpheaders, "HTTP HEADER");
$gpcs .= $this->getRequestInfo($_REQUEST, "REQUEST");
$gpcs .= $this->getRequestInfo($_GET, "GET");
$gpcs .= $this->getRequestInfo($_POST, "POST");
$gpcs .= $this->getRequestInfo($_SERVERlite, "SERVER");
$gpcs .= $this->getRequestInfo($_COOKIE, "COOKIE");
$gpcs .= $this->getRequestInfo($_FILES, "FILES");
$gpcs .= $this->getRequestInfo($_SESSION, "SESSION");
// Get the data to insert in the database
$cdate = time();
$dbuser = htmlspecialchars(addslashes($user), ENT_QUOTES, CONTREXX_CHARSET);
$dbuser = contrexx_raw2db($dbuser);
$dbgpcs = htmlspecialchars(addslashes($gpcs), ENT_QUOTES, CONTREXX_CHARSET);
$dbgpcs = contrexx_raw2db($dbgpcs);
$where = addslashes("{$file} : {$line}");
$where = contrexx_raw2db($where);
// Insert the intrusion in the database
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "ids (timestamp, type, remote_addr, http_x_forwarded_for, http_via, user, gpcs, file)\n VALUES(" . $cdate . ", '" . $type . "', '" . $remoteaddr . "', '" . $httpxforwardedfor . "', '" . $httpvia . "', '" . $dbuser . "', '" . $dbgpcs . "', '" . $where . "')");
// The headers for the e-mail
$emailto = $config['coreAdminName'] . " <" . $config['coreAdminEmail'] . ">";
// The message to send
$message = "DATE : {$cdate}\r\nFILE : {$where}\r\n\r\n{$user}\r\n\r\n{$gpcs}";
// Send the e-mail to the administrator
if (\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
$objMail = new \phpmailer();
if ($config['coreSmtpServer'] > 0 && \Env::get('ClassLoader')->loadFile(ASCMS_CORE_PATH . '/SmtpSettings.class.php')) {
if (($arrSmtp = \SmtpSettings::getSmtpAccount($config['coreSmtpServer'])) !== false) {
$objMail->IsSMTP();
$objMail->Host = $arrSmtp['hostname'];
$objMail->Port = $arrSmtp['port'];
$objMail->SMTPAuth = true;
$objMail->Username = $arrSmtp['username'];
$objMail->Password = $arrSmtp['password'];
}
}
$objMail->CharSet = CONTREXX_CHARSET;
$objMail->SetFrom($config['coreAdminEmail'], $config['coreAdminName']);
$objMail->Subject = $_SERVER['HTTP_HOST'] . " : {$type}";
$objMail->IsHTML(false);
$objMail->Body = $message;
$objMail->AddAddress($emailto);
$objMail->Send();
}
}
示例9: showThread
//.........这里部分代码省略.........
return false;
}
if (strlen(trim($content)) < $this->_minPostlength) {
//content check
$this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_POST_EMPTY'], $this->_minPostlength));
return false;
}
if (false !== ($match = $this->_hasBadWords($content))) {
$this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_BANNED_WORD'], $match[1]));
return false;
}
$fileInfo = $this->_handleUpload('forum_attachment');
if ($fileInfo === false) {
//an error occured, the file wasn't properly transferred. exit function to display error set in _handleUpload()
return false;
}
$lastPostIdQuery = ' SELECT max( id ) as last_post_id
FROM ' . DBPREFIX . 'module_forum_postings
WHERE category_id = ' . $intCatId . '
AND thread_id = ' . $intThreadId;
if (($objRSmaxId = $objDatabase->SelectLimit($lastPostIdQuery, 1)) !== false) {
$intPrevPostId = $objRSmaxId->fields['last_post_id'];
} else {
die('Database error: ' . $objDatabase->ErrorMsg());
}
$insertQuery = 'INSERT INTO ' . DBPREFIX . 'module_forum_postings (
id, category_id, thread_id, prev_post_id,
user_id, time_created, time_edited, is_locked,
is_sticky, rating, views, icon,
keywords, subject, content, attachment
) VALUES (
NULL, ' . $intCatId . ', ' . $intThreadId . ', ' . $intPrevPostId . ',
' . $userId . ', ' . time() . ', 0, 0,
0, 0, 0, ' . $icon . ",\n '{$keywords}' ,'" . $subject . "', '" . contrexx_raw2db($content) . "', '" . $fileInfo['name'] . "'\n )";
if ($objDatabase->Execute($insertQuery) !== false) {
$lastInsertId = $objDatabase->Insert_ID();
$this->updateViewsNewItem($intCatId, $lastInsertId, true);
$this->_updateNotification($intThreadId);
$this->_sendNotifications($intThreadId, $subject, $content);
$pageId = \Cx\Core\Core\Controller\Cx::instanciate()->getPage()->getId();
$cacheManager = new \Cx\Core_Modules\Cache\Controller\CacheManager();
$cacheManager->deleteSingleFile($pageId);
}
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Forum&cmd=thread&id=' . $intThreadId . '&pos=' . $this->_getLastPos($postId, $intThreadId));
die;
}
if (!empty($_REQUEST['preview_new'])) {
$content = \Cx\Core\Wysiwyg\Wysiwyg::prepareBBCodeForOutput($content);
if (false !== ($match = $this->_hasBadWords($content))) {
$this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_BANNED_WORD'], $match[1]));
return false;
}
if (strlen(trim($content)) < $this->_minPostlength) {
//content check
$this->_objTpl->setVariable('TXT_FORUM_ERROR', sprintf('<br />' . $_ARRAYLANG['TXT_FORUM_POST_EMPTY'], $this->_minPostlength));
return false;
}
$this->_objTpl->setVariable(array('FORUM_POST_ROWCLASS' => $intCounter++ % 2 + 1, 'FORUM_POST_DATE' => date(ASCMS_DATE_FORMAT, time()), 'FORUM_USER_ID' => $userId, 'FORUM_USER_NAME' => $objFWUser->objUser->login() ? '<a href="index.php?section=Access&cmd=user&id=' . $userId . '" title="' . htmlentities($objFWUser->objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET) . '">' . htmlentities($objFWUser->objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET) . '</a>' : $this->_anonymousName, 'FORUM_USER_IMAGE' => !empty($arrValues['user_image']) ? '<img border="0" width="60" height="60" src="' . $arrValues['user_image'] . '" title="' . $arrValues['user_name'] . '\'s avatar" alt="' . $arrValues['user_name'] . '\'s avatar" />' : '', 'FORUM_USER_GROUP' => '', 'FORUM_USER_RANK' => '', 'FORUM_USER_REGISTERED_SINCE' => '', 'FORUM_USER_POSTING_COUNT' => '', 'FORUM_USER_CONTACTS' => '', 'FORUM_POST_NUMBER' => '#' . ($this->_postCount + 1), 'FORUM_POST_ICON' => $this->getThreadIcon($icon), 'FORUM_POST_SUBJECT' => stripslashes($subject), 'FORUM_POST_MESSAGE' => $content, 'FORUM_POST_RATING' => '0'));
$this->_objTpl->touchBlock('createPost');
$this->_objTpl->hideBlock('updatePost');
if ($this->_objTpl->blockExists('attachment')) {
$this->_objTpl->hideBlock('attachment');
}
$this->_objTpl->hideBlock('postEdit');
$this->_objTpl->hideBlock('postQuote');
$this->_objTpl->touchBlock('previewNewPost');
示例10: _blogUpdate
function _blogUpdate()
{
global $objDatabase, $_ARRAYLANG, $_CORELANG, $objUpdate, $_CONFIG;
/*
* Check for missing setting "blog_comments_editor" in database. In the update-package for 1.2 this value somehow
* got lost.
*/
$query = ' SELECT name
FROM `' . DBPREFIX . 'module_blog_settings`
WHERE name="blog_comments_editor"
LIMIT 1';
$objResult = $objDatabase->Execute($query);
if ($objResult !== false) {
if ($objResult->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_blog_settings` ( `name` , `value` ) VALUES ('blog_comments_editor', 'wysiwyg')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_categories', array('category_id' => array('type' => 'INT(4)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'is_active' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_comments', array('comment_id' => array('type' => 'INT(7)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'is_active' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'time_created' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'ip_address' => array('type' => 'VARCHAR(15)', 'notnull' => true, 'default' => '0.0.0.0'), 'user_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_name' => array('type' => 'VARCHAR(50)', 'notnull' => false), 'user_mail' => array('type' => 'VARCHAR(250)', 'notnull' => false), 'user_www' => array('type' => 'VARCHAR(255)', 'notnull' => false), 'subject' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'comment' => array('type' => 'TEXT')), array('message_id' => array('fields' => array('message_id'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_message_to_category', array('message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'category_id' => array('type' => 'INT(4)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true)), array('category_id' => array('fields' => array('category_id'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_messages', array('message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'user_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'time_created' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'time_edited' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'hits' => array('type' => 'INT(7)', 'unsigned' => true, 'notnull' => true, 'default' => '0')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_networks_lang', array('network_id' => array('type' => 'INT(8)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_votes', array('vote_id' => array('type' => 'INT(8)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'time_voted' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'ip_address' => array('type' => 'VARCHAR(15)', 'notnull' => true, 'default' => '0.0.0.0'), 'vote' => array('type' => 'ENUM(\'1\',\'2\',\'3\',\'4\',\'5\',\'6\',\'7\',\'8\',\'9\',\'10\')', 'notnull' => true, 'default' => '1')), array('message_id' => array('fields' => array('message_id'))));
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
try {
//update to 2.2.3 in this block
if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.2.3')) {
//we've hidden the wysiwyg - let's default to textarea
\Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'module_blog_settings SET value="textarea" WHERE name="blog_comments_editor"');
//comments: convert escaped db entries to their unescaped equivalents
$rs = \Cx\Lib\UpdateUtil::sql('SELECT comment_id, comment FROM ' . DBPREFIX . 'module_blog_comments');
while (!$rs->EOF) {
$content = $rs->fields['comment'];
$id = $rs->fields['comment_id'];
$content = contrexx_raw2db(html_entity_decode($content, ENT_QUOTES, CONTREXX_CHARSET));
\Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'module_blog_comments SET comment="' . $content . '" WHERE comment_id=' . $id);
$rs->MoveNext();
}
}
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
try {
// migrate content page to version 3.0.1
$search = array('/(.*)/ms');
$callback = function ($matches) {
$content = $matches[1];
if (empty($content)) {
return $content;
}
// replace placeholder {TXT_COMMENT_ADD_SPAM} with {TXT_COMMENT_CAPTCHA}
$content = str_replace('{TXT_COMMENT_ADD_SPAM}', '{TXT_COMMENT_CAPTCHA}', $content);
// replace <img src="[[BLOG_DETAILS_COMMENT_ADD_SPAM_URL]]" alt="[[BLOG_DETAILS_COMMENT_ADD_SPAM_ALT]]" title="[[BLOG_DETAILS_COMMENT_ADD_SPAM_ALT]]" /> with {COMMENT_CAPTCHA_CODE}
$content = preg_replace('/<img[^>]+\\{BLOG_DETAILS_COMMENT_ADD_SPAM_URL\\}[^>]+>/ms', '{COMMENT_CAPTCHA_CODE}', $content);
// remove <input type="text" name="frmAddComment_Captcha" />
$content = preg_replace('/<input[^>]+name\\s*=\\s*[\'"]frmAddComment_Captcha[^>]+>/ms', '', $content);
// remove <input type="hidden" name="frmAddComment_Offset" value="[[BLOG_DETAILS_COMMENT_ADD_SPAM_OFFSET]]" />
$content = preg_replace('/<(div|p)[^>]*>\\s*<input[^>]+name\\s*=\\s*[\'"]frmAddComment_Offset[^>]+>\\s*<\\/(div|p)>/ms', '', $content);
// add missing comment_captcha template block
if (!preg_match('/<!--\\s+BEGIN\\s+comment_captcha\\s+-->.*<!--\\s+END\\s+comment_captcha\\s+-->/ms', $content)) {
$content = preg_replace('/(.*)(<(div|p)[^{]*?>.*?\\{TXT_COMMENT_CAPTCHA\\}.*?\\{COMMENT_CAPTCHA_CODE\\}.*?<\\/\\3>)/ms', '$1<!-- BEGIN comment_captcha -->$2<!-- END comment_captcha -->', $content, -1, $count);
if (!$count) {
$content = preg_replace('/(.*)(<(div|p)[^{]*?>.*?\\{COMMENT_CAPTCHA_CODE\\}.*?<\\/\\3>)/ms', '$1<!-- BEGIN comment_captcha -->$2<!-- END comment_captcha -->', $content, -1, $count);
}
}
return $content;
};
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'blog', 'cmd' => 'details'), $search, $callback, array('content'), '3.0.1');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
/**
* Everything went fine. Return without any errors.
*/
return true;
}
示例11: storeUrlInfos
/**
* Store each crawl result to database
*
* @global array $_CONFIG
*
* @param \HTTP_Request2 $request http_request2() object
* @param String $requestedUrl the requested url
* @param String $refererUrl the lead url
* @param Boolean $image the requested url is image or not
* @param Integer $referPageId the lead url page id
* @param String $requestedUrlText the requested url text
*
* @return null
*/
public function storeUrlInfos(\HTTP_Request2 $request, $requestedUrl, $refererUrl, $image, $referPageId, $requestedUrlText)
{
global $_CONFIG;
try {
$request->setUrl($requestedUrl);
// ignore ssl issues
// otherwise, contrexx does not activate 'https' when the server doesn't have an ssl certificate installed
$request->setConfig(array('ssl_verify_peer' => false, 'ssl_verify_host' => false, 'follow_redirects' => true));
$response = $request->send();
$urlStatus = $response->getStatus();
} catch (\Exception $e) {
$response = true;
$urlStatus = preg_match('#^[mailto:|javascript:]# i', $requestedUrl) ? 200 : 0;
}
if ($response) {
$internalFlag = \Cx\Core_Modules\LinkManager\Controller\Url::isInternalUrl($requestedUrl);
$flagStatus = $urlStatus == '200' ? 1 : 0;
$linkType = $internalFlag ? 'internal' : 'external';
//find the entry name, module name, action and parameter
if ($linkType == 'internal') {
list($entryTitle, $moduleName, $moduleAction, $moduleParams) = $this->getModuleDetails($requestedUrl, $refererUrl, $image);
} else {
$objRefererUrl = $this->isModulePage($refererUrl);
if ($objRefererUrl) {
$entryTitle = $objRefererUrl->getTitle();
}
$moduleName = '';
$moduleAction = '';
$moduleParams = '';
}
if (!empty($referPageId)) {
$backendReferUrl = ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/cadmin/index.php?cmd=ContentManager&page=' . $referPageId;
}
//save the link
$linkInputValues = array('lang' => contrexx_raw2db($this->langId), 'requestedPath' => contrexx_raw2db($requestedUrl), 'refererPath' => contrexx_raw2db($refererUrl), 'leadPath' => contrexx_raw2db($backendReferUrl), 'linkStatusCode' => contrexx_raw2db($urlStatus), 'entryTitle' => contrexx_raw2db($entryTitle), 'moduleName' => contrexx_raw2db($moduleName), 'moduleAction' => contrexx_raw2db($moduleAction), 'moduleParams' => contrexx_raw2db($moduleParams), 'detectedTime' => new \DateTime('now'), 'flagStatus' => contrexx_raw2db($flagStatus), 'linkStatus' => 0, 'linkRecheck' => 0, 'updatedBy' => 0, 'requestedLinkType' => contrexx_raw2db($linkType), 'brokenLinkText' => contrexx_raw2db($requestedUrlText));
$linkAlreadyExist = $this->linkRepo->findOneBy(array('requestedPath' => $requestedUrl));
if ($linkAlreadyExist && $linkAlreadyExist->getRefererPath() == $refererUrl) {
if ($linkAlreadyExist->getLinkStatusCode() != $urlStatus) {
//move the modified link to history table
$historyInputValues = array('lang' => $linkAlreadyExist->getLang(), 'requestedPath' => $linkAlreadyExist->getRequestedPath(), 'refererPath' => $linkAlreadyExist->getRefererPath(), 'leadPath' => $linkAlreadyExist->getLeadPath(), 'linkStatusCode' => $linkAlreadyExist->getLinkStatusCode(), 'entryTitle' => $linkAlreadyExist->getEntryTitle(), 'moduleName' => $linkAlreadyExist->getModuleName(), 'moduleAction' => $linkAlreadyExist->getModuleAction(), 'moduleParams' => $linkAlreadyExist->getModuleParams(), 'detectedTime' => $linkAlreadyExist->getDetectedTime(), 'flagStatus' => $linkAlreadyExist->getFlagStatus(), 'linkStatus' => $linkAlreadyExist->getLinkStatus(), 'linkRecheck' => $linkAlreadyExist->getLinkRecheck(), 'updatedBy' => $linkAlreadyExist->getUpdatedBy(), 'requestedLinkType' => $linkAlreadyExist->getRequestedLinkType(), 'brokenLinkText' => $linkAlreadyExist->getBrokenLinkText());
$this->modifyHistory($historyInputValues);
}
//add the modified link to the link table
$this->modifyLink($linkInputValues, $linkAlreadyExist);
} else {
//add the link to link table
$this->modifyLink($linkInputValues);
}
} else {
return;
}
}
示例12: get
/**
* Gets one or more entries from this DataSource
*
* If an argument is not provided, no restriction is made for this argument.
* So if this is called without any arguments, all entries of this
* DataSource are returned.
* If no entry is found, an empty array is returned.
* @param string $elementId (optional) ID of the element if only one is to be returned
* @param array $filter (optional) field=>value-type condition array, only supports = for now
* @param array $order (optional) field=>order-type array, order is either "ASC" or "DESC"
* @param int $limit (optional) If set, no more than $limit results are returned
* @param int $offset (optional) Entry to start with
* @param array $fieldList (optional) Limits the result to the values for the fields in this list
* @throws \Exception If something did not go as planned
* @return array Two dimensional array (/table) of results (array($row=>array($fieldName=>$value)))
*/
public function get($elementId = null, $filter = array(), $order = array(), $limit = 0, $offset = 0, $fieldList = array())
{
$tableName = DBPREFIX . $this->getIdentifier();
// $elementId
$whereList = array();
if (isset($elementId)) {
$whereList[] = '`id` = "' . contrexx_raw2db($elementId) . '"';
}
// $filter
if (count($filter)) {
foreach ($filter as $field => $value) {
if (count($fieldList) && !in_array($field, $fieldList)) {
continue;
}
$whereList[] = '`' . contrexx_raw2db($field) . '` = "' . contrexx_raw2db($value) . '"';
}
}
// $order
$orderList = array();
if (count($order)) {
foreach ($order as $field => $ascdesc) {
if (count($fieldList) && !in_array($field, $fieldList)) {
continue;
}
if (!in_array($ascdesc, array('ASC', 'DESC'))) {
$ascdesc = 'ASC';
}
$orderList[] = '`' . contrexx_raw2db($field) . '` ' . $ascdesc;
}
}
// $limit, $offset
$limitQuery = '';
if ($limit) {
$limitQuery = 'LIMIT ' . intval($limit);
if ($offset) {
$limitQuery .= ',' . intval($offset);
}
}
// $fieldList
$fieldListQuery = '*';
if (count($fieldList)) {
$fieldListQuery = '`' . implode('`, `', $fieldList) . '`';
}
// query parsing
$whereQuery = '';
if (count($whereList)) {
$whereQuery = 'WHERE ' . implode(' AND ', $whereList);
}
$orderQuery = '';
if (count($orderList)) {
$orderQuery = 'ORDER BY ' . implode(', ', $orderList);
}
$query = '
SELECT
' . $fieldListQuery . '
FROM
`' . $tableName . '`
' . $whereQuery . '
' . $orderQuery . '
' . $limitQuery . '
';
$result = $this->cx->getDb()->getAdoDb()->query($query);
$data = array();
while (!$result->EOF) {
$data[] = $result->fields;
$result->MoveNext();
}
return $data;
//new \Cx\Core_Modules\Listing\Model\Entity\DataSet($data);//array($query);
}
示例13: updateCustomerMail
/**
* Update customer mail.
*
* @access public
* @param array $arrCustomerMail
*/
public function updateCustomerMail($arrCustomerMail)
{
$objResult = $this->objDatabase->Execute('
UPDATE `' . DBPREFIX . 'module_checkout_settings_mails`
SET `title`="' . contrexx_raw2db($arrCustomerMail['title']) . '",
`content`="' . contrexx_raw2db($arrCustomerMail['content']) . '"
WHERE `id`=2
');
if ($objResult) {
return true;
} else {
return false;
}
}
示例14: process
//.........这里部分代码省略.........
// grams
if ($weight == '') {
$weight = 0;
}
// Add to order items table
$result = $objOrder->insertItem($order_id, $product_id, $name, $price, $quantity, $vat_rate, $weight, $arrProduct['options']);
if (!$result) {
unset($_SESSION['shop']['order_id']);
// TODO: Verify error message set by Order::insertItem()
return false;
}
// Store the Product Coupon, if applicable.
// Note that it is not redeemed yet (uses=0)!
if ($coupon_code) {
$objCoupon = Coupon::available($coupon_code, $item_total, self::$objCustomer->id(), $product_id, $payment_id);
if ($objCoupon) {
//\DBG::log("Shop::process(): Got Coupon for Product ID $product_id: ".var_export($objCoupon, true));
if (!$objCoupon->redeem($order_id, self::$objCustomer->id(), $price * $quantity, 0)) {
// TODO: Do something if the Coupon does not work
\DBG::log("Shop::process(): ERROR: Failed to store Coupon for Product ID {$product_id}");
}
$coupon_code = null;
}
}
}
// foreach product in cart
// Store the Global Coupon, if applicable.
// Note that it is not redeemed yet (uses=0)!
//\DBG::log("Shop::process(): Looking for global Coupon $coupon_code");
if ($coupon_code) {
$objCoupon = Coupon::available($coupon_code, $items_total, self::$objCustomer->id(), null, $payment_id);
if ($objCoupon) {
//\DBG::log("Shop::process(): Got global Coupon: ".var_export($objCoupon, true));
if (!$objCoupon->redeem($order_id, self::$objCustomer->id(), $items_total, 0)) {
\DBG::log("Shop::process(): ERROR: Failed to store global Coupon");
}
}
}
\Message::restore();
$processor_id = Payment::getProperty($_SESSION['shop']['paymentId'], 'processor_id');
$processor_name = PaymentProcessing::getPaymentProcessorName($processor_id);
// other payment methods
PaymentProcessing::initProcessor($processor_id);
// TODO: These arguments are no longer valid. Set them up later?
// Currency::getActiveCurrencyCode(),
// FWLanguage::getLanguageParameter(FRONTEND_LANG_ID, 'lang'));
// if the processor is Internal_LSV, and there is account information,
// store the information.
if ($processor_name == 'internal_lsv') {
if (!self::lsv_complete()) {
// Missing mandatory data; return to payment
unset($_SESSION['shop']['order_id']);
\Message::error($_ARRAYLANG['TXT_ERROR_ACCOUNT_INFORMATION_NOT_AVAILABLE']);
\Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'payment'));
}
$query = "\n INSERT INTO " . DBPREFIX . "module_shop" . MODULE_INDEX . "_lsv (\n order_id, holder, bank, blz\n ) VALUES (\n {$order_id},\n '" . contrexx_raw2db($_SESSION['shop']['account_holder']) . "',\n '" . contrexx_raw2db($_SESSION['shop']['account_bank']) . "',\n '" . contrexx_raw2db($_SESSION['shop']['account_blz']) . "'\n )";
$objResult = $objDatabase->Execute($query);
if (!$objResult) {
// Return to payment
unset($_SESSION['shop']['order_id']);
\Message::error($_ARRAYLANG['TXT_ERROR_INSERTING_ACCOUNT_INFORMATION']);
\Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'payment'));
}
}
$_SESSION['shop']['order_id_checkin'] = $order_id;
$strProcessorType = PaymentProcessing::getCurrentPaymentProcessorType();
// Test whether the selected payment method can be
// considered an instant or deferred one.
// This is used to set the order status at the end
// of the shopping process.
// TODO: Invert this flag, as it may no longer be present after paying
// online using one of the external payment methods! Ensure that it is set
// instead when paying "deferred".
$_SESSION['shop']['isInstantPayment'] = false;
if ($strProcessorType == 'external') {
// For the sake of simplicity, all external payment
// methods are considered to be 'instant'.
// All currently implemented internal methods require
// further action from the merchant, and thus are
// considered to be 'deferred'.
$_SESSION['shop']['isInstantPayment'] = true;
}
// Send the Customer login separately, as the password possibly
// won't be available later
if (!empty($_SESSION['shop']['password'])) {
self::sendLogin(self::$objCustomer->email(), $_SESSION['shop']['password']);
}
// Show payment processing page.
// Note that some internal payments are redirected away
// from this page in checkOut():
// 'internal', 'internal_lsv'
self::$objTemplate->setVariable('SHOP_PAYMENT_PROCESSING', PaymentProcessing::checkOut());
// Clear the order ID.
// The order may be resubmitted and the payment retried.
unset($_SESSION['shop']['order_id']);
// Custom.
// Enable if Discount class is customized and in use.
//self::showCustomerDiscount(Cart::get_price());
return true;
}
示例15: update
/**
* Update currencies
* @return boolean Null if nothing was changed,
* boolean true upon storing everything
* successfully, or false otherwise
* @static
*/
static function update()
{
global $objDatabase;
if (empty($_POST['currency'])) {
return null;
}
self::init();
$default_id = isset($_POST['currencyDefault']) ? intval($_POST['currencyDefault']) : self::$defaultCurrencyId;
$changed = false;
foreach ($_POST['currencyCode'] as $currency_id => $code) {
$code = contrexx_input2raw($code);
$name = contrexx_input2raw($_POST['currencyName'][$currency_id]);
$symbol = contrexx_input2raw($_POST['currencySymbol'][$currency_id]);
$rate = floatval($_POST['currencyRate'][$currency_id]);
$increment = floatval($_POST['currencyIncrement'][$currency_id]);
if ($increment <= 0) {
$increment = 0.01;
}
$default = $default_id == $currency_id ? 1 : 0;
$active = empty($_POST['currencyActive'][$currency_id]) ? 0 : 1;
// The default currency must be activated
$active = $default ? 1 : $active;
if ($code == self::$arrCurrency[$currency_id]['code'] && $name == self::$arrCurrency[$currency_id]['name'] && $symbol == self::$arrCurrency[$currency_id]['symbol'] && $rate == self::$arrCurrency[$currency_id]['rate'] && $increment == self::$arrCurrency[$currency_id]['increment'] && $active == self::$arrCurrency[$currency_id]['active'] && $default == self::$arrCurrency[$currency_id]['default']) {
continue;
}
$query = "\n UPDATE `" . DBPREFIX . "module_shop" . MODULE_INDEX . "_currencies`\n SET `code`='" . contrexx_raw2db($code) . "',\n `symbol`='" . contrexx_raw2db($symbol) . "',\n `rate`={$rate},\n `increment`={$increment},\n `active`={$active}\n WHERE `id`={$currency_id}";
if (!$objDatabase->Execute($query)) {
return false;
}
$changed = true;
if (!\Text::replace($currency_id, FRONTEND_LANG_ID, 'Shop', self::TEXT_NAME, contrexx_input2raw($_POST['currencyName'][$currency_id]))) {
return false;
}
}
// end foreach
if ($changed) {
return self::setDefault($default_id);
}
return null;
}