- 1
- 2
if(!empty($_REQUEST['action_button']))
$_REQUEST['action'] = $_REQUEST['action_button'];
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+916
if(!empty($_REQUEST['action_button']))
$_REQUEST['action'] = $_REQUEST['action_button'];
bitrix/modules/main/interface/admin_lib.php:3320
+317
$this->db->query("UPDATE `" . DB_PREFIX . "order` SET firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_company_id = '" . $this->db->escape($data['payment_company_id']) . "', payment_tax_id = '" . $this->db->escape($data['payment_tax_id']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($payment_country) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($payment_zone) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($payment_address_format) . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($shipping_country) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($shipping_zone) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($shipping_address_format) . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', order_status_id = '" . (int)$data['order_status_id'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', date_modified = NOW() WHERE order_id = '" . (int)$order_id . "'");
Строчечка
+267
//форма собственности
$('#sobst').change(function(){
var $radiouch = $('#uchred1, #uchred2');
var valip = 'ИП';
var $ip = $('#ip').attr('id');
var $obsch = $('.obschestvo').attr('class');
var $obsch2 = $('.obschestvo2').attr('class');
if($('option:selected', this).attr('id')==$ip){
$tab24.fadeOut(500);
$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('required').removeClass('err').attr('disabled','');
$tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
$radiouch.prop('checked', false);
$novalid.removeAttr('required');
}
if($('option:selected', this).attr('class')==$obsch){
if($('#i').prop("checked")){
$tab24.fadeOut(500);
$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('required').removeClass('err').attr('disabled','');
$tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
$radiouch.prop('checked', false);
$novalid.removeAttr('required');
}
else{
$tab24.fadeIn(1000);
$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('disabled').removeClass('err').attr('required','');
$tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
$radiouch.prop('checked', false);
$novalid.removeAttr('required');
}
}
if($('option:selected', this).attr('class')==$obsch2){
if($('#i').prop("checked")){
$tab24.fadeOut(500);
$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('required').removeClass('err').attr('disabled','');
$tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
$radiouch.prop('checked', false);
}
else{
$tab24.fadeIn(1000);
$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('disabled').removeClass('err').removeAttr('required','');
$tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
$radiouch.prop('checked', false);
}
}
});
//Выбор учредителя
$('#uchrdiv1').find("input[type='radio']").click(function(){
var $dopuchr = $('#Familia, #Imia, #Otchestvo, #Dola');
var $uchr2elem = $('#uchrdiv2').find('input[type!=button][type!=submit][type!=radio], select, #Opis');
var $rad = $(this).attr('id');
if($rad==$('#uchred2').attr('id')){
$("#labfio").text("Форма собственности *");
$("#labname").text("Наименование *");
$("#labsur").text("УНП *");
$("#zagolovok").text("Наименование учредителя *");
$uchr2elem.removeAttr('required').removeClass('err').attr('disabled','');
$('#surname1').attr('required','');
$('#uchred1').removeClass('err');
$dopuchr.removeAttr('required');
}
else {
$("#labfio").text('Фамилия *');
$("#labname").text("Имя *");
$("#labsur").text("Отчество");
$("#zagolovok").text("Ф.И.О учредителя в именительном падеже *");
$uchr2elem.removeAttr('disabled').attr('required','').val('');
$('#table2').find('input[type!=radio]').removeAttr('disabled').attr('required','');
$('#surname1, #pomeschenieNum3').removeAttr('required','');
$('#uchred2').removeClass('err');
$dopuchr.removeAttr('required');
}
});
//Способ получения
$('.forms5').find("input[type='radio']").click(function(){
var $grd = $('#grd').find('input[id!=pomeschenieNum6], select');
var $ofs = $('#ofs').find('input, select');
var $posrad = $(this).attr('id');
if($posrad==$('#Ofis').attr('id')){
$grd.removeAttr('required').removeClass('err').attr('disabled','').val('');
$ofs.removeAttr('disabled').attr('required','').val('');
$('#Viezd').removeAttr('required').removeClass('err');
$('#Ofis').attr('required');
}
if($posrad==$('#Viezd').attr('id')){
$ofs.removeAttr('required').removeClass('err').attr('disabled','').val('');
$grd.removeAttr('disabled').attr('required','').val('');
$('#Ofis').removeAttr('required').removeClass('err');
$('#Viezd').attr('required');
}
});
//кнопка submit
$('#otpravit').on({
mousedown: function(){
$(this).css('background','linear-gradient(to bottom right, #D77024, #E49656)');
},
mouseup: function(){
$(this).css('background','linear-gradient(to bottom right, #EC841C, #EDA24E)');
страница с формами
название файла (ВНИМАНИЕ!): dubische_gaz
+319
if (("/dir/" + TXT_FILE_NAME).equals(fileName))
processTxtFiles(TXT_FILE_NAME);
else if (fileName.endsWith(TXT_FILE_NAME))
processTxtFiles(TXT_FILE_NAME);
else if ...
Зачем первые две строки?
+4
bool shift = keys.Shift;
if (keys.Control)
{
return SelectNextControl(shift ? false : true);
}
Телерик опять жжот. Цветёт и пахнет.
+7
https://twitter.com/neuromzan
Нейросеть научилась писать твиты за Рамзана Кадырова https://nplus1.ru/news/2016/08/05/neurokad
Вореции
+20
std::vector<D3D11_INPUT_ELEMENT_DESC> desc;
for (auto it = descStrings.begin(); it != descStrings.end(); it++)
{
auto strIt = it->begin();
std::string SemanticName;
while ((*strIt) != ',' || strIt != it->end())
{
if ((*strIt) != ' ')
SemanticName += (*strIt);
strIt++;
}
strIt++;
std::string SemanticIndex;
while ((*strIt) != ',' || strIt != it->end())
{
if ((*strIt) != ' ')
SemanticIndex += (*strIt);
strIt++;
}
strIt++;
std::string Format;
while ((*strIt) != ',' || strIt != it->end())
{
if ((*strIt) != ' ')
Format += (*strIt);
strIt++;
}
strIt++;
std::string InputSlot;
while ((*strIt) != ',' || strIt != it->end())
{
if ((*strIt) != ' ')
InputSlot += (*strIt);
strIt++;
}
strIt++;
std::string AlignedByteOffset;
while ((*strIt) != ',' || strIt != it->end())
{
if ((*strIt) != ' ')
AlignedByteOffset += (*strIt);
strIt++;
}
strIt++;
std::string InputSlotClass;
while ((*strIt) != ',' || strIt != it->end())
{
if ((*strIt) != ' ')
InputSlotClass += (*strIt);
strIt++;
}
strIt++;
std::string InstanceDataStepRate;
while ((*strIt) != '}' || strIt != it->end())
{
if((*strIt) != ' ')
InstanceDataStepRate += (*strIt);
strIt++;
}
strIt++;
D3D11_INPUT_ELEMENT_DESC element = {
SemanticName.c_str(),
atoi(SemanticIndex.c_str()),
(DXGI_FORMAT)atoi(Format.c_str()),
atoi(InputSlot.c_str()),
atoi(AlignedByteOffset.c_str()),
(D3D11_INPUT_CLASSIFICATION)atoi(InputSlotClass.c_str()),
atoi(InstanceDataStepRate.c_str())
};
desc.push_back(element);
}
Где-то в мире сдох от зависти один индус
−3
function formSelect($itxt, $name = '', $val = array(), $selected = 0, $data = 0, $nullF = false, $atr = '', $optatr = array()) {
if(is_array($selected)) { $atr .= ' multiple'; }
$html = '<select name="'.$name.'" '.$atr.">\r\n";
if($nullF) {
$t = ($nullF === true) ? ' ' : $nullF;
$html .= '<option value="0">'.$t.'</option>'; }
if($data == 3) { $start = $itxt; $count = $val[0]; $step = $val[1]; }
else { $count = count($itxt); }
for($i = 0; $i < $count; $i++) {
// 4 - для быза данных
switch($data) {
case 1: $key = $val[$i]; $txt = $itxt[$i]; break;
case 2: $key = $i; $txt = $itxt[$i]; break;
case 3: $txt = $key = ($start + ($step*$i)); break;
case 4: $key = $itxt[$i][$val[0]]; $txt = $itxt[$i][$val[1]]; break;
default: $key = $txt = $itxt[$i]; break;
}
$sel = '';
if(is_array($selected)) {
if(in_array($key, $selected)) { $sel = 'selected'; }
} elseif($selected == $key) { $sel = 'selected'; }
if(!empty($optatr[$i])) { $opt = $optatr[$i]; } else { $opt = ''; }
$html .= '<option value="'.$key.'" '.$sel.$opt.'>'.$txt."</option>\r\n";
}
$html .= "</select>\r\n";
return $html;
}
Теперь бызить вореции как никогда просто!
+5
void add( std::string *str, std::string *addstr)
{
if(!strlen(addstr->c_str()))
return;
int len = strlen(str->c_str());
if( len )
{
if((str->c_str())[len-1] != ';')
*str = *str + ";";
*str = *str + *addstr;
}
else
*str = *addstr;
len = strlen(str->c_str());
if((str->c_str())[len-1] == ';')
*str = str->substr(0,len-1);
}
+3
$t0=mktime(
preg_replace("/^....\-..\-..\ (..):..:..$/","$1",$task['end_date']),
preg_replace("/^....\-..\-..\ ..:(..):..$/","$1",$task['end_date']),
preg_replace("/^....\-..\-..\ ..:..:(..)$/","$1",$task['end_date']),
preg_replace("/^....\-(..)\-..\ ..:..:..$/","$1",$task['end_date']),
preg_replace("/^....\-..\-(..)\ ..:..:..$/","$1",$task['end_date']),
preg_replace("/^(....)\-..\-..\ ..:..:..$/","$1",$task['end_date'])
);
$t1=mktime(
preg_replace("/^....\-..\-..\ (..):..:..$/","$1",$task['real_end_date']),
preg_replace("/^....\-..\-..\ ..:(..):..$/","$1",$task['real_end_date']),
preg_replace("/^....\-..\-..\ ..:..:(..)$/","$1",$task['real_end_date']),
preg_replace("/^....\-(..)\-..\ ..:..:..$/","$1",$task['real_end_date']),
preg_replace("/^....\-..\-(..)\ ..:..:..$/","$1",$task['real_end_date']),
preg_replace("/^(....)\-..\-..\ ..:..:..$/","$1",$task['real_end_date'])
);
for($i=$t0;$i<=$t1;$i=$i+(60*60))
{
Вот такой разбор дат по крупицам обнаружился...