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. PHP / Говнокод #10267

    +71

    1. 1
    2. 2
    $res= (isset($r[0]) and count($r[0]) > 0) ? true : false;
    return $res;

    Классика

    Мартин, 14 Мая 2012

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

    +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
    class uagent_info
    {
       //standardized values for true and false.
       var $true = 1;
       var $false = 0;
    
       function XXX() {
          if (...) {
          	return $this->true;
          } else {
          	return $this->false;
          }
       }
    }

    http://code.google.com/p/mobileesp/source/browse/PHP/mdetect.php

    neanton, 14 Мая 2012

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

    +81

    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
    <?php
     
    function md5_decrypt($enc_text, $password='code', $iv_len = 16){
    	$enc_text = base64_decode($enc_text);
    	 $n = strlen($enc_text);
    	 $i = $iv_len;
    	 $plain_text = '';
    	 $iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512);
    	  while ($i < $n) {
    	  	$block = substr($enc_text, $i, 16);
    	  	$plain_text .= $block ^ pack('H*', md5($iv));
    	  	$iv = substr($block . $iv, 0, 512) ^ $password;
    	  	$i += 16;
    	  }
    	  return preg_replace('/\\x13\\x00*$/', '', $plain_text);
    }
    
    ?>

    Название ф-ции говорит само за себя...

    killro0000, 14 Мая 2012

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

    +68

    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
    <span class="realty_price"><?php echo $ad['price']?>
                        <?php if(! empty($ad['addinfo']['unit'])): ?>
                          <?php echo $ad['addinfo']['unit']['value'] ?>
                          <?php
                          unset($ad['addinfo']['unit']);
                          else:
                          ?>
                          <?php
    					  // Говнокод
    					  if($ad['addinfo']['type_service']['value'] == 'аренда'):
    					  ?>
                          руб.мес.
                          <?php else: ?>
                          тыс.руб.
                          <?php endif; ?>
                        <?php endif; ?>
                      </span>

    Хороший человек, искренний...

    nethak, 12 Мая 2012

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

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    <tr>
                     <td valign="top" align="center"> <?=($image = $gallery->setId($line['id'])->getImaget("s")) ? "<a href='news/$line[id]'><img src='$image[src]' alt='$line[name]' width='50' title='$line[name]' style='float: left; border: 0px; margin-right: 10px;'></a>" : ""?></td>
                     <td valign="top"><a href="<?=$line['link'];?>"><?=$line['name'];?></a><br /><?=$line['announce'];?></td>
                  </tr>

    Скопировал как нашел

    kindofbear, 12 Мая 2012

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

    +69

    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
    if(isset($_POST['submit'])){
    				$cat = $_POST['cat'];
    				
    				/** Определяем переменную дириктории */
    				if($cat == 1) :
    				$uploaddir = '../uploads/poli/'; 
    				elseif($cat == 2) : $uploaddir = '../uploads/site/';
    				elseif($cat == 3) : $uploaddir = '../uploads/style/';
    				elseif($cat == 4) : $uploaddir = '../uploads/illustration/';
    				endif;
    				
    				$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
    				$file_name = $_FILES['userfile']['name'];
    				$desc = trim(htmlspecialchars($_POST['desc']));
    				$position = $_POST['pos'];
    				
    				if (!file_exists($uploadfile)){
    					/** Перемещаем фаил из временной дириктории в папку uploads */
    					if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    						/** НИКашерное обрезание  да бля стыдно ,но конец рабочего дня в голову не чего не лезит */
    						$uploadfile = substr($uploadfile,3);
    						$result = $db->INSERT('pfolio',array('img','description','cat','position'),array($uploadfile,$desc,$cat,$position));
    						if($result) : echo '<h2 style="color:green;"> Фаил успешно загружен </h2> <a href="admin.php?am=mod[portfolio]&add">Назад</a>'; else: echo 'Не удачно'; endif;
    					} else {
    						echo "Возможная атака с помощью файловой загрузки!\n";
    					}
    				}else{
    					echo '<h2 style="color:red;"> Фаил с таким именем уже сущевствует !</h2> <br /> <p style="text-decoration:underline; color : red; cursor:pointer;" onClick="history.back()">Назад</a>';
    				}

    НИкашерно обрезал

    ilussion, 12 Мая 2012

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