本文整理汇总了PHP中cmsFramework::getCharset方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsFramework::getCharset方法的具体用法?PHP cmsFramework::getCharset怎么用?PHP cmsFramework::getCharset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsFramework
的用法示例。
在下文中一共展示了cmsFramework::getCharset方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reviews
function reviews()
{
$access = $this->cmsVersion == CMS_JOOMLA15 ? $this->Access->getAccessId() : $this->Access->getAccessLevels();
$feed_filename = PATH_ROOT . 'cache' . DS . 'jreviewsfeed_' . md5($access . $this->here) . '.xml';
$this->Feeds->useCached($feed_filename, 'reviews');
$extension = Sanitize::getString($this->params, 'extension', 'com_content');
$cat_id = Sanitize::getInt($this->params, 'cat');
$section_id = Sanitize::getInt($this->params, 'section');
$dir_id = Sanitize::getInt($this->params, 'dir');
$listing_id = Sanitize::getInt($this->params, 'id');
$this->encoding = cmsFramework::getCharset();
$feedPage = null;
$this->EverywhereAfterFind = true;
// Triggers the afterFind in the Observer Model
$this->limit = $this->Config->rss_limit;
$rss = array('title' => $this->Config->rss_title, 'link' => WWW_ROOT, 'description' => $this->Config->rss_description, 'image_url' => WWW_ROOT . "images/stories/" . $this->Config->rss_image, 'image_link' => WWW_ROOT);
$queryData = array('conditions' => array('Review.published = 1', "Review.mode = '{$extension}'"), 'fields' => array('Review.mode AS `Review.extension`'), 'limit' => $this->limit, 'order' => array('Review.created DESC'));
if ($extension == 'com_content') {
$queryData['conditions'][] = 'Listing.state = 1';
$queryData['conditions'][] = '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )';
$queryData['conditions'][] = '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )';
# Shows only links users can access
if ($this->cmsVersion == CMS_JOOMLA15) {
$access_id = $this->Access->getAccessId();
$queryData['conditions'][] = 'Listing.access <= ' . $access_id;
$queryData['conditions'][] = 'Category.access <= ' . $access_id;
} else {
$cat_id > 0 and $cat_id = array_keys($this->Category->getChildren($cat_id));
$access_id = $this->Access->getAccessLevels();
$queryData['conditions'][] = 'Listing.access IN ( ' . $access_id . ')';
$queryData['conditions'][] = 'Category.access IN ( ' . $access_id . ')';
}
}
if (!empty($cat_id) && $extension == 'com_content') {
// Category feeds only supported for core content
$queryData['conditions'][] = 'JreviewsCategory.id IN (' . $this->quote($cat_id) . ')';
$feedPage = 'category';
} elseif ($section_id > 0 && $extension == 'com_content') {
$queryData['conditions'][] = 'Listing.sectionid= ' . $section_id;
$feedPage = 'section';
} elseif ($dir_id > 0 && $extension == 'com_content') {
$queryData['conditions'][] = 'JreviewsCategory.dirid= ' . $dir_id;
$feedPage = 'directory';
} elseif ($extension != 'com_content') {
unset($this->Review->joins['listings'], $this->Review->joins['jreviews_categories'], $this->Review->joins['listings']);
$feedPage = 'everywhere';
}
if ($listing_id > 0) {
$queryData['conditions'][] = 'Review.pid = ' . $listing_id;
$feedPage = 'listing';
}
# Don't run it here because it's run in the Everywhere Observer Component
$this->Review->runProcessRatings = false;
$reviews = $this->Review->findAll($queryData);
$this->set(array('feedPage' => $feedPage, 'encoding' => $this->encoding, 'rss' => $rss, 'reviews' => $reviews));
return $this->Feeds->saveFeed($feed_filename, 'reviews');
}
示例2: startup
function startup(&$controller)
{
# Check feed cache
if (Sanitize::getString($controller->params, 'action') == 'xml') {
$this->useCached(PATH_ROOT . DS . 'cache' . DS . 'jreviewsfeed_' . md5($controller->here) . '.xml');
}
$this->encoding = cmsFramework::getCharset();
$this->params =& $controller->params;
$this->c =& $controller;
}
示例3: reviews
function reviews()
{
$extension = Sanitize::getString($this->params, 'extension', 'com_content');
$cat_id = Sanitize::getInt($this->params, 'cat');
$section_id = Sanitize::getInt($this->params, 'section');
$dir_id = Sanitize::getInt($this->params, 'dir');
$listing_id = Sanitize::getInt($this->params, 'id');
$this->encoding = cmsFramework::getCharset();
$feedPage = null;
$this->EverywhereAfterFind = true;
// Triggers the afterFind in the Observer Model
$this->limit = $this->Config->rss_limit;
$rss = array('title' => $this->Config->rss_title, 'link' => WWW_ROOT, 'description' => $this->Config->rss_description, 'image_url' => WWW_ROOT . "images/stories/" . $this->Config->rss_image, 'image_link' => WWW_ROOT);
$queryData = array('conditions' => array('Review.published = 1', "Review.mode = '{$extension}'"), 'fields' => array('Review.mode AS `Review.extension`'), 'limit' => $this->limit, 'order' => array('Review.created DESC'));
if ($cat_id > 0 && $extension == 'com_content') {
// Category feeds only supported for core content
$queryData['conditions'][] = 'JreviewsCategory.id= ' . $cat_id;
// $queryData['joins'] = $this->Listing->joinsReviews;
$feedPage = 'category';
} elseif ($section_id > 0 && $extension == 'com_content') {
$queryData['conditions'][] = 'Listing.sectionid= ' . $section_id;
// $queryData['joins'] = $this->Listing->joinsReviews;
$feedPage = 'section';
} elseif ($dir_id > 0 && $extension == 'com_content') {
$queryData['conditions'][] = 'JreviewsCategory.dirid= ' . $dir_id;
// $queryData['joins'] = $this->Listing->joinsReviews;
$feedPage = 'directory';
} elseif ($extension != 'com_content') {
unset($this->Review->joins['listings'], $this->Review->joins['jreviews_categories'], $this->Review->joins['listings']);
$feedPage = 'everywhere';
}
if ($listing_id > 0) {
$queryData['conditions'][] = 'Review.pid = ' . $listing_id;
$feedPage = 'listing';
}
# Don't run it here because it's run in the Everywhere Observer Component
$this->Review->runProcessRatings = false;
$reviews = $this->Review->findAll($queryData);
$this->set(array('feedPage' => $feedPage, 'encoding' => $this->encoding, 'rss' => $rss, 'reviews' => $reviews));
return $this->Feeds->saveFeed(PATH_ROOT . DS . 'cache' . DS . 'jreviewsfeed_' . md5($this->here) . '.xml', 'reviews');
}
示例4: _send
function _send()
{
$recipient = '';
$error = array();
$response = array();
$this->components = array('security');
$this->__initComponents();
if ($this->invalidToken) {
$error[] = 'jQuery("#jr_inquiryTokenValidation").show();';
return json_encode(array('error' => $this->makeJS($error)));
}
// Required fields
$fields = array('name', 'email', 'text');
// $fields = array('name','email','phone','text');
foreach ($fields as $id) {
$input_id = '#jr_inquiry' . Inflector::camelize($id) . 'Validation';
if ($this->data['Inquiry'][$id] == '') {
$error[] = 'jQuery("' . $input_id . '").show();';
} else {
$reponse[] = 'jQuery("' . $input_id . '").hide();';
}
}
# Validate user's email
$this->Listing->validateInput($this->data['Inquiry']['email'], "email", "email", __t("You must fill in a valid email address.", true), 1);
# Validate security code
if ($this->Access->showCaptcha()) {
if (!isset($this->data['Captcha']['code'])) {
$this->Listing->validateSetError("code", __t("The security code you entered was invalid.", true));
} elseif ($this->data['Captcha']['code'] == '') {
$this->Listing->validateSetError("code", __t("You must fill in the security code.", true));
} else {
if (!$this->Captcha->checkCode($this->data['Captcha']['code'], $this->ipaddress)) {
$this->Listing->validateSetError("code", __t("The security code you entered was invalid.", true));
}
}
}
# Process validation errors
$validation = $this->Listing->validateGetErrorArray();
$validation = is_array($validation) ? implode("<br />", $validation) : '';
if (!empty($error) || $validation != '') {
// Reissue form token
if (isset($this->Security)) {
$error[] = "jQuery('#jr_inquiryToken').val('" . $this->Security->reissueToken() . "');";
}
if ($this->Access->showCaptcha()) {
// Replace captcha with new instance
$captcha = $this->Captcha->displayCode();
$error[] = "jQuery('#captcha').attr('src','{$captcha['src']}');";
$error[] = "jQuery('#jr_inquiryCode').val('');";
}
if ($validation != '') {
$error[] = "jQuery('#jr_inquiryCodeValidation').html('{$validation}').show();";
}
return json_encode(array('error' => $this->makeJS($error)));
}
// Now we can send the email
# Read cms mail config settings
$configSendmailPath = cmsFramework::getConfig('sendmail');
$configSmtpAuth = cmsFramework::getConfig('smtpauth');
$configSmtpUser = cmsFramework::getConfig('smtpuser');
$configSmtpPass = cmsFramework::getConfig('smtppass');
$configSmtpHost = cmsFramework::getConfig('smtphost');
$configSmtpSecure = cmsFramework::getConfig('smtpsecure');
$configSmtpPort = cmsFramework::getConfig('smtpport');
$configMailFrom = cmsFramework::getConfig('mailfrom');
$configFromName = cmsFramework::getConfig('fromname');
$configMailer = cmsFramework::getConfig('mailer');
# Get the recipient email
Configure::write('Cache.query', false);
$listing = $this->Listing->findRow(array('fields' => array('User.email AS `Listing.email`'), 'conditions' => array('Listing.id = ' . (int) $this->data['Inquiry']['listing_id'])));
$url = cmsFramework::makeAbsUrl($listing['Listing']['url'], array('sef' => true));
$link = '<a href="' . $url . '">' . $listing['Listing']['title'] . '</a>';
switch ($this->Config->inquiry_recipient) {
case 'owner':
$recipient = Sanitize::getString($listing['Listing'], 'email');
break;
case 'admin':
$recipient = $configMailFrom;
break;
case 'field':
if (isset($listing['Field']['pairs'][$this->Config->inquiry_field])) {
$recipient = $listing['Field']['pairs'][$this->Config->inquiry_field]['value'][0];
}
break;
}
if ($recipient == '') {
$recipient = $configMailFrom;
}
if (!class_exists('PHPMailer')) {
App::import('Vendor', 'phpmailer' . DS . 'class.phpmailer');
}
$mail = new PHPMailer();
$mail->CharSet = cmsFramework::getCharset();
$mail->SetLanguage('en', S2_VENDORS . 'phpmailer' . DS . 'language' . DS);
$mail->Mailer = $configMailer;
// Mailer used mail,sendmail,smtp
switch ($configMailer) {
case 'smtp':
$mail->Host = $configSmtpHost;
$mail->SMTPAuth = $configSmtpAuth;
//.........这里部分代码省略.........
示例5: getFormFields
/**
* Dynamic form creation for custom fields using custom layout - {field tags} in view file
*
* @param unknown_type $formFields
* @param unknown_type $fieldLocation
* @param unknown_type $search
* @param unknown_type $selectLabel
* @return array of form inputs for each field
*/
function getFormFields(&$formFields, $fieldLocation = 'listing', $search = null, $selectLabel = 'Select')
{
if (!is_array($formFields)) {
return '';
}
$groupSet = array();
$fieldLocation = Inflector::camelize($fieldLocation);
foreach ($formFields as $group => $fields) {
$inputs = array();
foreach ($fields['Fields'] as $key => $value) {
// Convert radio button to checkbox if multiple search is enabled in the config settings
if ($search && $this->Config->search_field_conversion && $value['type'] == 'radiobuttons') {
$value['type'] = 'checkboxes';
}
$inputs["data[Field][{$fieldLocation}][{$key}]"] = array('id' => $value['name'] . $this->form_id, 'type' => $this->types[$value['type']]);
// $inputs["data[Field][$fieldLocation][$key]"]['label'] = $value['title'];
$inputs["data[Field][{$fieldLocation}][{$key}]"]['div'] = array();
# Add tooltip
if (!$search && Sanitize::getString($value, 'description', null)) {
$inputs["data[Field][{$fieldLocation}][{$key}]"]['label']['text'] .= '<span class="jr_infoTip" title="' . htmlspecialchars($value['description'], ENT_QUOTES, cmsFramework::getCharset()) . '"> </span>';
}
// Assign field classes
switch ($value['type']) {
case 'decimal':
case 'integer':
$inputs["data[Field][{$fieldLocation}][{$key}]"]['class'] = 'shortField';
break;
case 'website':
$inputs["data[Field][{$fieldLocation}][{$key}]"]['class'] = 'mediumField';
break;
case 'text':
$inputs["data[Field][{$fieldLocation}][{$key}]"]['class'] = 'mediumField';
break;
}
if (in_array($value['type'], $this->multipleTypes)) {
$inputs["data[Field][{$fieldLocation}][{$key}]"]['multiple'] = 'multiple';
$inputs["data[Field][{$fieldLocation}][{$key}]"]['size'] = $value['properties']['size'];
}
if (isset($value['optionList']) && $value['type'] == 'select') {
$value['optionList'] = array('' => $selectLabel) + $value['optionList'];
}
if (isset($value['optionList'])) {
$inputs["data[Field][{$fieldLocation}][{$key}]"]['options'] = $value['optionList'];
}
# Add click2add capability for select lists
if ($fieldLocation == 'Listing' && !$search && $this->types[$value['type']] == 'select' && $value['properties']['click2add']) {
$click2AddLink = $this->Html->link($this->Html->image($this->viewImages . 'option_add.png', array('border' => 0, 'style' => 'margin-left:5px;')), 'javascript:void(0);', array('sef' => false, 'onclick' => "jQuery('#click2Add_{$value['field_id']}').toggle('slow');"));
$click2AddInput = $this->Form->text('option' . $value['field_id'], array('id' => 'option' . $value['field_id']));
$click2AddButton = $this->Form->button(__t("Submit", true), array('onclick' => "submitOption({$value['field_id']},'{$value['name']}');", 'div' => false, 'id' => 'submitButton' . $value['field_id'], 'class' => 'button'));
$inputs["data[Field][{$fieldLocation}][{$key}]"]['after'] = $click2AddLink . "<div id='click2Add_{$value['field_id']}' class='jr_fieldDiv jr_newFieldOption'>" . $click2AddInput . ' ' . $click2AddButton . "<span id='spinner" . $value['field_id'] . "' style='display: none;'><img alt='loading' src='" . $this->viewImages . "loading.gif' /></span>" . '</div>';
}
# Prefill values when editing
if (isset($value['selected'])) {
$inputs["data[Field][{$fieldLocation}][{$key}]"]['value'] = $value['selected'];
}
# Add search operator fields for date, decimal and integer fields
if ($search && in_array($value['type'], $this->operatorTypes)) {
$options = array('equal' => '=', 'higher' => '>=', 'lower' => '<=', 'between' => __t("between", true));
$inputs["data[Field][{$fieldLocation}][{$key}]"]['multiple'] = true;
// convert field to array input for range searches
$attributes = array('id' => $key . 'high', 'multiple' => true, 'class' => 'shortField');
$selected = '';
if ($this->types[$value['type']] == 'date') {
$attributes['class'] = 'dateField datepicker';
}
// This is the high value input in a range search
$inputs["data[Field][{$fieldLocation}][{$key}]"]['after'] = '<span id="' . $key . 'highDiv" style="display:none;"> ' . $this->Form->text("data[Field][Listing][{$key}]", $attributes) . '</span>';
$inputs["data[Field][{$fieldLocation}][{$key}]"]['between'] = $this->Form->select("data[Field][Listing][{$key}_operator]", $options, $selected, array('class' => 'jr_dateOperator input', 'onchange' => "jreviews.search.showRange(this,'{$key}high');"));
}
# Input styling
if ($this->types[$value['type']] == 'date') {
$inputs["data[Field][{$fieldLocation}][{$key}]"]['class'] = 'dateField datepicker';
$inputs["data[Field][{$fieldLocation}][{$key}]"]['readonly'] = 'readonly';
}
if (in_array($this->types[$value['type']], $this->legendTypes)) {
// Input styling
$inputs["data[Field][{$fieldLocation}][{$key}]"]['option_class'] = 'jr_fieldOption';
$inputs["data[Field][{$fieldLocation}][{$key}]"]['after'] = $this->Html->div('clr', ' ');
// To break the float
}
}
$groupSet[$group] = array('fieldset' => false, 'legend' => false);
foreach ($inputs as $dataKey => $dataValue) {
$groupSet[$group][$dataKey] = $dataValue;
}
}
$output = array();
foreach ($groupSet as $group => $form) {
$output = array_merge($output, $this->Form->inputs($form, null, null, true));
}
return $output;
//.........这里部分代码省略.........
示例6: compareCheckbox
function compareCheckbox($listing)
{
App::import('Helper', 'routes', 'jreviews');
$Routes = ClassRegistry::getClass('RoutesHelper');
$listing_title = htmlspecialchars($listing['Listing']['title'], ENT_QUOTES, cmsFramework::getCharset());
$listing_id = $listing['Listing']['listing_id'];
$listing_url = $Routes->content($listing['Listing']['title'], $listing, array('return_url' => true));
$checkbox = '<input type="checkbox" class="checkListing" name="' . $listing_title . '" id="listing' . $listing_id . '" value="' . $listing_id . '" /> <label class="lbCompare" for="listing' . $listing_id . '">' . __t("Compare", true) . '</label>';
$listing_type = '<span id="listingID' . $listing_id . '" class="listingType' . $listing['Criteria']['criteria_id'] . '" style="display:none;">' . $listing['Criteria']['title'] . '</span>';
$url = '<span class="listingUrl' . $listing_id . '" style="display:none;">' . $listing_url . '</span>';
return '<span class="compareListing jrButton">' . $checkbox . $listing_type . $url . '</span>';
}
示例7: plgAfterSave
function plgAfterSave(&$model)
{
if (!isset($model->data['Email']) || !Sanitize::getInt($model->data['Email'], 'send')) {
return false;
}
# Read cms mail config settings
$configSendmailPath = cmsFramework::getConfig('sendmail');
$configSmtpAuth = cmsFramework::getConfig('smtpauth');
$configSmtpUser = cmsFramework::getConfig('smtpuser');
$configSmtpPass = cmsFramework::getConfig('smtppass');
$configSmtpHost = cmsFramework::getConfig('smtphost');
$configSmtpSecure = cmsFramework::getConfig('smtpsecure');
$configSmtpPort = cmsFramework::getConfig('smtpport');
$configMailFrom = cmsFramework::getConfig('mailfrom');
$configFromName = cmsFramework::getConfig('fromname');
$configMailer = cmsFramework::getConfig('mailer');
if (!class_exists('PHPMailer')) {
App::import('Vendor', 'phpmailer' . DS . 'class.phpmailer');
}
$mail = new PHPMailer();
$mail->CharSet = cmsFramework::getCharset();
$mail->SetLanguage('en', S2_VENDORS . 'PHPMailer' . DS . 'language' . DS);
$mail->Mailer = $configMailer;
// Mailer used mail,sendmail,smtp
switch ($configMailer) {
case 'smtp':
$mail->Host = $configSmtpHost;
$mail->SMTPAuth = $configSmtpAuth;
$mail->Username = $configSmtpUser;
$mail->Password = $configSmtpPass;
$mail->SMTPSecure = $configSmtpSecure != '' ? $configSmtpSecure : '';
$mail->Port = $configSmtpPort;
break;
case 'sendmail':
$mail->Sendmail = $configSendmailPath;
break;
default:
break;
}
$mail->isHTML(true);
$mail->From = $configMailFrom;
$mail->FromName = $configFromName;
$mail->AddReplyTo($configMailFrom, $configFromName);
// $model->data[$this->notifyModel->name]['key'] = $value;
$model->data['Email']['body'] = urldecode($model->data['__raw']['Email']['body']);
// Send html email
# In this observer model we just use the existing data to send the email notification
switch ($this->notifyModel->name) {
// Notification for claims moderation
case 'Claim':
if ($model->data['Email']['subject'] != '') {
$subject = $model->data['Email']['subject'];
$subject = str_ireplace('{name}', $model->data['Email']['name'], $subject);
$subject = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $subject);
} else {
switch ($model->data['Claim']['approved']) {
case 1:
$subject = __a("Your claim has been approved", true);
break;
case -1:
$subject = __a("Your claim has been rejected", true);
break;
case 0:
$subject = __a("Your claim has been reviewed, but still pending moderation", true);
break;
}
}
// Get permalink
$listing_id = $model->data['Listing']['id'];
$listing = $this->controller->Listing->findRow(array('conditions' => 'Listing.id = ' . $listing_id), array('afterFind'));
$permalink = cmsFramework::makeAbsUrl($listing['Listing']['url'], array('sef' => true));
$message = $model->data['Email']['body'];
$message = str_ireplace('{name}', $model->data['Email']['name'], $message);
$message = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $message);
$message = str_ireplace(array('{link}', '{url}'), $permalink, $message);
if ($message != '') {
$mail->Subject = $subject;
// Convert line breaks to br tags if html code not found on the message body
$mail->Body = nl2br($message);
$mail->AddAddress($model->data['Email']['email']);
if (!$mail->Send()) {
appLogMessage(array("Admin claim moderation message was not sent.", "Mailer error: " . $mail->ErrorInfo), 'notifications');
}
}
break;
# Notification for discussion post moderation
# Notification for discussion post moderation
case 'Discussion':
if ($model->data['Email']['subject'] != '') {
$subject = $model->data['Email']['subject'];
$subject = str_ireplace('{name}', $model->data['Email']['name'], $subject);
$subject = str_ireplace('{review_title}', $model->data['Email']['review_title'], $subject);
} else {
switch ($model->data['Discussion']['approved']) {
case 1:
$subject = __a("Your comment has been approved", true);
break;
case -1:
$subject = __a("Your comment has been rejected", true);
break;
//.........这里部分代码省略.........
示例8: _save
function _save()
{
/*******************************************************************
* This method is processed inside an iframe
* To access any of the DOM elements via jQuery it's necessary to prepend
* all jQuery calls with $parentFrame (i.e. $parentFrame.jQuery)
********************************************************************/
$this->autoRender = false;
$this->autoLayout = false;
$response = array();
$parentFrame = 'window.parent';
$validation = '';
$listing_id = Sanitize::getInt($this->data['Listing'], 'id', 0);
$isNew = $this->Listing->isNew = $listing_id == 0 ? true : false;
$this->data['email'] = Sanitize::getString($this->data, 'email');
$this->data['name'] = Sanitize::getString($this->data, 'name');
$this->data['categoryid_hidden'] = Sanitize::getInt($this->data['Listing'], 'categoryid_hidden');
$cat_id = Sanitize::getVar($this->data['Listing'], 'catid');
$this->data['Listing']['catid'] = is_array($cat_id) ? (int) array_pop(array_filter($cat_id)) : (int) $cat_id;
/*J16*/
$this->data['Listing']['title'] = Sanitize::getString($this->data['Listing'], 'title', '');
$this->data['Listing']['created_by_alias'] = Sanitize::getString($this->data, 'name', '');
if ($this->cmsVersion == CMS_JOOMLA15) {
$this->data['sectionid_hidden'] = Sanitize::getInt($this->data['Listing'], 'sectionid_hidden');
$this->data['Listing']['sectionid'] = Sanitize::getInt($this->data['Listing'], 'sectionid');
} else {
$this->data['Listing']['language'] = '*';
$this->data['Listing']['access'] = 1;
}
$category_id = $this->data['Listing']['catid'] ? $this->data['Listing']['catid'] : $this->data['categoryid_hidden'];
# Get criteria info
$criteria = $this->Criteria->findRow(array('conditions' => array('Criteria.id =
(SELECT criteriaid FROM #__jreviews_categories WHERE id = ' . (int) $category_id . ' AND `option` = "com_content")
')));
if (!$criteria) {
$validation = __t("The category selected is invalid.", true, true);
$response[] = "{$parentFrame}.jQuery('#jr_listingFormValidation').html('{$validation}');";
$response[] = "{$parentFrame}.jQuery('.button').removeAttr('disabled');";
$response[] = "{$parentFrame}.jQuery('.jr_loadingSmall').hide();";
return $this->makeJS($response);
}
$this->data['Criteria']['id'] = $criteria['Criteria']['criteria_id'];
# Override global configuration
isset($criteria['ListingType']) and $this->Config->override($criteria['ListingType']['config']);
# Perform access checks
if ($isNew && !$this->Access->canAddListing()) {
return $this->makeJS("{$parentFrame}.s2Alert('" . __t("You are not allowed to submit listings in this category.", true, true) . "')");
} elseif (!$isNew) {
$query = "SELECT created_by FROM #__content WHERE id = " . $listing_id;
$this->_db->setQuery($query);
$listing_owner = $this->_db->loadResult();
if (!$this->Access->canEditListing($listing_owner)) {
return $this->makeJS("{$parentFrame}.s2Alert('" . s2Messages::accessDenied() . "')");
}
}
# Load the notifications observer model component and initialize it.
# Done here so it only loads on save and not for all controlller actions.
$this->components = array('security', 'notifications');
$this->__initComponents();
if ($this->invalidToken == true) {
return $this->makeJS("{$parentFrame}.s2Alert('" . s2Messages::invalidToken() . "')");
}
# Override configuration
$category = $this->Category->findRow(array('conditions' => array('Category.id = ' . $this->data['Listing']['catid'])));
$this->Config->override($category['ListingType']['config']);
if ($this->Access->loadWysiwygEditor()) {
$this->data['Listing']['introtext'] = Sanitize::stripScripts(Sanitize::stripWhitespace(Sanitize::getVar($this->data['__raw']['Listing'], 'introtext')));
$this->data['Listing']['fulltext'] = Sanitize::stripScripts(Sanitize::stripWhitespace(Sanitize::getVar($this->data['__raw']['Listing'], 'fulltext')));
$this->data['Listing']['introtext'] = html_entity_decode($this->data['Listing']['introtext'], ENT_QUOTES, cmsFramework::getCharset());
$this->data['Listing']['fulltext'] = html_entity_decode($this->data['Listing']['fulltext'], ENT_QUOTES, cmsFramework::getCharset());
} else {
$this->data['Listing']['introtext'] = Sanitize::stripAll($this->data['Listing'], 'introtext', '');
if (isset($this->data['Listing']['fulltext'])) {
$this->data['Listing']['fulltext'] = Sanitize::stripAll($this->data['Listing'], 'fulltext', '');
} else {
$this->data['Listing']['fulltext'] = '';
}
}
$this->data['Listing']['introtext'] = str_replace('<br>', '<br />', $this->data['Listing']['introtext']);
$this->data['Listing']['fulltext'] = str_replace('<br>', '<br />', $this->data['Listing']['fulltext']);
if ($this->Access->canAddMeta()) {
$this->data['Listing']['metadesc'] = Sanitize::getString($this->data['Listing'], 'metadesc');
$this->data['Listing']['metakey'] = Sanitize::getString($this->data['Listing'], 'metakey');
}
// Title alias handling
$slug = '';
$alias = Sanitize::getString($this->data['Listing'], 'alias');
if ($isNew && $alias == '') {
$slug = S2Router::sefUrlEncode($this->data['Listing']['title']);
if (trim(str_replace('-', '', $slug)) == '') {
$slug = date("Y-m-d-H-i-s");
}
} elseif ($alias != '') {
// Alias filled in so we convert it to a valid alias
$slug = S2Router::sefUrlEncode($alias);
if (trim(str_replace('-', '', $slug)) == '') {
$slug = date("Y-m-d-H-i-s");
}
}
$slug != '' and $this->data['Listing']['alias'] = $slug;
//.........这里部分代码省略.........
示例9: plgAfterSave
function plgAfterSave(&$model)
{
appLogMessage('**** BEGIN Notifications Plugin AfterSave', 'database');
# Read cms mail config settings
$configSendmailPath = cmsFramework::getConfig('sendmail');
$configSmtpAuth = cmsFramework::getConfig('smtpauth');
$configSmtpUser = cmsFramework::getConfig('smtpuser');
$configSmtpPass = cmsFramework::getConfig('smtppass');
$configSmtpHost = cmsFramework::getConfig('smtphost');
$configSmtpSecure = cmsFramework::getConfig('smtpsecure');
$configSmtpPort = cmsFramework::getConfig('smtpport');
$configMailFrom = cmsFramework::getConfig('mailfrom');
$configFromName = cmsFramework::getConfig('fromname');
$configMailer = cmsFramework::getConfig('mailer');
if (!class_exists('PHPMailer')) {
App::import('Vendor', 'phpmailer' . DS . 'class.phpmailer');
}
$mail = new PHPMailer();
$mail->CharSet = cmsFramework::getCharset();
$mail->SetLanguage('en', S2_VENDORS . 'PHPMailer' . DS . 'language' . DS);
$mail->Mailer = $configMailer;
// Mailer used mail,sendmail,smtp
switch ($configMailer) {
case 'smtp':
$mail->Host = $configSmtpHost;
$mail->SMTPAuth = $configSmtpAuth;
$mail->Username = $configSmtpUser;
$mail->Password = $configSmtpPass;
$mail->SMTPSecure = $configSmtpSecure != '' ? $configSmtpSecure : '';
$mail->Port = $configSmtpPort;
break;
case 'sendmail':
$mail->Sendmail = $configSendmailPath;
break;
default:
break;
}
$mail->isHTML(true);
$mail->From = $configMailFrom;
$mail->FromName = $configFromName;
# In this observer model we just use the existing data to send the email notification
switch ($this->notifyModel->name) {
# Notification for new/edited listings
case 'Listing':
if ($this->c->Config->notify_content || $this->c->Config->notify_user_listing) {
$this->c->autoRender = false;
$listing = $this->_getListing($model);
$this->c->set(array('isNew' => isset($model->data['insertid']), 'User' => $this->c->_user, 'listing' => $listing));
} else {
return;
}
// Admin listing email
if ($this->c->Config->notify_content) {
$mail->ClearAddresses();
$mail->ClearAllRecipients();
$mail->ClearBCCs();
# Process configuration emails
if ($this->c->Config->notify_content_emails == '') {
$mail->AddAddress($configMailFrom);
} else {
$recipient = explode("\n", $this->c->Config->notify_content_emails);
foreach ($recipient as $to) {
if (trim($to) != '') {
$mail->AddAddress(trim($to));
}
}
}
$subject = isset($model->data['insertid']) ? __t("New listing", true) . ": {$listing['Listing']['title']}" : __t("Edited listing", true) . ": {$listing['Listing']['title']}";
$guest = !$this->c->_user->id ? ' (Guest)' : " ({$this->c->_user->id})";
$author = $this->c->_user->id ? $this->c->_user->name : 'Guest';
$message = $this->c->render('email_templates', 'admin_listing_notification');
$mail->Subject = $subject;
$mail->Body = $message;
if (!$mail->Send()) {
appLogMessage(array("Admin listing message was not sent.", "Mailer error: " . $mail->ErrorInfo), 'notifications');
}
}
// End admin listing email
// User listing email - to user submitting the listing as long as he is also the owner of the listing
if ($this->c->Config->notify_user_listing) {
$mail->ClearAddresses();
$mail->ClearAllRecipients();
$mail->ClearBCCs();
//Check if submitter and owner are the same or else email is not sent
// This is to prevent the email from going out if admins are doing the editing
if ($this->c->_user->id == $listing['User']['user_id']) {
// Process configuration emails
if ($this->c->Config->notify_user_listing_emails != '') {
$recipient = explode("\n", $this->c->Config->notify_user_listing_emails);
foreach ($recipient as $bcc) {
if (trim($bcc) != '') {
$mail->AddBCC(trim($bcc));
}
}
}
$mail->AddAddress(trim($listing['User']['email']));
$subject = isset($model->data['insertid']) ? sprintf(__t("New listing: %s", true), $listing['Listing']['title']) : sprintf(__t("Edited listing: %s", true), $listing['Listing']['title']);
$guest = !$this->c->_user->id ? ' (Guest)' : " ({$this->c->_user->id})";
$author = $this->c->_user->id ? $this->c->_user->name : 'Guest';
$message = $this->c->render('email_templates', 'user_listing_notification');
//.........这里部分代码省略.........
示例10: loadXajax
function loadXajax()
{
// Prevents xajax from loading twice if already loaded by jReviews or BlueFlame Platform
if (!class_exists('xajax') && !defined('XAJAX_LOADED') && !defined('XAJAX_VER')) {
define('XAJAX_LOADED', 1);
App::import('Vendor', 'xajax_05final' . DS . 'xajax_core' . DS . 'xajax.inc');
if (defined('MVC_FRAMEWORK_ADMIN')) {
$xajax = new xajax('index2.php?option=' . S2Paths::get('jreviews', 'S2_CMSCOMP') . '&task=xajax&no_html=1');
} else {
$xajax = new xajax();
}
$xajax->setCharEncoding(strtoupper(cmsFramework::getCharset()));
if (strtolower(cmsFramework::getCharset()) == 'utf-8') {
$decodeUTF8 = false;
} else {
$decodeUTF8 = true;
}
/* Set defaults from params */
$this->xajax_statusMessage ? $xajax->setFlag('statusMessages', true) : $xajax->setFlag('statusMessages', false);
$this->xajax_waitCursor ? $xajax->setFlag('waitCursor', true) : $xajax->setFlag('waitCursor', false);
$this->xajax_debug ? $xajax->setFlag('debug', true) : $xajax->setFlag('debug', false);
$decodeUTF8 ? $xajax->setFlag('decodeUTF8Input', true) : $xajax->setFlag('decodeUTF8Input', false);
$xajax->registerFunction('xajaxDispatch');
// ob_start('ob_gzhandler'); // Results in wrong encoding error ni certain servers
$xajax->processRequest();
$js = $xajax->getJavascript(S2_VENDORS_URL . 'xajax_05final' . _DS);
cmsFramework::addScript($js);
}
}