- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
/**
* Строка парсится в аргументы функции
* @param string
* @return <type>
*/
protected function _parse_func_arg ( $str ) {
return func_get_args();
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+163
/**
* Строка парсится в аргументы функции
* @param string
* @return <type>
*/
protected function _parse_func_arg ( $str ) {
return func_get_args();
}
Поколупал netсat. Получил много эмоций... Спасибо.
( PS. По-моему, скоро netсat останется только в unix... )
+142
function categories_all()
{
// Запрос.
$query = "SELECT id, title FROM categories ORDER BY id DESC";
$result = mysql_query($query) or die (mysql_error());
if (!$result)
die(mysql_error());
// Извлечение из БД.
$n = mysql_num_rows($result);
$cat = array();
for ($i = 0; $i < $n; $i++)
{
$row = mysql_fetch_assoc($result);
$cat[] = $row;
}
return $cat;
}
Выборка всех категорий Такого я еще нигде не видел.
+164
if($password===$_POST['password'] && $login===$_POST['login'])
{
// устанавливаем login & pass
$_SESSION['login']=$_POST['login'];
$_SESSION['password']=$_POST['password'];
// Перенаправляем в админ панель
Header("Location: config.php");
}
else { ... }
+192
class AutocompleteAddressZaplatka2 extends AutocompleteAddressZaplatka
Фундаментальные объектно-ориентированные костыли ...
+164
$cur = date('Y-m-d',time());
$date_arr = explode('-',$cur);
$year =$date_arr[0];
$month =$date_arr[1];
$day =$date_arr[2];
+162
function show_price_list() {
$period_1 = $period_2 = $period_3 = $period_4 = $period_5 = $period_6 = "";
$query = "
SELECT id, price, type
FROM price
ORDER BY type, start
";
$this->registry['sql']->query($query);
if ($this->registry['sql']->getNumberRows()>0) {
foreach ($this->registry['sql']->getFetchObject() as $oRow) {
switch($oRow->type) {
case 0: $period_1 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 1: $period_2 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 2: $period_3 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 3: $period_4 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 4: $period_5 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 5: $period_6 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
}
}
}
@$this->registry['template']->set('period_1', $period_1);
@$this->registry['template']->set('period_2', $period_2);
@$this->registry['template']->set('period_3', $period_3);
@$this->registry['template']->set('period_4', $period_4);
@$this->registry['template']->set('period_5', $period_5);
@$this->registry['template']->set('period_6', $period_6);
}
Классика жанра
+160
class CIBlockFindTools
...
function GetSectionID($section_id, $section_code, $arFilter)
{
$section_id = intval($section_id);
if($section_id > 0)
{
return $section_id;
} else if(){
}
return 0;
...
}
битрикс суров, использует свою реализацию intval(). как мы могли без этого жить?
+163
$lu=0;
$ray_array = file("allray.txt");
while (empty($rayon)) //пока район не заполнен значением
{
preg_match("#".trim($ray_array[$lu++])."#", $text, $rayon);
}
Многострочный поиск
+158
if ($result === false) {
$result = $translated;
}
if ($result === false){
$result = $translated;
}
Magento. Так работают переводы.
+168
if ($sum == 30) {
return 24;
} else {
return $sum * 0.8;
}