1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #19893

    0

    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
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    if (empty($_GET['mms']) and empty($_GET['mass']) and empty($_GET['showuser']) and empty($_GET['user']) and empty($_GET['rate'])) {
    $db = mysql_connect ( "mysql.hostinger.ru", "u391920429_gala", "kirill1998" );
    mysql_select_db ( "u391920429_gala", $db );
    $pas = $_POST['pas'];
    $pass1 = $_POST['pass1'];
    $pass2 = $_POST['pass2'];
    $lop = addcslashes($pass1, '?%');
    $jjj = mysql_real_escape_string ($lop);
    $pol = addcslashes($pass2, '?%');
    $kkk = mysql_real_escape_string ($pol);
    $i = $_GET['edit'];
    $mail = $_POST['mail'];
    $stat = $_POST['stat'];
    $ava = $_POST['ava'];
    $ie = addcslashes($i, '?%');
    $ieq = mysql_real_escape_string ($ie);
    $id = preg_replace('~[^a-z0-9 \x80-\xFF]~i', "",$ieq);
    $lol = addcslashes($mail, '?%');
    $ooo = mysql_real_escape_string ($lol);
    $per = addcslashes($stat, '?%');
    $adr = mysql_real_escape_string ($per);
    $po = addcslashes($ava, '?%');
    $popa = mysql_real_escape_string ($po);
    $re=mysql_query("SELECT * FROM users WHERE id='$id'", $db);
    $user = $_SESSION["id"];
    if (mb_strlen($_POST['mail']) >= 4) {
    $up=mysql_query("UPDATE users SET email='$ooo' WHERE id='$user'", $db);
    }
    if (mb_strlen($_POST['stat']) >= 5) {
    $up=mysql_query("UPDATE users SET stat='$adr' WHERE id='$user'", $db);
    }
    if (mb_strlen($_POST['ava']) >= 4) {
    $up=mysql_query("UPDATE users SET ava='$popa' WHERE id='$user'", $db);
    }
    $name = $_SESSION["name"];
    $result=mysql_query("SELECT * FROM users WHERE name='$name'", $db);
    $myrow=mysql_fetch_array($result);
    $passs = md5($pas);
    if ($passs == $myrow["pass"]) {
    if ($jjj == $kkk) {
    if (mb_strlen($jjj) >=5) {
    $mdpass = md5($jjj);
    $up=mysql_query("UPDATE users SET pass='$mdpass' WHERE id='$user'", $db);
    }
    }
    }
    $res=mysql_fetch_array($re);
    if ($_SESSION["id"] == $id) {
    	if ($res['ban'] == 1) {
    		echo '<div class="user_prof">
    		<div class="name_prof_block">Профиль</div>
    				<form name="set" action="/prof.php?edit='.($res['id']).'" method="post">
    				<div class="name_prof_b">Почта</div>
    					<input class="form_mail" value="'.$res['email'].'" name="mail" type="text"/>
    				<div class="name_prof_b">Аватар</div>
    					<input class="form_ava" value="'.$res['ava'].'" name="ava" type="text"/>
    				<div class="name_prof_b">Статус</div>
    					<div class="bb_code_div">'.BB_PANEL('set','stat').'</div>
    					<textarea class="form_status" name="stat" type="text">'.$res['stat'].'</textarea>
    					<input class="add_news" value="Сохранить" type="submit"/>
    				</form>
    		</div>';
    		echo '<div class="stat_prof">
    		<div class="name_prof_block">Пароль</div>
    				<form action="" method="post">
    					<input class="form_mail" placeholder="Старый пароль" name="pas" type="text"/>
    					<input class="form_mail" placeholder="Новый пароль" name="pass1" type="text"/>
    					<input class="form_ava" placeholder="Повторите новый пароль" name="pass2" type="text"/>
    					<input class="add_news" value="Сменить пароль" type="submit"/>
    				</form>
    		</div>';
    	}
    	if ($res['ban'] == 0) {
    	echo '<div class="user_prof">Ваш аккаунт заблокирован<a class="logout_prof" href="/?step=exit">Выход</a></div>';
    	}
    }
    else {
    		echo 'Доступ запрещен';
    }
    }

    slowpoke59rus, 27 Апреля 2016

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

    +2

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    function plays(){
    var snd = new Audio("http://boobooka.com/wp-content/uploads/2013/02/33bells33.mp3");   
    snd.preload = "auto";   
    snd.play();
    }
    
    function showTime()
    {
    var dat = new Date();
    var ch = dat.getDate();
    var montha = new Array();
    montha[0] = "января";
    montha[1] = "февраля";
    montha[2] = "марта";
    montha[3] = "апреля";
    montha[4] = "мая";
    montha[5] = "июня";
    montha[6] = "июля";
    montha[7] = "августа";
    montha[8] = "сентября";
    montha[9] = "октября";
    montha[10] = "ноября";
    montha[11] = "декабря";
    var mon = montha[dat.getMonth()];
    var ye = dat.getYear()+ 1900;
    var ned = dat.getDay();
    var day = new Array();
    day[1] = "Понедельник";
    day[2] = "Вторник";
    day[3] = "Среда";
    day[4] = "Четверг";
    day[5] = "Пятница";
    day[6] = "Суббота";
    day[0] = "Воскресенье";
    var nedel = day[dat.getDay()];
    var H = '' + dat.getHours();
    H = H.length<2 ? '0' + H:H;
    var M = '' + dat.getMinutes();
    M = M.length<2 ? '0' + M:M;
    var S = '' + dat.getSeconds();
    S =S.length<2 ? '0' + S:S;
    var clock = H + ':' + M + ':' + S;
    var cl = H + M + S;
    var chislo = ch+" "+mon;
    var chisl = ye+" года";
    document.getElementById('time_div').innerHTML=clock;
    document.getElementById('ned_div').innerHTML=nedel;
    document.getElementById('chi_div').innerHTML=chislo;
    document.getElementById('chis_div').innerHTML=chisl;
    if(clock == '09:00:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '09:40:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '09:50:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '10:30:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '10:40:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '11:20:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '11:40:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '12:20:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '12:30:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '13:10:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '13:20:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '14:00:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '14:20:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '15:00:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '15:10:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '15:50:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '16:00:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '16:40:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '16:45:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '17:25:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '17:30:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '18:10:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '18:15:00'){if(1<=ned && ned<=6){plays();}}
    if(clock == '18:55:00'){if(1<=ned && ned<=6){plays();}}
    setTimeout(showTime,1000);
    if(1<=ned && ned<=6)
    {
        if(cl >= 090000 && cl < 094000) {document.getElementById('mes_div').innerHTML="Идет 1-й урок (09:00-09:40)";}
        if(cl >= 094000 && cl < 095000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (09:40-09:50)";}
        if(cl >= 095000 && cl < 103000) {document.getElementById('mes_div').innerHTML="Идет 2-й урок (09:50-10:30)";}
        if(cl >= 103000 && cl < 104000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (10:30-10:40)";}
        if(cl >= 104000 && cl < 112000) {document.getElementById('mes_div').innerHTML="Идет 3-й урок (10:40-11:20)";}
        if(cl >= 112000 && cl < 114000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (11:20-11:40)";}
        if(cl >= 114000 && cl < 122000) {document.getElementById('mes_div').innerHTML="Идет 4-й урок (11:40-12:20)";}
        if(cl >= 122000 && cl < 123000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (12:20-12:30)";}
        if(cl >= 123000 && cl < 131000) {document.getElementById('mes_div').innerHTML="Идет 5-й урок (12:30-13:10)";}
        if(cl >= 131000 && cl < 132000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (13:10-13:20)";}
        if(cl >= 132000 && cl < 140000) {document.getElementById('mes_div').innerHTML="Идет 6-й урок (13:20-14:00)";}
        if(cl >= 140000 && cl < 142000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (14:00-14:20)";}
        if(cl >= 142000 && cl < 150000) {document.getElementById('mes_div').innerHTML="Идет 7-й урок (14:20-15:00)";}
        if(cl >= 150000 && cl < 151000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (15:00-15:10)";}
        if(cl >= 151000 && cl < 155000) {document.getElementById('mes_div').innerHTML="Идет 8-й урок (15:10-15:50)";}
        if(cl >= 155000 && cl < 160000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (15:50-16:00)";}
        if(cl >= 160000 && cl < 164000) {document.getElementById('mes_div').innerHTML="Идет 9-й урок (16:00-16:40)";}
        if(cl >= 164000 && cl < 164500) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (16:40-16:45)";}
        if(cl >= 164500 && cl < 172500) {document.getElementById('mes_div').innerHTML="Идет 10-й урок (16:45-17:25)";}
        if(cl >= 172500 && cl < 173000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (17:25-17:30)";}
        if(cl >= 173000 && cl < 181000) {document.getElementById('mes_div').innerHTML="Идет 11-й урок (17:30-18:10)";}
        if(cl >= 181000 && cl < 181500) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (18:10-18:15)";}
        if(cl >= 181500 && cl < 185500) {document.getElementById('mes_div').innerHTML="Идет 12-й урок (18:15-18:55)";}
    if(cl >= 185500 && cl < 235959) {document.getElementById('mes_div').innerHTML="  ";}

    Исходный код из "научно-практической" работы школьника.
    Прихватил с конференции. (Не всё влезло)

    RigFox, 27 Апреля 2016

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

    +5

    1. 1
    2. 2
    Результат работы нашего бывшего верстальщика.
    http://pastebin.com/sDndiz9Q

    Результат работы нашего бывшего верстальщика.
    http://pastebin.com/sDndiz9Q

    infolevelru, 26 Апреля 2016

    Комментарии (10)
  5. PHP / Говнокод #19868

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <p class="name">
                    {% if (file.url) { %}
                        <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
                    {% } else { %}
                        <span>{%=file.name%}</span>
                    {% } %}
                </p>
                {% if (file.error!="SyntaxError: Unexpected token <") { %}
                    <div><span class="label label-danger">Error</span> {%=file.error%}</div>
                {% } %}

    Шедевральный человек! Оригинал http://www.yiiframework.ru/forum/viewtopic.php?t=15956#p119944

    dimka3210, 23 Апреля 2016

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

    +1

    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
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    void CScene::IncludeObjects()
    {
    // Reset All.
    	ExcludeObjects();
    
    // fill Vershiny of piramid...
    	point3d versh[4];
    	point3d eye = {IniSet.ptCamPos.x, IniSet.ptCamPos.y, IniSet.ptCamPos.z};
    	Screen2World(0, 0, versh[0]);
    	Screen2World(nScreenSzX, 0, versh[1]);
    	Screen2World(nScreenSzX, nScreenSzY, versh[2]);
    	Screen2World(0, nScreenSzY, versh[3]);
    
    // Increase before OO...
    	
    	int ix, sz = parrObjs.Size();
    	point3d vect;
    	for(ix = 0; ix < 4; ix++){
    		sub_vectors(&vect.x, &versh[ix].x, &eye.x);
    		norm_vect(&vect.x);
    		scale_vect(&vect.x, 200.f);
    		versh[ix] = vect;
    	}
    
    // Create faces of piramid and search collision with it...
    	point3d Piramid[4][3];
    	Piramid[0][0] = eye;
    	Piramid[1][0] = eye;
    	Piramid[2][0] = eye;
    	Piramid[3][0] = eye;
    	Piramid[0][1] = versh[0];
    	Piramid[0][2] = versh[1];
    	Piramid[1][1] = versh[1];
    	Piramid[1][2] = versh[2];
    	Piramid[2][1] = versh[2];
    	Piramid[2][2] = versh[3];
    	Piramid[3][1] = versh[3];
    	Piramid[3][2] = versh[0];
    	
    // Dyadya WALERA!!!!
    	for(ix = nObjOff; ix < sz; ix++){
    		CObj3d *pObj = parrObjs.e(ix);
    		pObj->Transform(FALSE);
    		point3d ptPos = pObj->GetPosition();
    
    		if(IniSet.nIncludeObjectMode == WS_INCLUDE_BARYCENTER){
    			point3d ptCentr = IniSet.ptCamTarget;
    			point3d vtVect;
    			
    			sub_vectors(&vtVect.x, &ptPos.x, &ptCentr.x);
    
    			plane plGran;
    			point3d ptCross;
    			for(int jx = 0; jx < 4; jx++){
    				comp_plane_eqn(&plGran.a, &Piramid[jx][0].x, &Piramid[jx][1].x, &Piramid[jx][2].x);
    				cross_line_plane(vtVect, &plGran.a, ptCentr, ptCross);
    				float f1, f2;
    				f1 = plGran.a * ptPos.x + plGran.b * ptPos.y + plGran.c * ptPos.z + plGran.d;
    				f2 = plGran.a * ptCentr.x + plGran.b * ptCentr.y + plGran.c * ptCentr.z + plGran.d;
    				if(f1 * f2 < 0.f){
    					if(point_in_triangle(Piramid[jx][0], Piramid[jx][1], Piramid[jx][2], ptCross)){
    						ptCross = ConvertPos3D(ptCross);
    						if(IniSet.bMirrorH){ ptCross.y = -ptCross.y; }
    						if(IniSet.bMirrorV){ ptCross.x = -ptCross.x; }
    						if(IniSet.bMirrorD){ ptCross.z = -ptCross.z; }
    
    						transform_back_point(&ptCross, &ptCross, &IniSet.mtMatr);
    						pObj->ptSavedPos = ptCross;
    						break;
    					}
    				}
    			}
    		}else{ // XYZ Axes.
    			point3d vtXYZ[3] = {{1.f, 0.f, 0.f},
    								{0.f, 1.f, 0.f},
    								{0.f, 0.f, 1.f}};
    
    			BOOL bFound = FALSE;
    			for(int ax = 0; ax < 3; ax++){
    
    				point3d vtVect;
    				transform_point(&vtVect, &vtXYZ[ax], &IniSet.mtMatr);
    				
    				for(int jx = 0; jx < 4; jx++){
    					plane plGran;
    					comp_plane_eqn(&plGran.a, &Piramid[jx][0].x, &Piramid[jx][1].x, &Piramid[jx][2].x);
    					
    					point3d ptCentr = IniSet.ptCamTarget;
    
    					point3d ptCross;
    					cross_line_plane(vtVect, &plGran.a, ptPos, ptCross);
    					float f1, f2;
    
    					f1 = plGran.a * ptPos.x + plGran.b * ptPos.y + plGran.c * ptPos.z + plGran.d;
    					f2 = plGran.a * ptCentr.x + plGran.b * ptCentr.y + plGran.c * ptCentr.z + plGran.d;
    
    					point3d vtDif;
    					sub_vectors(&vtDif.x, &ptCross.x, &IniSet.ptCamPos.x);
    					if(vec_length(&vtDif.x) < 0.01f){ continue; } // avoid crossing with eye.

    Гавнокод: включить все 3Д объекты в экран.

    falcoware, 21 Апреля 2016

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

    +2

    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
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    public function get($userId = null, $advense = false) {
            
            if ($userId === null) $userId = $this->currentId;
            
            $user = DB::table('users')
                    ->select(
                            '*',
                            DB::raw('IF(email IS NOT NULL AND email_confirm IS NULL, 1, 0) AS email_confirm'),
                            DB::raw('IF(phone IS NOT NULL AND phone_confirm IS NULL, 1, 0) AS phone_confirm'),
                            DB::raw('IF(birthday IS NOT NULL, TIMESTAMPDIFF(YEAR,birthday,CURDATE()), NULL) AS age'),
                            DB::raw('IF(phone IS NOT NULL AND phone_confirm IS NULL AND email IS NOT NULL AND email_confirm IS NULL AND (new_first_name IS NOT NULL OR new_last_name IS NOT NULL OR new_status_text IS NOT NULL OR new_image_url IS NOT NULL), 1, 0) AS on_moderate'))
                    ->where('id', $userId)->first();
            
            if ($user === null) throw new Exception ('User is not found', 404);
            unset($user->password);
            $user->locality           = Geo::get($user->locality_id);
            $rating = $this->rating($userId);
            $user->rating           = (float)$rating->avg;
            $user->rating_counter   = (int)$rating->cnt;
            $user->counters        = $this->getCounters($userId);
    
            
            $contact = $this->contacts->isMyContact($userId);
            if ($userId != $this->currentId) {
                $user->created = null;
                $user->updated = null;
                $user->birthday = null;
                $user->email_confirm = null;
                $user->phone_confirm = null;
                $user->subscribed = null;
                $user->organizations = null;
                $contact = $this->contacts->isMyContact($userId);
                // Если пользователь не контакт авторизованного, сотрем контактную информацию
                if ( $contact === null || $contact === 'declined') {
                    $user->phone = null;
                    $user->email = null;
                    $user->last_name = mb_substr($user->last_name, 0, 1, 'UTF-8');
                }
                
            } else {
                if($user->new_first_name !== null) {
                    $user->first_name = $user->new_first_name;
                }
                if($user->new_last_name !== null) {
                    $user->last_name = $user->new_last_name;
                }
                if($user->new_image_url !== null) {
                    $user->image_url = $user->new_image_url;
                }
                if($user->new_status_text !== null) {
                    $user->status_text = $user->new_status_text;
                }
                $user->organizations = Organizations\Organizations::getByUserId($userId);
                $user->is_followed     = null;
                $user->is_my_contact   = null;
                $user->has_my_contact  = null;
                $user->has_my_opinion  = null;
            }
            unset($user->new_status_text);
            unset($user->new_image_url);
            unset($user->new_last_name);
            unset($user->new_first_name);
            unset($user->reset_code);
    
            
            $user->is_followed     = $this->followers->isFollowed($userId);
            $user->is_my_contact   = $this->contacts->isMyContact($userId);
            $user->has_my_contact  = $this->contacts->hasMyContact($userId);
            return $user;
            
        }

    Тыдыдыдыдыыыц, laravel code О_О
    Что же тут вообще происходит?

    lemax, 20 Апреля 2016

    Комментарии (10)
  8. Куча / Говнокод #19845

    −10

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (0) {
      unserialize ("");
      is_bool ("");
      is_array ("");
      is_string ("");
      is_integer ("");
      is_float ("");
    }

    github.com/vk-com/kphp-kdb/blob/master/KPHP/functions.txt

    d_fomenok, 19 Апреля 2016

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

    0

    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
    <script type="text/javascript">
            var currentLeveler = 0;
            var currentPrefix = 'povorot_';
            var currentPart = 0;
            var partsCount = [];
            var oldPart, oldLeveler;
            languagePrefix = "<?php echo $lang; ?>";
            partsCount[0] = 5;
            partsCount[1] = 4;
            partsCount[2] = 3;
    
            var levelersInfo = [[], [], []];
            var levelerParts = [[], [], []];
            var content = [];
    
            <?php
                while($row = mysql_fetch_array($tmp)){
                    $content[$row['block_id']] = $row['cont'];
                    echo "content[\"" .$row['block_id']. "\"] = '".$row['cont']."';\n";
                }
                for($j = 0; $j < 3; $j++)
                    for($i = 0; $i < 5; $i++){
    
                        $val1 = $content[$lang."_tech_leveler_info_".$j.$i];
                        $val2 = $content[$lang."_tech_part_info_".$j.$i];
                  
                        echo "levelersInfo[".$j."].push('".$val1."');";
                        echo "levelerParts[".$j."].push('".$val2."');";
                    }
            ?>
            $(document).ready(function () {
                $.each($(".changeable"), function () {
                    $(this).html(content[$(this).attr("id")]);
                });
            });
        </script>

    Формируем js код, через PHP на основе данных из базы данных... или в жопку аякс

    perryutkonos, 08 Апреля 2016

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

    +6

    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
    #ifdef _WIN32
    ...
    #elif defined __linux__
                std::string path;
                char buff[PATH_MAX];
                ssize_t len = ::readlink("/proc/self/exe", buff, sizeof(buff)-1);
                if (len != -1)
                {
                  buff[len] = '\0';
                  path = buff;
                }
                else
                {
                    return -1;
                }
    
                int pos = path.rfind("/");
                if (pos == std::string::npos)
                    return - 1;
    
                path = path.substr(0, pos + 1);
                path += "updater";
                std::string sys_path = path;
                boost::replace_all(sys_path, " ", "\\ ");
                std::string rm = "rm -f ";
                rm += sys_path;
                system(rm.c_str());
                _data.save_2_file(core::tools::from_utf8(path));
                std::string chmod = "chmod 755 ";
                chmod += sys_path;
                system(chmod.c_str());
                system(sys_path.c_str());
    #endif //_WIN32

    Как правильно обновлять #mailru/icqdesktop на Linux, если вы понимаете о чём я.

    gmmephisto, 31 Марта 2016

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

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public static bool AddStringIfNoExist(this List<string> strlist, string str)
    {
        if (str == "") return true;
        foreach (string s in strlist) if (s == str) return true;
        strlist.Add(str);
        return false;
    }

    Hashset? А что это такое?

    kerman, 29 Марта 2016

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