<div class="block">
<input type="radio" name="a" value="1" class="block__radio">
<div class="block__child">
1
</div>
</div>
<div class="block">
<input type="radio" name="a" value="2" class="block__radio">
<div class="block__child">
2
</div>
</div>
.block__radio:checked ~ .block__child {
background: red;
}
<div class="iphone__container">
<ul class="iphone__list iphone__models">
<li class="iphone__li iphone__model iphone__model_6s" data-model="6S">iPhone 6s</li>
<li class="iphone__li iphone__model iphone__model_6+" data-model="6+">iPhone 6+</li>
</ul>
<ul class="iphone__list iphone__problems">
<li class="iphone__li iphone__problem" data-problem='{"id":"screen","prices":{"6S":"700","6+":"0"}}'>Замена <br/> экрана</li>
<li class="iphone__li iphone__problem" data-problem='{"id":"window","prices":{"6S":"100","6+":"0"}}'>Замена <br/> стекла</li>
</ul>
</div>
<div class="iphone__total">
<span class="iphone__total-title">Стоимость:</span>
<span class="iphone__total-value"></span>
</div>
.iphone__problems {
display: none;
}
var App = {
init: function(){
this.iPhones.init();
},
/**
* iPhones
*/
iPhones: {
init: function(){
// Container
this.container = '.iphone__container';
// List
this.list = '.iphone__list';
// List items
this.li = '.iphone__li';
// Models list
this.models = '.iphone__models';
// Models
this.model = '.iphone__model';
// Problems list
this.problems = '.iphone__problems';
// Problem
this.problem = '.iphone__problem';
// Total
this.total = '.iphone__total';
// Total value
this.totalValue = '.iphone__total-value';
// Active model
this.activeModel = '';
// Sum
this.sum = 0;
// Allowed models
this.allowedModels = ['SE','4','4S','5','5c','5S','6','6+','6s'];
// Action! Action! Action!
$(this.container).on('click', this.li, this.events);
},
/**
* Events
*/
events: function(){
// Link to object
var iPhones = App.iPhones;
// Get clicked element
var $el = $(this);
// Get model
var model = $el.data('model') || false;
// Get problem
var problem = $el.data('problem') || false;
if (model) {
iPhones.activeModel = model;
$(iPhones.list).toggle();
}
if (problem) {
iPhones.getPrice(problem.id, iPhones.activeModel, function(price){
if (problem.prices[iPhones.activeModel] == price) {
$el.addClass('active').off('click');
iPhones.sum += price;
$(iPhones.totalValue).text(iPhones.sum);
} else {
$(iPhones.list).toggle();
alert('Hacking attempt');
}
});
}
},
/**
* Get price
* @param problem
* @param model
* @param cb
*/
getPrice: function(problem, model, cb){
var list = {
'screen': {
'prices': {
'SE': 500,
'4': 400,
'4S': 450,
'5': 500,
'5C': 530,
'5S': 550,
'6': 600,
'6+': 650,
'6S': 700
}
},
'window': {
'prices': {
'SE': 500,
'4': 400,
'4S': 450,
'5': 500,
'5C': 530,
'5S': 550,
'6': 600,
'6+': 700,
'6S': 100
}
}
};
return cb(problem && model ? list[problem].prices[model] : 0);
}
}
};
$(function(){
App.init();
});
Предлагаю заменить:
$email = '" . (isset($data['email']) && !empty($data['email'])) ? $this->db->escape($data['email']) : $this->db->escape('no-reply@your-domain.tld') . "'
На:
$email = (isset($data['email']) && !empty($data['email'])) ? $this->db->escape($data['email']) : 'no-reply@your-domain.tld';
$tags = $db->safesql( htmlspecialchars( strip_tags( stripslashes( trim( $_POST['tags'] ) ) ), ENT_COMPAT, $config['charset'] ) );
$tags = array_filter(array_map('trim', explode(',', $tags)));
$tags_box = array();
$all_post_tags = $db->super_query("SELECT tags.*, post_tags.* FROM " . PREFIX . "_tags tags LEFT JOIN " . PREFIX . "_post_tags post_tags ON (tags.id=post_tags.tag) WHERE post_tags.post_id=$post_id", true);
foreach($all_post_tags as $tag){
$tags_box["all_post_tags"][] = $tag["title"];
$tags_box["all"][$tag["title"]] = $tag["tag"];
if (!in_array($tag["title"], $tags)){
$tags_box["remove"][] = $tag["id"];
}
$tag["posi"]--;
$tags_box["upd_posi"] = ($tags[$tag["posi"]] == $tag["title"]) ? 0 : 1;
$tag["posi"]++;
$tags_box["upd_posi_indexes"][$tag["title"]] = $tag["posi"];
$tags_box["upd_posi_id"][] = $tag["id"];
}
$tag_id = 0;
foreach($tags as $tag_posi => $tag_title){
$tag_posi++;
$tag_id++;
if (!in_array($tag_title, $tags_box["all_post_tags"])){
$tags_box["insert_new_tags_title"][] = "('$tag_title')";
$tags_box["insert_new_tags_id"][] = $tag_title;
$tags_box["post_tags"][] = "('$post_id', '{$tag_id}', '$tag_posi')";
}
$tags_box["positions"][$tag_title] = $tag_posi;
if (isset($tags_box["upd_posi_indexes"][$tag_title])){
$tags_box["upd_posi_new"][] = $tags_box["upd_posi_indexes"][$tag_title];
}
}
if (!empty($tags_box["remove"])){
$db->query("DELETE FROM " . PREFIX . "_post_tags WHERE post_id='$post_id' AND tag REGEXP '[[:<:]]".implode('|', $tags_box["remove"])."[[:>:]]'");
}
if (!empty($tags_box["insert_new_tags_title"])){
$finded_tags = $db->super_query("SELECT * FROM " . PREFIX . "_tags WHERE title REGEXP '[[:<:]]" . implode('|', $tags_box["insert_new_tags_id"]) . "[[:>:]]'", true);
foreach($finded_tags as $tag){
if (in_array($tag["title"], $tags) && $tags_box["all"][$tag["title"]] != $tag["title"]){
$tags_box["finded"][] = "('$post_id', '{$tag["id"]}', '{$tags_box["positions"][$tag["title"]]}')";
}
}
if (!empty($tags_box["finded"])){
$db->query("INSERT INTO " . PREFIX . "_post_tags (post_id, tag, posi) VALUES " . implode(",", $tags_box["finded"]) . "");
}
else {
$db->query("INSERT INTO " . PREFIX . "_tags (title) VALUES " . implode(",", $tags_box["insert_new_tags_title"]) . "");
$db->query("INSERT INTO " . PREFIX . "_post_tags (post_id, tag, posi) VALUES " . implode(",", $tags_box["post_tags"]) . " ");
}
}
if ($tags_box["upd_posi"]){
$db->query("UPDATE " . PREFIX . "_post_tags SET posi = ELT(field(tag, ".implode(',', $tags_box["upd_posi_id"])."), ".implode(",", $tags_box["upd_posi_new"]).") WHERE tag REGEXP '[[:<:]]".implode('|', $tags_box["upd_posi_id"])."[[:>:]]' AND post_id=$post_id");
}
$(document).ready(function(){
$('#Organisation').select2({
multiple: false, // true - Дает возможность мультивыбора
ajax: {
url: '/engine/ajax/xfields.php',
type: 'GET',
dataType: 'json',
quietMillis: 100,
results: function (data) {
var results = [];
$.each(data, function(index, item){
results.push({
id: item.id,
label: item.title
});
});
return {
results: results
};
}
}
});
});
html <input id="Organisation" style="width: 300px;" placeholder="Выберите Организацию">