1. Java / Говнокод #10283

    +70

    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
    if(rightTable.isCellPresent(0, 0))
    					for(int i = 0; i < rightTable.getRowCount(); i++)
    						if(((CheckBox)((HorizontalPanel)rightTable.getWidget(i, 0)).getWidget(0)).getValue())
    						{	isChanged = true;
    							
    							leftTableList.add(currentTemplate.getColumns().get(i));
    							for(int j = 0; j < resultTable.getCellCount(0); j++)
    									if(((Label)((HorizontalPanel)resultTable.getWidget(0, j)).getWidget(1)).getText().compareTo(new Integer(currentTemplate.getColumns().get(i).getOrder()).toString()) == 0)
    										resultTable.removeCell(0, j);
    							
    							System.out.println(resultTable.getCellCount(0));
    							
    							rightTable.removeRow(i);
    							currentTemplate.getColumns().remove(i);
    							i--;
    						}

    sermolaev, 16 Мая 2012

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

    +78

    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
    private function isRussianCar($car){
    
                               # Определялка российских машин.
    
                                if ($car['make_id'] == '107') return true;
                                if ($car['make_id'] == '108') return true;
    		if ($car['make_id'] == '109') return true;
    		if ($car['make_id'] == '110') return true;
    		if ($car['make_id'] == '111') return true;
    		if ($car['make_id'] == '112') return true;
    		if ($car['make_id'] == '113') return true;
    		if ($car['make_id'] == '114') return true;
    		if ($car['make_id'] == '115') return true;
    		if ($car['make_id'] == '116') return true;
    		if ($car['make_id'] == '117') return true;
    		return false;
    	
        }

    Нашёл в одном из проектов

    daemon_master, 15 Мая 2012

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

    +71

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $template_archive_footer = stripslashes(get_option('poll_template_pollarchivefooter'));
    		$template_archive_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_TOTALVOTES%", number_format_i18n($polls_question['totalvotes']), $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_TOTALVOTERS%", number_format_i18n($polls_question['totalvoters']), $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_MOST_ANSWER%", $poll_most_answer, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_MOST_VOTES%", number_format_i18n($poll_most_votes), $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_MOST_PERCENTAGE%", $poll_most_percentage, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_LEAST_ANSWER%", $poll_least_answer, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_LEAST_VOTES%", number_format_i18n($poll_least_votes), $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_LEAST_PERCENTAGE%", $poll_least_percentage, $template_archive_footer);

    wp-polls. пиздец.

    TBoolean, 15 Мая 2012

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

    +62

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if($col == "#eeeeee"){
    $col = "#ffffff";
    }else{
    $col = "#eeeeee";
    }

    Нашел на просторах интернета скрипт, а в нем вот это. $col нигде не присваивается.

    mxst, 15 Мая 2012

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

    +58

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    if ($who == 'student') $answerArray['student_id'] = $this->people->id;
    if ($who == 'teacher') $answerArray['teacher_id'] = $this->people->id;
    if ($who == 'student') $answerArray['student_text'] = $post_array['message'];
    if ($who == 'teacher') $answerArray['teacher_text'] = $post_array['message'];
    if ($who == 'student') $answerArray['student_date'] = date('Y-m-d H:i:s');
    if ($who == 'teacher') $answerArray['teacher_date'] = date('Y-m-d H:i:s');
    if ($who == 'student' && $files) $answerArray['student_file'] = $files[0]['name'];
    if ($who == 'teacher' && $files) $answerArray['teacher_file'] = $files[0]['name'];
    if ($who == 'student' && $files) $answerArray['student_file_orig_name'] = $files[0]['orig_name'];
    if ($who == 'teacher' && $files) $answerArray['teacher_file_orig_name'] = $files[0]['orig_name'];
    if ($who == 'student') $answerArray['status'] = 0;
    if ($who == 'teacher') $answerArray['status'] = 1;

    Обнаружил в корпоративном коде. )

    MikleSmart, 15 Мая 2012

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

    +71

    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
    /**
     * Get the river's access where clause
     *
     * @return string
     * @since 1.8.0
     * @access private
     */
    function elgg_river_get_access_sql() {
    	// rewrite default access where clause to work with river table
    	return str_replace("and enabled='yes'", '',
    		str_replace('owner_guid', 'rv.subject_guid',
    		str_replace('access_id', 'rv.access_id', get_access_sql_suffix())));
    }

    Кусок из ядра фремворка Elgg, Sql запрос подправляется с помощью str_replace

    piromanlynx1, 15 Мая 2012

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

    +93

    1. 1
    if (indSpec == false || indZone == false || (FRof != null && FRof == 2)) result = 1;

    Нашли в проекте вот такое "женское" условие. Видимо, префиксом "ind" автор намекала на своё происхождение.

    DukeGonzo, 15 Мая 2012

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

    +105

    1. 1
    if (wasteClass != null && wasteClass == 5)

    Все же знают, что целочисленные переменные бывают равны null и 5 одновременно.

    DukeGonzo, 15 Мая 2012

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

    +116

    1. 1
    IsAutoUpdate ? 1.ToString() : 0.ToString()

    Практически классика.

    DukeGonzo, 15 Мая 2012

    Комментарии (23)
  10. Perl / Говнокод #10272

    −119

    1. 1
    my $end_date = ($request =~ /<end_date>(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)<\/end_date>/io) ? $1 : '';

    PSIAlt, 15 Мая 2012

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