- 1
<?php $display=''; if ($i>1) { eval('if (!$model->photo'.$i.') {$display = "style=\"display: none;\"";}');} ?>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+158
<?php $display=''; if ($i>1) { eval('if (!$model->photo'.$i.') {$display = "style=\"display: none;\"";}');} ?>
Не, ну а чего? Нужно же осваивать новые функции!
+157
if(isset($_HTTP_POST_VARS)){
foreach($_HTTP_POST_VARS as $k => $v){
$$k = $v;
}
}
+97
var
TCPLength: boolean;
Ага. Длина либо есть, либо нет.
+153
$k_new=mysql_result(mysql_query("SELECT COUNT(`mail`.`id`) FROM `mail`
LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` IS NULL OR `users_konts`.`type` = 'common' OR `users_konts`.`type` = 'favorite') AND `mail`.`read` = '0'"),0);
$k_new_fav=mysql_result(mysql_query("SELECT COUNT(`mail`.`id`) FROM `mail`
LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` = 'favorite') AND `mail`.`read` = '0'"),0);
+132
private NpgsqlDbType GetDbType(Type clrType, bool large = false)
{
if (clrType == null)
throw new ArgumentNullException("clrType");
// Try to get underlying type if it is nullable type.
clrType = Nullable.GetUnderlyingType(clrType) ?? clrType;
if (clrType == typeof(int) || clrType == typeof(uint))
{
return NpgsqlDbType.Integer;
}
else if (clrType == typeof(byte) || clrType == typeof(sbyte) || clrType == typeof(short) || clrType == typeof(ushort))
{
return NpgsqlDbType.Smallint;
}
else if (clrType == typeof(long) || clrType == typeof(ulong))
{
return NpgsqlDbType.Bigint;
}
else if (clrType == typeof(double))
{
return NpgsqlDbType.Double;
}
else if (clrType == typeof(float))
{
return NpgsqlDbType.Real;
}
else if (clrType == typeof(decimal))
{
return NpgsqlDbType.Numeric;
}
else if (clrType == typeof(bool))
{
return NpgsqlDbType.Boolean;
}
else if (clrType == typeof(string))
{
return large ? NpgsqlDbType.Text : NpgsqlDbType.Varchar;
}
else if (clrType == typeof(char))
{
return NpgsqlDbType.Char;
}
else if (clrType == typeof(DateTime))
{
return NpgsqlDbType.Timestamp;
}
else if (clrType == typeof(Guid))
{
return NpgsqlDbType.Uuid;
}
else if (typeof(Array).IsAssignableFrom(clrType))
{
return NpgsqlDbType.Array | GetDbType(clrType.GetElementType(), large);
}
else
throw new NotSupportedException(string.Format("Not supported clr type {0} to convert {1}.", clrType.FullName, typeof(NpgsqlDbType).FullName));
}
определение типа
−166
итСумма = 0;
иткол = 0;
Для каждого стр из комплектующие Цикл
итсумма = итсумма + стр.Суммаплан;
иткол = иткол + стр.КоличествоБезПотерь;
Конеццикла;
Зашел в базу, а там вот это... повторяется...раза 4
+76
String str = "";
str = str.concat(
((code1.length() == 0 || code1.startsWith("00")) ? "77" : (code1.length() == 1) ? "0".concat(code1) : code1)
).concat(
((code2.length() == 0) ? "000" : (code2.length() == 1) ? "00".concat(code2) : (code2.length() == 2) ? "0" : code2
).concat(
((code3.length() == 0) ? "000" : (code3.length() == 1) ? "00".concat(code3) : (code3.length() == 2) ? "0".concat(code3) : code3)
).concat(
((code4.length() == 0) ? "000" : (code4.length() == 1) ? "00".concat(code4) : (code4.length() == 2) ? "0".concat(code4) :code4)
).concat(
((code5.length() == 0) ? "0000" : (code5.length() == 1) ? "000".concat(code5) : (code5.length() == 2) ? "00".concat(code5) : (code5.length() == 3) ? "0".concat(code5) : code5)
).concat("00")
);
Форматирования 5 чисел по заданному шаблону. А если бы нужно было догнать до 100 нулей?)
+72
Date convertedDate = new Date();
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy:MM:dd",
Locale.getDefault());
try {
convertedDate = dateFormatter.parse("" + year + ":" + month + ":"
+ day);
} catch (ParseException e) {
e.printStackTrace();
}
SimpleDateFormat fmtOut = new SimpleDateFormat("MM/dd/y");
String curDate = fmtOut.format(convertedDate).toString();
+135
var methods = from mi in typeof(T).GetMethods()
where !mi.IsAbstract && mi.Name == methodName
select mi;
LINQ over Reflection
+153
<?php foreach ($category_1['children'] as $category_2) { ?>
<?php if ($category_2['category_id'] == $category_id) { ?>
<option value="<?php echo $category_2['category_id']; ?>" selected="selected"> <?php echo $category_2['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $category_2['category_id']; ?>"> <?php echo $category_2['name']; ?></option>
<?php } ?>
<?php foreach ($category_2['children'] as $category_3) { ?>
<?php if ($category_3['category_id'] == $category_id) { ?>
<option value="<?php echo $category_3['category_id']; ?>" selected="selected"> <?php echo $category_3['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $category_3['category_id']; ?>"> <?php echo $category_3['name']; ?></option>
<?php } ?>
Код вида поиска из известной модификации CMS Opencart - Maxystore.