1. C# / Говнокод #9796

    +119

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    string str;
            if (((str = path) != null) && (str != "basic"))
            {
                if (str == "contact")
                {
                    BindContact();
                    PageTitle = "Contact info";
                    editform.SetActiveView(vi_contact);
                    return;
                }
                if (str == "personal")
                {
                    PageTitle = "More about me";
                    BindPersonal();
                    editform.SetActiveView(vi_personal);
                    return;
                }
                if (str == "career")
                {
                    PageTitle = "Work info";
                    BindCareer();
                    editform.SetActiveView(vi_career);
                    return;
                }
                if (str == "tags")
                {
                    BindTags();
                    PageTitle = "Tags I Follow";
                    editform.SetActiveView(vi_tags);
                    return;
                }
                if (str == "biography")
                {
                    ph_page_title.Visible = false;
                    bind_biography();
                    editform.SetActiveView(vi_biography);
                    return;
                }
                if (str == "pp")
                {
                    ph_picpage_title.Visible = true;
                    ph_page_title.Visible = false;
                    PageTitle = "Edit profile photo";
                    BindProfilePhoto();
                    return;
                }
            }
    
            PageTitle = "Basic info";
            BindBasic();
            editform.SetActiveView(vi_basic);

    switch на диалекте хинди ;[ слава asp.net! убить Мартинса и Фаулера за чистокодную ересь!

    qwertylolman, 28 Марта 2012

    Комментарии (9)
  2. PHP / Говнокод #9794

    +152

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    ///////////////////////////////КОДИТ FIELD////////////////////////////////
    if($opt == 'bags') {
    echo "<h3>Ошибки в фильмах</h3>
    <a href='/admin/index.php?view=components&do=config&id=24&opt=bags&old=0'>Активные ошибки</a>
    <a href='/admin/index.php?view=components&do=config&id=24&opt=bags&old=1'>Исправленные ошибки</a>
    
    <table border=1><tr><td>Дата</td><td>Название фильма</td><td>Добавил ошибку</td><td>Тип ошибки</td><td>Описание</td><td>Статус</td><td>Исправил</td></tr>";
    $old = $_REQUEST['old'];
    if ($old==1) {$result=$inDB->query("SELECT * from cms_multimedia_bags WHERE `fixed`='1' ORDER by date DESC");}
    else         {$result=$inDB->query("SELECT * from cms_multimedia_bags WHERE `fixed`<>'1' ORDER by date DESC");}
    
    while($row=$inDB->fetch_assoc($result)) {
    if ($row['admin']=='') {$row['admin']="Неисправлена";}
    if ($row['fixed']==1) {$fix="<center><a href='/admin/index.php?view=components&do=config&id=24&opt=fix_bag&fixed=0&bag_id=$row[id]' title='Исправлена'><img src=/admin/images/actions/button_check.png></a>";$table_color="";$fix_date="($row[fix_date])";}
    if ($row['fixed']<>1) {$fix="<center><a href='/admin/index.php?view=components&do=config&id=24&opt=fix_bag&fixed=1&bag_id=$row[id]' title='Не исправлена'><img src=/admin/images/actions/stop.png></a>";$table_color="<font color=red>";$fix_date="";}
    
    if ($row['multimedia_group']==2) {$tip='add_films';}
    if ($row['multimedia_group']==3) {$tip='add_serials';}
    
    if ($row['type']==1) {$row['type']='Не скачивается';}
    if ($row['type']==2) {$row['type']='Не просматривается';}
    if ($row['type']==3) {$row['type']='Ошибка в описании фильма';}
    if ($row['type']==4) {$row['type']='Неверный постер';}
    if ($inUser->id==275) {$del="(<a href='/admin/index.php?view=components&do=config&id=24&opt=del_bag&bag_id=$row[id]'>x</a>)";}
    
    $result1=$inDB->query("SELECT * from cms_multimedia_names WHERE `id`='$row[film_id]'");
    $film_row=$inDB->fetch_assoc($result1);
    $result2=$inDB->query("SELECT * from cms_users WHERE `id`='$row[user_id]'");
    $user_row=$inDB->fetch_assoc($result2);
    echo "<tr><td>$table_color$row[date]</td><td><a href='/admin/index.php?view=components&do=config&id=24&opt=$tip&cat_group=$row[multimedia_group]&file_id=$row[file_id]'>" . $film_row['video_name_rus'] . "</a>(<a href='/multimedia/$row[multimedia_group]/$row[film_id]/$row[file_id]' target='_blank'>на сайте</a>)</td><td><a href='/users/$user_row[nickname]'>$user_row[nickname]</a>($row[ip])</td><td>$table_color" . $row['type'] . "</td><td>$table_color" . $row['description'] . "</td><td>$fix $del<td>$row[admin] $fix_date</td></tr>";
    }
    echo "</table>";
    
    }
    if($opt == 'fix_bag') {
    $bag_id = $_REQUEST['bag_id'];
    $fixed = $_REQUEST['fixed'];
    $date=date("Y-m-d H:i:s");
    
    if ($fixed==1) {$inDB->query("UPDATE cms_multimedia_bags SET `fixed`='$fixed', `fix_date`='$date', `admin`='$inUser->nickname' WHERE id=$bag_id");}
    else          {$inDB->query("UPDATE cms_multimedia_bags SET `fixed`='$fixed', `fix_date`='$date', `admin`='' WHERE id=$bag_id");}
    $inCore->redirect('/admin/index.php?view=components&do=config&id='.$_REQUEST['id'].'&opt=bags');
    }
    if($opt == 'del_bag') {
    $bag_id = $_REQUEST['bag_id'];
    $inDB->query("DELETE from cms_multimedia_bags WHERE id=$bag_id");
    $inCore->redirect('/admin/index.php?view=components&do=config&id='.$_REQUEST['id'].'&opt=bags');
    }
    
    ///////////////////////////////КОНЕЦ КОДА FIELD/////////////////////////

    =) Наш заказчик нанял, нового специалиста php, который якобы "помогает" нам дорабатывать проект=

    onzone, 28 Марта 2012

    Комментарии (7)
  3. PHP / Говнокод #9793

    +152

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    switch (count($params)) {
    	case 0:
    		return $this->{$method}();
    	case 1:
    		return $this->{$method}($params[0]);
    	case 2:
    		return $this->{$method}($params[0], $params[1]);
    	case 3:
    		return $this->{$method}($params[0], $params[1], $params[2]);
    	case 4:
    		return $this->{$method}($params[0], $params[1], $params[2], $params[3]);
    	case 5:
    		return $this->{$method}($params[0], $params[1], $params[2], $params[3], $params[4]);
    	default:
    		return call_user_func_array(array(&$this, $method), $params);
    	break;
    }

    cakephp framework v 1.3

    57uff3r, 28 Марта 2012

    Комментарии (3)
  4. Objective C / Говнокод #9792

    −117

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    @synthesize coins;
    
    -(void)setCoins:(int)value {
        coins += value;
    }

    Сеттер с сюрпризом

    SevInf, 28 Марта 2012

    Комментарии (3)
  5. Java / Говнокод #9791

    +60

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    public int getSummaryChildWidth() {
    		return getMaxChildWidth(true);
    	}
    
    	public int getFuckingDinosaurD*cksHeight() {
    		return 0;
    	}
    
    	public int getFuckingDinosaurD*cksWidth() {
    		return 0;
    	}

    Достался в наследство шедевр(выложен с цензурой). Самое интересное, что в svn эти методы еще и что-то выполняли.

    PS. речь не про утку.

    neschastnii, 28 Марта 2012

    Комментарии (10)
  6. C++ / Говнокод #9790

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    THTTPServer::TDynamicResponse::~TDynamicResponse( void )
    {
    	if(typeid(*this)==typeid(TDynamicResponse))//Борьба с pure virtual function call.
    		this->flush();
    };

    Проект поменьше.

    Говногость, 28 Марта 2012

    Комментарии (62)
  7. C++ / Говнокод #9789

    +156

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    void checkDuplicateType(TWindowCasterToWindowAdditionalInformation GetWindowAdditionalInformation)
    	{
    		const TCasterRepository::const_iterator NotFound=_casterRepository.end();
    		const TCasterRepository::const_iterator Begin=_casterRepository.begin();
    		struct _
    		{
    			static bool TestDuplicateTypeAtThisItem(const TCasterRepository::value_type& Item, TWindowCasterToWindowAdditionalInformation GetWindowAdditionalInformationFunction)
    			{
    				return Item.second==GetWindowAdditionalInformationFunction;
    			}
    		};
    		ASSERT(std::find_if(Begin, NotFound, BOOST_BIND(_::TestDuplicateTypeAtThisItem, _1, GetWindowAdditionalInformationFunction))==NotFound);
    	}

    Большой проект.

    Говногость, 28 Марта 2012

    Комментарии (8)
  8. PHP / Говнокод #9788

    +154

    1. 1
    if (!empty($params[$fieldName.'_need_group']) ? true : false) $errors[$fieldName] = 2;

    Просто очень тщательная проверка, если true то true, а если false то false....

    nikll, 28 Марта 2012

    Комментарии (2)
  9. Java / Говнокод #9787

    +76

    1. 1
    2. 2
    3. 3
    4. 4
    } catch (IllegalArgumentException e) {
        // checked exceptions are stupid
        throw new UnexpectedException(e);
    }

    https://github.com/lmcalpin/Play--Paginate/blob/master/src/play/modules/paginate/strategy/JPARecordLocatorStrategy.java#L149

    Well...

    public class IllegalArgumentException extends RuntimeException

    roman-kashitsyn, 28 Марта 2012

    Комментарии (4)
  10. JavaScript / Говнокод #9786

    +153

    1. 1
    2. 2
    3. 3
    if (childMenus[oRow._index]) if (TransMenu.sub_indicator && oRow.lastChild.firstChild.src) {
    			oRow.lastChild.firstChild.src = TransMenu.dingbatOn
    		}

    zima, 28 Марта 2012

    Комментарии (0)