1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. C# / Говнокод #10277

    +93

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

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

    DukeGonzo, 15 Мая 2012

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

    +105

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

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

    DukeGonzo, 15 Мая 2012

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

    +116

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

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

    DukeGonzo, 15 Мая 2012

    Комментарии (23)
  8. 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)
  9. ActionScript / Говнокод #10271

    −165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    /**
         * This is a really fast way to check for NaN; see the spec of NaN
         * on why this works; this check can yield false only for a Number
         * since it's the only one capable of having NaN as a value.
         */
        if (d != d) {
         throw new Error("value can't be NaN!");
        }

    kyzi007, 15 Мая 2012

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

    +141

    1. 1
    2. 2
    string Signal = Console.ReadLine();
    Console.WriteLine(Convert.ToString(bool.Parse(Signal))); //НУ НАХУЯ?!?!?

    Для непонятных: Автор говна создает переменную типа string и записывает туда введенную в консоли строку, после он нехилым образом вызывает метод Parse который из string переводит в bool, а потом этот поносопроггер переконвертирует полученную переменную типа bool в переменную типа string. Ну нахуя спрашивается????

    KusokGovna, 15 Мая 2012

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