- 1
- 2
- 3
if (!$_FILES['image']['size'] > 0) {
return;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+148
if (!$_FILES['image']['size'] > 0) {
return;
}
и что самое интересное - оно делает то, что автор пытался изобразить!
+148
function index_tools_transport_http_get($rm = '0') {
static $ra = NULL;
#
if (!isset($ra)) {
$qa = explode('/', preg_replace('#(\/)+#', '/', $_SERVER['QUERY_STRING']), 21);
$ra = array_chunk($qa, 5);
}
#
if ($rm == 'full') {
return $ra;
} else {
return $ra[$rm];
}
}
Здравствуйте товарищи! Эта функция разбирает URL типа ?param1/param2/param3 и создаст массив с разделением на группы по 5 параметров в группе, увидел у одного программиста в коде, достоин ли этот код находиться здесь?
+148
if(diap=='0'){sucs=adder(rooms_0, ident, this);}
if(diap=='1'){sucs=adder(rooms_1, ident, this);}
if(diap=='2'){sucs=adder(rooms_2, ident, this);}
if(diap=='3'){sucs=adder(rooms_3, ident, this);}
if(diap=='4'){sucs=adder(rooms_4, ident, this);}
DRY? Не, не слышал..
+148
document.getElementById('siF20').disabled=(this.checked==true)?false:true;
+148
function mouseHover(state) {
var row = window.event.srcElement;
row.style.cursor='hand';
var colorChange = ((state == "over") ? "#ff0000" : "");
row.style.color = colorChange;
var textChange = ((state == "over") ? "underline" : "none");
row.style.textDecoration = textChange;
}
Где-то в Html
<DIV onmouseover="mouseHover('over')" onmouseout="mouseHover('out')">
Из странички отчёта Microsoft SCCM
+148
$("#ORDER_PROP_5 option[value='7361']").attr("selected", "selected");
Установка значения в селекте.
+148
$("#select_id :selected").attr("selected", false);
$("#select_id option[value='" + new_value + "']").attr("selected", true);
вместо
$("#select_id").val(new_value);
+148
var isScheduledRadio = $('#ContentPlaceHolder1_FormView1_ctl04_ctl00___IsScheduled_RadioButtonList1_0')[0],
isSitnGoRadio = $('#ContentPlaceHolder1_FormView1_ctl04_ctl00___IsScheduled_RadioButtonList1_1')[0],
startDateTextBox = $('#ContentPlaceHolder1_FormView1_ctl04_ctl07___StartDate_TextBox1')[0],
minPlayersTextBox = $('#ContentPlaceHolder1_FormView1_ctl04_ctl14___MinPlayers_TextBox1')[0],
maxPlayersTextBox = $('#ContentPlaceHolder1_FormView1_ctl04_ctl15___MaxPlayers_TextBox1')[0],
maxPlayersRequiredValidator = $('#ContentPlaceHolder1_FormView1_ctl04_ctl15___MaxPlayers_RequiredFieldValidator1')[0],
maxPlayersRow = $('#ContentPlaceHolder1_FormView1_ctl04_ctl15___MaxPlayers_TextBox1')
.parent()
.parent()[0],
endDateTextBox = $('#ContentPlaceHolder1_FormView1_ctl04_ctl08___EndDate_TextBox1')[0],
endDateRequiredValidator = $('#ContentPlaceHolder1_FormView1_ctl04_ctl08___EndDate_RequiredFieldValidator1')[0],
endDateRow = $('#ContentPlaceHolder1_FormView1_ctl04_ctl08___EndDate_TextBox1')
.parent()
.parent()[0],
Увидел такой код с сорцах ASP.Net страницы
+148
ISQ.Translation.Infra.extractJobIdFromText=function(k){
var d;
var g=k.toLowerCase();
var j=g.indexOf("<"+ISQ.Translation.Infra.jobIdMarkerTag);
if(j===-1){
j=g.indexOf("< "+ISQ.Translation.Infra.jobIdMarkerTag)
}
if(j===-1){
if(ISQ.Widget&&ISQ.Widget.Log){
ISQ.Widget.Log.add("ISQ.Translation.Infra.extractJobIdFromText: Couldnt parse jobIdMarker from text! "+k,ISQ.Widget.Log.statusEnum.RED)
}
return{id:-1,text:k}
}
var b=k.indexOf(">",j);
if(b===-1){
if(ISQ.Widget&&ISQ.Widget.Log){
ISQ.Widget.Log.add("ISQ.Translation.Infra.extractJobIdFromText: jobIdMarker tag is invalid!",ISQ.Widget.Log.statusEnum.RED)
}
return{id:-1,text:k}
}
b+=1;
var h=g.substring(j,b);
var e=h.indexOf(ISQ.Translation.Infra.jobIdMarkerTag);
if(e===-1){
if(ISQ.Widget&&ISQ.Widget.Log){
ISQ.Widget.Log.add("ISQ.Translation.Infra.extractJobIdFromText: jobIdMarker tag is invalid!",ISQ.Widget.Log.statusEnum.RED)
}
return{id:-1,text:k}
}
e+=ISQ.Translation.Infra.jobIdMarkerTag.length;
var f="";
var a;
do
{
if(e>h.length){
break
}
a=h.charAt(e++);
if(a.charCodeAt(0)<48||a.charCodeAt(0)>57){
break
}
f+=a
}
while(true);
d=parseInt(f);
if(isNaN(d)){
if(ISQ.Widget&&ISQ.Widget.Log){
ISQ.Widget.Log.add(
"ISQ.Translation.Infra.extractJobIdFromText: jobIdMarker tag is invalid: could not parse id#",
ISQ.Widget.Log.statusEnum.RED)
}
return{id:-1,text:k}
}
var i;
if(j===0){
i=k.substring(b)
}
else
{
i=k.substring(0,j);
if(b<k.length){
i+=k.substring(b)
}
}
return{id:d,text:i}
};
Закомммммммммммментировал!
+148
if(type_file=='png'||type_file=='jpg'||type_file=='gif'||type_file=='jpeg'||type_file=='png')