- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
$value = "";
$content = $content;
$val = "\$content->" . $field->name;
$fieldname = $field->name;
eval("if (isset($val)) \$value = \"$val\";");
$value = JText::_($value);
$value = stripslashes($value);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+159
$value = "";
$content = $content;
$val = "\$content->" . $field->name;
$fieldname = $field->name;
eval("if (isset($val)) \$value = \"$val\";");
$value = JText::_($value);
$value = stripslashes($value);
Joomla. Adsmanager
+161
function get_phrase()
{
global $words;
global $phrase;
$phrase = implode(" ", $words);
if(strlen($phrase) < 4) return;
}
I was amazed to find this!?! The last line of the function rationalized my day...
+159
function CreateLayer(text, id, t, l,m) {
if(document.layers && m==1)
{
var str="<LAYER ID=menu" + id + " TOP=" + t + " LEFT=" + l + " onmouseover=\"occupied_menu[" + id + "]=1;\" onmouseout=\"Turn('" + id + "',0);occupied_menu[" + id + "]=0;\" VISIBILITY=hide Z-INDEX=2 bgcolor=\"#0066CC\">" + text + "</LAYER>";
document.write(str);
}
else if(document.layers && m==2)
{
id = id.substring(0,1);
var str="<LAYER ID=menu" + id + "a TOP=" + t + " LEFT=" + l + " onmouseover=\"occupied_menu[" + id + "]=1;occupied_header[" + id + "]=1;\" onmouseout=\"Turn('" + id + "',0);occupied_menu[" + id + "]=0;occupied_header[" + id + "]=0\" VISIBILITY=hide Z-INDEX=2 bgcolor=\"#EF1010\">" + text + "</LAYER>";
document.write(str);
}
else if(document.all)
{
var strng="<div id=menu" + id + " style=\"position:absolute;top:" + t + ";left:" + l + ";visibility:hidden;width:100;z-index:1;\" onmouseover=\"occupied_menu[" + id + "]=1;\" onmouseout=\"Turn('" + id + "',0);occupied_menu[" + id + "]=0;\">" + text + "</div>";
document.write(strng);
}
}
+140
if ((u[i]!=100500)&&(v[j]==100500))
v[j]=matr[i+1][j+1].cost-u[i];
if ((u[i]==100500)&&(v[j]!=100500))
u[i]=matr[i+1][j+1].cost-v[j];
пересчет платежей в ТЗЛП
+161
if($age != '') {
$d_m_y = explode('-', $age); // Разделяем на day(0) month(1) year(2)
// ГЕНЕРАЦИЯ ФОРМЫ С ДНЕМ РОЖДЕНИЯ
$vars['bday'] = "<select name=\"b_day\">\n<option>-</option>\n";
$i = 1;
while ($i <= 31) {
if($d_m_y[0] == $i) {
$sel = ' selected';
} else {
$sel = '';
}
$vars['bday'] .= '<option'.$sel.'>'.$i."</option>\n";
$i++;
}
$vars['bday'] .= "</select>\n";
// ГЕНЕРАЦИЯ СПИСКА С МЕСЯЦАМИ
$i = 1;
$vars['bmonth'] = "<select name=\"b_month\">\n<option>-</option>\n";
while ($i <= 12) {
if($d_m_y[1] == $i) {
$sel = ' selected';
} else {
$sel = '';
}
$vars['bmonth'] .= '<option'.$sel.'>'.$i."</option>\n";
$i++;
}
$vars['bmonth'] .= "</select>\n"; // Месяц ДР при ред
// ГЕНЕРАЦИЯ СПИСКА С ГОДАМИ
$i = 1940;
$vars['byear'] = "<select name=\"b_year\"\n<option>-</option>\n"; // Год ДР при ред
while ($i <= 2003) {
if($d_m_y[2] == $i) {
$sel = ' selected';
} else {
$sel = '';
}
$vars['byear'] .= '<option'.$sel.'>'.$i."</option>\n";
$i++;
}
$vars['byear'] .= "</select>\n";
$vars['use_age'] = false; // ОТКЛЮЧАЕМ ПОКАЗ ПУСТОГО СПИСКА
} else {
$vars['use_age'] = true;
$vars['bday'] = false;
$vars['bmonth'] = false;
$vars['byear'] = false;
}
Генерация SELECT'ов для выбора даты рождения
−864
comment on column XXX.status
is '0 -- вопрос включен, 1-- выкл';
+124
private void TextBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Space)
{
TextBox box = sender as TextBox;
int start = box.SelectionStart;
int length = box.SelectionLength;
if (length == 0)
{
box.Text = box.Text.Insert(start + length, " ");
box.SelectionStart = start + 1;
}
else
{
string str1 = box.Text.Substring(0, start);
string str2 = box.Text.Substring(start + length);
box.Text = str1 + " " + str2;
box.SelectionStart = start + 1;
}
e.Handled = true;
}
}
Отборный говнокод выращенный на территории Индии.
Видимо им зарплату действительно за строчки кода платят.
−860
-- Из простого...
select kdet, cexnum, cex, last_value(cex) over(partition by kdet) as final_cex
from xxtpa_rout_aztpa_v;
-- Сделаем сложное...
select t.*, max(max_cex) over(partition by kdet, rout_num) max_cex
from (select t.*, case cex_num when max(cex_num) over(partition by t.kdet, t.rout_num) then t.cex else null end max_cex
from xxtpa_rout_aztpa_v t) t;
Пример того, как НЕ применять KISS-принцип.
+158
foreach ($firstQueryRes as $row)
{
$K = $this->ccnm;
$U = $this->getFncByCategory($row->category); // compile material href //
$R = $row->category;
$W = $row->date;
$A = $row->huu_1;
$materialHref[$row->id_all] = site_url("$K/$U/$R/$W/$A");
$materialTitle[$row->id_all] = $row->name;
}
Задание: расшифруйте какое польское плохое слово здесь инкапсулировано.
+72
public class Tm_SP_RP extends Tm_Service implements IObject{
private static final String m_MsgProfileStore =
"UPDATE TM_SP_RP SET strMsgProfile=? WHERE nServiceID=?";
private static final String m_WorkaroundHack =
"SELECT data_type FROM user_tab_columns WHERE table_name='TM_SP_RP' AND column_name='STRMSGPROFILE'";
private String strMsgProfile = null;
/* Здесь ещё разные всякие методы */
private static String getWorkaroundType(Connection conn) throws SQLException
{
PreparedStatement stmt = conn.prepareStatement(m_WorkaroundHack);
try
{
ResultSet rset = stmt.executeQuery();
try
{
if (!rset.next())
return "VARCHAR2";
return rset.getString(1);
}
finally
{
if (rset != null)
rset.close();
}
}
finally
{
if (stmt!=null)
stmt.close();
}
}
public void storeMsgProfile(Connection conn) throws SQLException
{
String w_around = getWorkaroundType(conn);
PreparedStatement stmt = conn.prepareStatement(m_MsgProfileStore);
try
{
if (w_around.equalsIgnoreCase("VARCHAR2") ||
w_around.equalsIgnoreCase("VARCHAR"))
{
if (strMsgProfile == null)
stmt.setNull(1, Types.NULL);
else
stmt.setString(1, strMsgProfile);
}
else
{
byte []data = (strMsgProfile == null) ?
new byte[0] : strMsgProfile.getBytes();
stmt.setBytes(1, data);
}
stmt.setLong(2, this.getId());
stmt.executeUpdate();
}
finally
{
if (stmt!=null)
stmt.close();
}
}
}
Комбинация из багованных JDBC-дров Oracle и работающего с ним Hibernate (чтоб он сдох) иногда заставляет рождать вот такие хитрые workaround-хаки. Несколько баз, в одной тип поля - LONG, в другой - VARCHAR2.