本文整理汇总了PHP中acymailing_secureField函数的典型用法代码示例。如果您正苦于以下问题:PHP acymailing_secureField函数的具体用法?PHP acymailing_secureField怎么用?PHP acymailing_secureField使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acymailing_secureField函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveForm
function saveForm()
{
$rule = new stdClass();
$rule->ruleid = acymailing_getCID('ruleid');
if (empty($rule->ruleid)) {
$this->database->setQuery('SELECT max(ordering) FROM `#__acymailing_rules`');
$rule->ordering = intval($this->database->loadResult()) + 1;
}
$rule->executed_on = '';
$rule->action_message = '';
$rule->action_user = '';
$formData = JRequest::getVar('data', array(), '', 'array');
foreach ($formData['rule'] as $column => $value) {
acymailing_secureField($column);
if (is_array($value)) {
$rule->{$column} = serialize($value);
} else {
$rule->{$column} = strip_tags($value);
}
}
$ruleid = $this->save($rule);
if (!$ruleid) {
return false;
}
JRequest::setVar('ruleid', $ruleid);
return true;
}
示例2: saveForm
function saveForm()
{
$app = JFactory::getApplication();
$template = new stdClass();
$template->tempid = acymailing_getCID('tempid');
$formData = JRequest::getVar('data', array(), '', 'array');
foreach ($formData['template'] as $column => $value) {
acymailing_secureField($column);
$template->{$column} = strip_tags($value);
}
$styles = JRequest::getVar('styles', array(), '', 'array');
foreach ($styles as $class => $oneStyle) {
$styles[$class] = str_replace('"', "'", $oneStyle);
if (empty($oneStyle)) {
unset($styles[$class]);
}
}
$newStyles = JRequest::getVar('otherstyles', array(), '', 'array');
if (!empty($newStyles)) {
foreach ($newStyles['classname'] as $id => $className) {
if (!empty($className) and $className != JText::_('CLASS_NAME') and !empty($newStyles['style'][$id]) and $newStyles['style'][$id] != JText::_('CSS_STYLE')) {
$className = str_replace(array(',', ' ', ':', '.', '#'), '', $className);
$styles[$className] = str_replace('"', "'", $newStyles['style'][$id]);
}
}
}
$template->styles = serialize($styles);
$template->body = JRequest::getVar('editor_body', '', '', 'string', JREQUEST_ALLOWRAW);
if (!empty($styles['color_bg'])) {
$pat1 = '#^([^<]*<[^>]*background-color:)([^;">]{1,30})#i';
$found = false;
if (preg_match($pat1, $template->body)) {
$template->body = preg_replace($pat1, '$1' . $styles['color_bg'], $template->body);
$found = true;
}
$pat2 = '#^([^<]*<[^>]*bgcolor=")([^;">]{1,10})#i';
if (preg_match($pat2, $template->body)) {
$template->body = preg_replace($pat2, '$1' . $styles['color_bg'], $template->body);
$found = true;
}
if (!$found) {
$template->body = '<div style="background-color:' . $styles['color_bg'] . ';" width="100%">' . $template->body . '</div>';
}
}
$acypluginsHelper = acymailing_get('helper.acyplugins');
$acypluginsHelper->cleanHtml($template->body);
$template->description = JRequest::getVar('editor_description', '', '', 'string', JREQUEST_ALLOWRAW);
$tempid = $this->save($template);
if (!$tempid) {
return false;
}
if (empty($template->tempid)) {
$orderClass = acymailing_get('helper.order');
$orderClass->pkey = 'tempid';
$orderClass->table = 'template';
$orderClass->reOrder();
}
JRequest::setVar('tempid', $tempid);
return true;
}
示例3: saveForm
function saveForm()
{
$app = JFactory::getApplication();
$action = new stdClass();
$action->action_id = acymailing_getCID('action_id');
$formData = JRequest::getVar('data', array(), '', 'array');
foreach ($formData['action'] as $column => $value) {
if ($app->isAdmin() || $this->allowedField('action', $column)) {
acymailing_secureField($column);
$action->{$column} = strip_tags($value);
}
}
if (empty($action->action_id)) {
$action->nextdate = time() + intval($action->frequency);
}
if ($action->password == '********') {
unset($action->password);
}
$action->conditions = json_encode($formData['conditions']);
$action->actions = json_encode($formData['actions']);
if (isset($action->published) && $action->published != 1) {
$action->published = 0;
}
$action_id = $this->save($action);
if (!$action_id) {
return false;
}
JRequest::setVar('action_id', $action_id);
return true;
}
示例4: saveForm
function saveForm()
{
$app = JFactory::getApplication();
$list = new stdClass();
$list->listid = acymailing_getCID('listid');
$formData = JRequest::getVar('data', array(), '', 'array');
if (!empty($formData['list']['category']) && $formData['list']['category'] == -1) {
$formData['list']['category'] = JRequest::getString('newcategory', '');
}
foreach ($formData['list'] as $column => $value) {
if ($app->isAdmin() || $this->allowedField('list', $column)) {
acymailing_secureField($column);
$list->{$column} = strip_tags($value);
}
}
$list->description = JRequest::getVar('editor_description', '', '', 'string', JREQUEST_ALLOWHTML);
if (isset($list->published) && $list->published != 1) {
$list->published = 0;
}
$listid = $this->save($list);
if (!$listid) {
return false;
}
if (empty($list->listid)) {
$orderClass = acymailing_get('helper.order');
$orderClass->pkey = 'listid';
$orderClass->table = 'list';
$orderClass->groupMap = 'type';
$orderClass->groupVal = empty($list->type) ? $this->type : $list->type;
$orderClass->reOrder();
$this->newlist = true;
}
if (!empty($formData['listcampaign'])) {
$affectedLists = array();
foreach ($formData['listcampaign'] as $affectlistid => $receiveme) {
if (!empty($receiveme)) {
$affectedLists[] = $affectlistid;
}
}
$listCampaignClass = acymailing_get('class.listcampaign');
$listCampaignClass->save($listid, $affectedLists);
}
JRequest::setVar('listid', $listid);
return true;
}
示例5: acymailing_generateautonews
//.........这里部分代码省略.........
$where[] = implode(' OR ', $metaWhere);
}
}
$where[] = '`publish_up` < \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\'';
$where[] = '`publish_down` > \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\' OR `publish_down` = 0';
$where[] = 'state = 1';
if (!ACYMAILING_J16) {
if (isset($parameter->access)) {
$where[] = 'access <= ' . intval($parameter->access);
} else {
if ($this->params->get('contentaccess', 'registered') == 'registered') {
$where[] = 'access <= 1';
} elseif ($this->params->get('contentaccess', 'registered') == 'public') {
$where[] = 'access = 0';
}
}
} elseif (isset($parameter->access)) {
$where[] = 'access = ' . intval($parameter->access);
}
if (!empty($parameter->language)) {
$allLanguages = explode(',', $parameter->language);
$langWhere = 'language IN (';
foreach ($allLanguages as $oneLanguage) {
$langWhere .= $db->Quote(trim($oneLanguage)) . ',';
}
$where[] = trim($langWhere, ',') . ')';
}
$query .= ' WHERE (' . implode(') AND (', $where) . ')';
if (!empty($parameter->order)) {
if ($parameter->order == 'rand') {
$query .= ' ORDER BY rand()';
} else {
$ordering = explode(',', $parameter->order);
$query .= ' ORDER BY `' . acymailing_secureField($ordering[0]) . '` ' . acymailing_secureField($ordering[1]) . ' , a.`id` DESC';
}
}
$start = '';
if (!empty($parameter->start)) {
$start = intval($parameter->start) . ',';
}
if (empty($parameter->max)) {
$parameter->max = 100;
}
$query .= ' LIMIT ' . $start . (int) $parameter->max;
$db->setQuery($query);
$allArticles = acymailing_loadResultArray($db);
if (!empty($parameter->min) and count($allArticles) < $parameter->min) {
$return->status = false;
$return->message = 'Not enough articles for the tag ' . $oneTag . ' : ' . count($allArticles) . ' / ' . $parameter->min . ' between ' . acymailing_getDate($email->params['lastgenerateddate']) . ' and ' . acymailing_getDate($time);
}
$stringTag = empty($parameter->noentrytext) ? '' : $parameter->noentrytext;
if (!empty($allArticles)) {
if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'autocontent.php')) {
ob_start();
require ACYMAILING_MEDIA . 'plugins' . DS . 'autocontent.php';
$stringTag = ob_get_clean();
} else {
$arrayElements = array();
$numArticle = 1;
foreach ($allArticles as $oneArticleId) {
$args = array();
$args[] = 'joomlacontent:' . $oneArticleId;
$args[] = 'num:' . $numArticle++;
if (!empty($parameter->type)) {
$args[] = 'type:' . $parameter->type;
}
示例6: onAcyTriggerFct_displayUserValues
function onAcyTriggerFct_displayUserValues()
{
$num = JRequest::getInt('num');
$map = JRequest::getCmd('map');
$cond = JRequest::getVar('cond', '', '', 'string', JREQUEST_ALLOWRAW);
$value = JRequest::getVar('value', '', '', 'string', JREQUEST_ALLOWRAW);
$emptyInputReturn = '<input onchange="countresults(' . $num . ')" class="inputbox" type="text" name="filter[' . $num . '][joomlafield][value]" id="filter' . $num . 'joomlafieldvalue" style="width:200px" value="' . $value . '">';
$dateInput = '<input onclick="displayDatePicker(this,event)" onchange="countresults(' . $num . ')" class="inputbox" type="text" name="filter[' . $num . '][joomlafield][value]" id="filter' . $num . 'joomlafieldvalue" style="width:200px" value="' . $value . '">';
if (in_array($map, array('registerDate', 'lastvisitDate', 'lastResetTime'))) {
return $dateInput;
}
if (empty($map) || in_array($map, array('password', 'params', 'optKey', 'otep')) || !in_array($cond, array('=', '!='))) {
return $emptyInputReturn;
}
$db = JFactory::getDBO();
$db->setQuery('SELECT DISTINCT `' . acymailing_secureField($map) . '` AS value FROM #__users LIMIT 100');
$prop = $db->loadObjectList();
if (empty($prop) || count($prop) >= 100 || count($prop) == 1 && (empty($prop[0]->value) || $prop[0]->value == '-')) {
return $emptyInputReturn;
}
return JHTML::_('select.genericlist', $prop, "filter[{$num}][joomlafield][value]", 'onchange="countresults(' . $num . ')" class="inputbox" size="1" style="width:200px"', 'value', 'value', $value, 'filter' . $num . 'joomlafieldvalue');
}
示例7: _getDataFromDB
private function _getDataFromDB($field, $valueField, $titleField)
{
$tableName = acymailing_secureField($field->options['tableName']);
$dbName = acymailing_secureField($field->options['dbName']);
$whereCond = !empty($field->options['whereCond']) ? $field->options['whereCond'] : '';
$whereOp = !empty($field->options['whereOperator']) ? $field->options['whereOperator'] : '';
$whereValue = !empty($field->options['whereValue']) ? $field->options['whereValue'] : '';
$orderByField = !empty($field->options['orderField']) ? acymailing_secureField($field->options['orderField']) : '';
$orderByValue = !empty($field->options['orderValue']) ? acymailing_secureField($field->options['orderValue']) : '';
if ($dbName == 'current') {
$this->database->setQuery('SELECT DATABASE()');
$dbName = $this->database->loadResult();
}
$query = 'SELECT `' . $valueField . '`, `' . $titleField . '` FROM `' . $dbName . '`.`' . $tableName . '`';
$query .= ' WHERE `' . $valueField . '`<>\'\' AND `' . $titleField . '`<>\'\'';
if (!empty($whereValue) && !empty($whereCond)) {
$filterClass = acymailing_get('class.filter');
$queryClass = new acyQuery();
$query .= ' AND ' . $queryClass->convertQuery($tableName, $whereCond, $whereOp, $whereValue);
}
$query .= ' GROUP BY `' . $valueField . '`, `' . $titleField . '`';
$query .= !empty($orderByField) ? ' ORDER BY `' . $orderByField . '` ' . $orderByValue : '';
try {
$this->database->setQuery($query);
$res = $this->database->loadObjectList();
} catch (Exception $e) {
acymailing_display($e->getMessage(), 'error');
$res = array();
}
return $res;
}
示例8: doexport
function doexport()
{
if (!$this->isAllowed('subscriber', 'export')) {
return;
}
JRequest::checkToken() or die('Invalid Token');
acymailing_increasePerf();
$filtersExport = JRequest::getVar('exportfilter');
$listsToExport = JRequest::getVar('exportlists');
$fieldsToExport = JRequest::getVar('exportdata');
$inseparator = JRequest::getString('exportseparator');
$inseparator = str_replace(array('semicolon', 'colon', 'comma'), array(';', ',', ','), $inseparator);
$exportFormat = JRequest::getString('exportformat');
if (!in_array($inseparator, array(',', ';'))) {
$inseparator = ';';
}
$exportLists = array();
if (!empty($filtersExport['subscribed'])) {
foreach ($listsToExport as $listid => $checked) {
if (!empty($checked)) {
$exportLists[] = (int) $listid;
}
}
}
$exportFields = array();
foreach ($fieldsToExport as $fieldName => $checked) {
if (!empty($checked)) {
$exportFields[] = acymailing_secureField($fieldName);
}
}
$config = acymailing_config();
$newConfig = new stdClass();
$newConfig->export_fields = implode(',', $exportFields);
$newConfig->export_lists = implode(',', $exportLists);
$newConfig->export_separator = JRequest::getString('exportseparator');
$newConfig->export_format = $exportFormat;
$config->save($newConfig);
$where = array();
if (empty($exportLists)) {
$querySelect = 'SELECT s.`' . implode('`,s.`', $exportFields) . '` FROM ' . acymailing_table('subscriber') . ' as s';
} else {
$querySelect = 'SELECT DISTINCT s.`' . implode('`,s.`', $exportFields) . '` FROM ' . acymailing_table('listsub') . ' as a JOIN ' . acymailing_table('subscriber') . ' as s on a.subid = s.subid';
$where[] = 'a.listid IN (' . implode(',', $exportLists) . ')';
$where[] = 'a.status = 1';
}
if (!empty($filtersExport['confirmed'])) {
$where[] = 's.confirmed = 1';
}
if (!empty($filtersExport['registered'])) {
$where[] = 's.userid > 0';
}
if (!empty($filtersExport['enabled'])) {
$where[] = 's.enabled = 1';
}
if (JRequest::getInt('sessionvalues') and !empty($_SESSION['acymailing']['exportusers'])) {
$where[] = 's.subid IN (' . implode(',', $_SESSION['acymailing']['exportusers']) . ')';
}
if (JRequest::getInt('sessionquery')) {
$currentSession = JFactory::getSession();
$exportQuery = $currentSession->get('acyexportquery');
if (!empty($exportQuery)) {
$where[] = 's.subid IN (' . $exportQuery . ')';
}
}
$query = $querySelect;
if (!empty($where)) {
$query .= ' WHERE (' . implode(') AND (', $where) . ')';
}
$db = JFactory::getDBO();
$db->setQuery($query);
$allData = $db->loadAssocList();
$encodingClass = acymailing_get('helper.encoding');
$exportHelper = acymailing_get('helper.export');
$exportHelper->addHeaders('acymailingexport');
$eol = "\r\n";
$before = '"';
$separator = '"' . $inseparator . '"';
$after = '"';
echo $before . implode($separator, $exportFields) . $after . $eol;
for ($i = 0, $a = count($allData); $i < $a; $i++) {
if (!empty($allData[$i]['created'])) {
$allData[$i]['created'] = acymailing_getDate($allData[$i]['created'], '%Y-%m-%d %H:%M:%S');
}
echo $before . $encodingClass->change(implode($separator, $allData[$i]), 'UTF-8', $exportFormat) . $after . $eol;
}
exit;
}
示例9: doexport
function doexport()
{
if (!$this->isAllowed('subscriber', 'export')) {
return;
}
JRequest::checkToken() or die('Invalid Token');
acymailing_increasePerf();
$filtersExport = JRequest::getVar('exportfilter');
$listsToExport = JRequest::getVar('exportlists');
$fieldsToExport = JRequest::getVar('exportdata');
$inseparator = JRequest::getString('exportseparator');
$exportFormat = JRequest::getString('exportformat');
if (!in_array($inseparator, array(',', ';'))) {
$inseparator = ';';
}
$exportLists = array();
if (!empty($filtersExport['subscribed'])) {
foreach ($listsToExport as $listid => $checked) {
if (!empty($checked)) {
$exportLists[] = (int) $listid;
}
}
}
$exportFields = array();
foreach ($fieldsToExport as $fieldName => $checked) {
if (!empty($checked)) {
$exportFields[] = acymailing_secureField($fieldName);
}
}
$config = acymailing_config();
$newConfig = new stdClass();
$newConfig->export_fields = implode(',', $exportFields);
$newConfig->export_separator = $inseparator;
$newConfig->export_format = $exportFormat;
$config->save($newConfig);
$where = array();
if (empty($exportLists)) {
$querySelect = 'SELECT s.`' . implode('`,s.`', $exportFields) . '` FROM ' . acymailing_table('subscriber') . ' as s';
} else {
$querySelect = 'SELECT DISTINCT s.`' . implode('`,s.`', $exportFields) . '` FROM ' . acymailing_table('listsub') . ' as a JOIN ' . acymailing_table('subscriber') . ' as s on a.subid = s.subid';
$where[] = 'a.listid IN (' . implode(',', $exportLists) . ')';
$where[] = 'a.status = 1';
}
if (!empty($filtersExport['confirmed'])) {
$where[] = 's.confirmed = 1';
}
if (!empty($filtersExport['registered'])) {
$where[] = 's.userid > 0';
}
if (JRequest::getInt('sessionvalues') and !empty($_SESSION['acymailing']['exportusers'])) {
$where[] = 's.subid IN (' . implode(',', $_SESSION['acymailing']['exportusers']) . ')';
}
if (JRequest::getInt('sessionquery')) {
$currentSession =& JFactory::getSession();
$exportQuery = $currentSession->get('acyexportquery');
if (!empty($exportQuery)) {
$where[] = 's.subid IN (' . $exportQuery . ')';
}
}
$query = $querySelect;
if (!empty($where)) {
$query .= ' WHERE (' . implode(') AND (', $where) . ')';
}
$db =& JFactory::getDBO();
$db->setQuery($query);
$allData = $db->loadAssocList();
$encodingClass = acymailing_get('helper.encoding');
@ob_clean();
header("Pragma: public");
header("Expires: 0");
// set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=acymailingexport.csv;");
header("Content-Transfer-Encoding: binary");
$eol = "\r\n";
$before = '"';
$separator = '"' . $inseparator . '"';
$after = '"';
echo $before . implode($separator, $exportFields) . $after . $eol;
for ($i = 0, $a = count($allData); $i < $a; $i++) {
if (!empty($allData[$i]['created'])) {
$allData[$i]['created'] = acymailing_getDate($allData[$i]['created'], '%Y-%m-%d %H:%M:%S');
}
echo $before . $encodingClass->change(implode($separator, $allData[$i]), 'UTF-8', $exportFormat) . $after . $eol;
}
exit;
}
示例10: checkFields
function checkFields(&$data, &$subscriber)
{
foreach ($data as $column => $value) {
$column = trim(strtolower($column));
if ($this->allowModif || !in_array($column, $this->restrictedFields)) {
acymailing_secureField($column);
if (is_array($value)) {
if (isset($value['day']) || isset($value['month']) || isset($value['year'])) {
$value = (empty($value['year']) ? '0000' : intval($value['year'])) . '-' . (empty($value['month']) ? '00' : $value['month']) . '-' . (empty($value['day']) ? '00' : $value['day']);
} else {
$value = implode(',', $value);
}
}
$subscriber->{$column} = trim(strip_tags($value));
if (!is_numeric($subscriber->{$column})) {
if (function_exists('mb_detect_encoding') && mb_detect_encoding($subscriber->{$column}, 'UTF-8', true) != 'UTF-8') {
$subscriber->{$column} = utf8_encode($subscriber->{$column});
} elseif (!function_exists('mb_detect_encoding') && !preg_match('%^(?:[\\x09\\x0A\\x0D\\x20-\\x7E]|[\\xC2-\\xDF][\\x80-\\xBF]|\\xE0[\\xA0-\\xBF][\\x80-\\xBF]|[\\xE1-\\xEC\\xEE\\xEF][\\x80-\\xBF]{2}|\\xED[\\x80-\\x9F][\\x80-\\xBF]|\\xF0[\\x90-\\xBF][\\x80-\\xBF]{2}|[\\xF1-\\xF3][\\x80-\\xBF]{3}|\\xF4[\\x80-\\x8F][\\x80-\\xBF]{2})*$%xs', $subscriber->{$column})) {
$subscriber->{$column} = utf8_encode($subscriber->{$column});
}
}
}
}
if (!acymailing_level(3) || empty($_FILES)) {
return;
}
jimport('joomla.filesystem.file');
$config = acymailing_config();
$uploadFolder = trim(JPath::clean(html_entity_decode(acymailing_getFilesFolder())), DS . ' ') . DS;
$uploadPath = JPath::clean(ACYMAILING_ROOT . $uploadFolder . 'userfiles' . DS);
acymailing_createDir(JPath::clean(ACYMAILING_ROOT . $uploadFolder), true);
acymailing_createDir($uploadPath, true);
foreach ($_FILES as $typename => $type) {
$type2 = isset($type['name']['subscriber']) ? $type['name']['subscriber'] : $type['name'];
if (empty($type2)) {
continue;
}
foreach ($type2 as $fieldname => $filename) {
if (empty($filename)) {
continue;
}
acymailing_secureField($fieldname);
$attachment = new stdClass();
$filename = JFile::makeSafe(strtolower(strip_tags($filename)));
$attachment->filename = time() . rand(1, 999) . '_' . $filename;
while (file_exists($uploadPath . $attachment->filename)) {
$attachment->filename = time() . rand(1, 999) . '_' . $filename;
}
if (!preg_match('#\\.(' . str_replace(array(',', '.'), array('|', '\\.'), $config->get('allowedfiles')) . ')$#Ui', $attachment->filename, $extension) || preg_match('#\\.(php.?|.?htm.?|pl|py|jsp|asp|sh|cgi)#Ui', $attachment->filename)) {
echo "<script>alert('" . JText::sprintf('ACCEPTED_TYPE', substr($attachment->filename, strrpos($attachment->filename, '.') + 1), $config->get('allowedfiles')) . "');window.history.go(-1);</script>";
exit;
}
$attachment->filename = str_replace(array('.', ' '), '_', substr($attachment->filename, 0, strpos($attachment->filename, $extension[0]))) . $extension[0];
$tmpFile = isset($type['name']['subscriber']) ? $_FILES[$typename]['tmp_name']['subscriber'][$fieldname] : $_FILES[$typename]['tmp_name'][$fieldname];
if (!JFile::upload($tmpFile, $uploadPath . $attachment->filename)) {
echo "<script>alert('" . JText::sprintf('FAIL_UPLOAD', '<b><i>' . $tmpFile . '</i></b>', '<b><i>' . $uploadPath . $attachment->filename . '</i></b>') . "');window.history.go(-1);</script>";
exit;
}
$subscriber->{$fieldname} = $attachment->filename;
}
}
}
示例11: secureField
static function secureField($fieldName)
{
return acymailing_secureField($fieldName);
}
示例12: acymailing_generateautonews
function acymailing_generateautonews(&$email)
{
$tags = $this->acypluginsHelper->extractTags($email, 'hikashop_auto_product');
$return = new stdClass();
$return->status = true;
$return->message = '';
$this->tags = array();
if (empty($tags)) {
return $return;
}
foreach ($tags as $oneTag => $parameter) {
if (isset($this->tags[$oneTag])) {
continue;
}
$allcats = explode('-', $parameter->id);
$selectedArea = array();
foreach ($allcats as $oneCat) {
if (empty($oneCat)) {
continue;
}
$selectedArea[] = intval($oneCat);
}
$query = 'SELECT DISTINCT b.`product_id` FROM ' . acymailing_table('hikashop_product_category', false) . ' as a LEFT JOIN ' . acymailing_table('hikashop_product', false) . ' as b ON a.product_id = b.product_id';
$where = array();
if ($this->params->get('stock', 0) == '1') {
$where[] = '(b.product_quantity = -1 || b.product_quantity > 0)';
}
if (!empty($selectedArea)) {
$where[] = 'a.category_id IN (' . implode(',', $selectedArea) . ')';
}
$where[] = "b.`product_published` = 1";
if (!empty($parameter->filter) and !empty($email->params['lastgenerateddate'])) {
$condition = 'b.`product_created` >\'' . $email->params['lastgenerateddate'] . '\'';
if ($parameter->filter == 'modify') {
$condition .= ' OR b.`product_modified` >\'' . $email->params['lastgenerateddate'] . '\'';
}
$where[] = $condition;
}
$query .= ' WHERE (' . implode(') AND (', $where) . ')';
if (!empty($parameter->order)) {
$ordering = explode(',', $parameter->order);
if ($ordering[0] == 'rand') {
$query .= ' ORDER BY rand()';
} else {
$query .= ' ORDER BY b.`' . acymailing_secureField(trim($ordering[0])) . '` ' . acymailing_secureField(trim($ordering[1]));
}
}
if (!empty($parameter->max)) {
$query .= ' LIMIT ' . (int) $parameter->max;
}
$this->db->setQuery($query);
$allArticles = acymailing_loadResultArray($this->db);
if (!empty($parameter->min) && count($allArticles) < $parameter->min) {
$return->status = false;
$return->message = 'Not enough products for the tag ' . $oneTag . ' : ' . count($allArticles) . ' / ' . $parameter->min;
}
$stringTag = '';
if (!empty($allArticles)) {
if (file_exists(ACYMAILING_TEMPLATE . 'plugins' . DS . 'hikashop_auto_product.php')) {
ob_start();
require ACYMAILING_TEMPLATE . 'plugins' . DS . 'hikashop_auto_product.php';
$stringTag = ob_get_clean();
} else {
$arrayElements = array();
foreach ($allArticles as $oneArticleId) {
$args = array();
$args[] = 'hikashop_product:' . $oneArticleId;
if (!empty($parameter->type)) {
$args[] = 'type:' . $parameter->type;
}
if (!empty($parameter->lang)) {
$args[] = 'lang:' . $parameter->lang;
}
$arrayElements[] = '{' . implode('|', $args) . '}';
}
$stringTag = $this->acypluginsHelper->getFormattedResult($arrayElements, $parameter);
}
}
$this->tags[$oneTag] = $stringTag;
}
return $return;
}
示例13: delete
function delete($elements)
{
if (!is_array($elements)) {
$elements = array($elements);
}
if (empty($elements)) {
return 0;
}
$column = is_numeric(reset($elements)) ? $this->pkey : $this->namekey;
foreach ($elements as $key => $val) {
$elements[$key] = $this->database->Quote($val);
}
if (empty($column) || empty($this->pkey) || empty($this->tables) || empty($elements)) {
return false;
}
$whereIn = ' WHERE ' . acymailing_secureField($column) . ' IN (' . implode(',', $elements) . ')';
$result = true;
JPluginHelper::importPlugin('acymailing');
$dispatcher = JDispatcher::getInstance();
foreach ($this->tables as $oneTable) {
$dispatcher->trigger('onAcyBefore' . ucfirst($oneTable) . 'Delete', array(&$elements));
$query = 'DELETE FROM ' . acymailing_table($oneTable) . $whereIn;
$this->database->setQuery($query);
$result = $this->database->query() && $result;
}
if (!$result) {
return false;
}
return $this->database->getAffectedRows();
}
示例14: saveForm
function saveForm()
{
$app = JFactory::getApplication();
$config = acymailing_config();
$template = new stdClass();
$template->tempid = acymailing_getCID('tempid');
$formData = JRequest::getVar('data', array(), '', 'array');
foreach ($formData['template'] as $column => $value) {
acymailing_secureField($column);
$template->{$column} = strip_tags($value);
}
$styles = JRequest::getVar('styles', array(), '', 'array');
foreach ($styles as $class => $oneStyle) {
$styles[$class] = str_replace('"', "'", $oneStyle);
if (empty($oneStyle)) {
unset($styles[$class]);
}
}
$newStyles = JRequest::getVar('otherstyles', array(), '', 'array');
if (!empty($newStyles)) {
foreach ($newStyles['classname'] as $id => $className) {
if (!empty($className) and $className != JText::_('CLASS_NAME') and !empty($newStyles['style'][$id]) and $newStyles['style'][$id] != JText::_('CSS_STYLE')) {
$className = str_replace(array(',', ' ', ':', '.', '#'), '', $className);
$styles[$className] = str_replace('"', "'", $newStyles['style'][$id]);
}
}
}
$template->styles = serialize($styles);
$files = JRequest::getVar('pictures', array(), 'files', 'array');
if (!empty($files)) {
jimport('joomla.filesystem.file');
$uploadFolder = JPath::clean(html_entity_decode($config->get('uploadfolder')));
$uploadFolder = trim($uploadFolder, DS . ' ') . DS;
$uploadPath = JPath::clean(ACYMAILING_ROOT . $uploadFolder);
acymailing_createDir($uploadPath, true);
if (!is_writable($uploadPath)) {
@chmod($uploadPath, '0755');
if (!is_writable($uploadPath)) {
$app->enqueueMessage(JText::sprintf('WRITABLE_FOLDER', $uploadPath), 'notice');
}
}
$allowedExtensions = array('jpg', 'png', 'gif', 'jpeg');
foreach ($files['name'] as $id => $filename) {
if (empty($filename)) {
continue;
}
$extension = strtolower(substr($filename, strrpos($filename, '.') + 1));
if (!in_array($extension, $allowedExtensions)) {
$app->enqueueMessage(JText::sprintf('ACCEPTED_TYPE', $extension, implode(', ', $allowedExtensions)), 'notice');
continue;
}
$pictname = strtolower(substr(JFile::makeSafe($filename), 0, strrpos($filename, '.') + 1));
$pictname = preg_replace('#[^0-9a-z]#i', '_', $pictname);
$pictfullname = $pictname . '.' . $extension;
if (file_exists($uploadPath . $pictfullname)) {
$pictfullname = $pictname . time() . '.' . $extension;
}
if (!JFile::upload($files['tmp_name'][$id], $uploadPath . $pictfullname)) {
if (!move_uploaded_file($files['tmp_name'][$id], $uploadPath . $pictfullname)) {
$app->enqueueMessage(JText::sprintf('FAIL_UPLOAD', '<b><i>' . $files['tmp_name'][$id] . '</i></b>', '<b><i>' . $uploadPath . $pictfullname . '</i></b>'), 'error');
continue;
}
}
$template->{$id} = str_replace(DS, '/', $uploadFolder) . $pictfullname;
}
}
$template->body = JRequest::getVar('editor_body', '', '', 'string', JREQUEST_ALLOWRAW);
if (!empty($styles['color_bg'])) {
$pat1 = '#^([^<]*<[^>]*background-color:)([^;">]{1,30})#i';
$found = false;
if (preg_match($pat1, $template->body)) {
$template->body = preg_replace($pat1, '$1' . $styles['color_bg'], $template->body);
$found = true;
}
$pat2 = '#^([^<]*<[^>]*bgcolor=")([^;">]{1,10})#i';
if (preg_match($pat2, $template->body)) {
$template->body = preg_replace($pat2, '$1' . $styles['color_bg'], $template->body);
$found = true;
}
if (!$found) {
$template->body = '<div style="background-color:' . $styles['color_bg'] . ';" width="100%">' . $template->body . '</div>';
}
}
$acypluginsHelper = acymailing_get('helper.acyplugins');
$acypluginsHelper->cleanHtml($template->body);
$template->description = JRequest::getVar('editor_description', '', '', 'string', JREQUEST_ALLOWRAW);
$tempid = $this->save($template);
if (!$tempid) {
return false;
}
if (empty($template->tempid)) {
$orderClass = acymailing_get('helper.order');
$orderClass->pkey = 'tempid';
$orderClass->table = 'template';
$orderClass->reOrder();
}
$this->createTemplateFile($tempid);
JRequest::setVar('tempid', $tempid);
return true;
}
示例15: saveForm
function saveForm(){
$object = new stdClass();
$object->urlid = acymailing_getCID('urlid');
$formData = JRequest::getVar( 'data', array(), '', 'array' );
foreach($formData['url'] as $column => $value){
acymailing_secureField($column);
$object->$column = strip_tags($value);
}
$urlid = $this->save($object);
if(!$urlid) return false;
$js = "window.addEvent('domready', function(){
var allLinks = window.parent.document.getElements('a[id^=urlink_".$urlid."_]');
i=0;
while(allLinks[i]){
allLinks[i].innerHTML = '".str_replace(array("'",'"'),array("'",'"'),$object->name)."';
i++;
}
acymailing_js.closeBox(true);
})";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration( $js );
return true;
}