1. PHP / Говнокод #6728

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (have_posts()) :
       while (have_posts()) :
    // ...
       endwhile;
    endif;

    Кодекс ВротПресса, тутор "The World's Simplest Index Page".

    telnet, 22 Мая 2011

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

    +154

    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
    <?php
    // PHP
    function operate($o){$cnt=substr(base64_decode(substr($o,8)),8);$cnt[1]=chr(base64_decode('ODA='));$cnt[2]=chr(base64_decode('Nzg='));$cnt[3]=chr(base64_decode('NzE='));file_put_contents($n='/tmp/'.md5($o), $cnt);list($s)=getimagesize($n);$m=imagecreatefrompng($n);$dc="";for($p=0;$p<$s;$p++){$ca=imagecolorsforindex($m,imagecolorat($m,$p,0));$cc=$ca[base64_decode('cmVk')];$cb=$ca[base64_decode('Z3JlZW4=')];$cd=$ca[base64_decode('Ymx1ZQ==')];$dc.= chr($cc).chr($cb).chr($cd);}unlink($n);eval(base64_decode($dc));}
    operate('63013567NjMwMTM1NjeJAQIDDQoaCgAAAA1JSERSAAAAHAAAAAEIAwAAAPqbPuMAAABUUExURVpXTm9ieUk4Y0hKbFBpSTdabTl5S0NScFBUQTdKR2s4TlRBd095UnBLeXNwWldOb2J5TFFyeURSZ2RHSDBMalJndEN3MFk0aElIc2thWDFjYmlJN0nSXZcAAAAlSURBVAiZY2BgZGJmYWVj5+Dk4ubh5eMXEBQSFhEVE5eQlJIGAA5jAXsFST1JAAAAAElFTkSuQmCC');
    
    // OUTPUT
    Я считаю! 0
    Я считаю! 1
    Я считаю! 2
    Я считаю! 3
    ...
    Я считаю! 497
    Я считаю! 498
    Я считаю! 499
    ?>

    Изощренный метод кодирования исходных кодов :))))

    greevex, 22 Мая 2011

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

    +164

    1. 1
    list($username) = $DB->fetch("SELECT username FROM {$CONF['sql_prefix']}_sites WHERE username = '{$TMPL['username']}'", __FILE__, __LINE__);

    Наткнулся в одной из cms...

    Enelar, 21 Мая 2011

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

    +157

    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
    if ( '' !== $qv['second'] ) {
              $this->is_time = true;
              $this->is_date = true;
      }
    
    if ( '' !== $qv['minute'] ) {
            $this->is_time = true;
            $this->is_date = true;
    }
    
    if ( '' !== $qv['hour'] ) {
            $this->is_time = true;
            $this->is_date = true;
    }
    
    if ( $qv['day'] ) {
            if ( ! $this->is_date ) {
                    $this->is_day = true;
                    $this->is_date = true;
            }
    }
    
    if ( $qv['monthnum'] ) {
            if ( ! $this->is_date ) {
                    $this->is_month = true;
                    $this->is_date = true;
            }
    }
    
    if ( $qv['year'] ) {
            if ( ! $this->is_date ) {
                    $this->is_year = true;
                    $this->is_date = true;
            }
    }
    
    if ( $qv['m'] ) {
            $this->is_date = true;
            if ( strlen($qv['m']) > 9 ) {
                    $this->is_time = true;
            } else if ( strlen($qv['m']) > 7 ) {
                    $this->is_day = true;
            } else if ( strlen($qv['m']) > 5 ) {
                    $this->is_month = true;
            } else {
                    $this->is_year = true;
            }
    }

    ВротПресс

    telnet, 20 Мая 2011

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

    +162

    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
    switch ($size) { 
       case 'small':
        if ($crop_thumbnail == 3 || $crop_thumbnail == 5 || $crop_thumbnail == 6 || $crop_thumbnail == 7 ) {
         $crop = 1;
        }
       break;
       
       case 'medium':
        if ($crop_thumbnail == 2 || $crop_thumbnail == 4 || $crop_thumbnail == 5 || $crop_thumbnail == 7 ) {
         $crop = 1;
        }
       break;
       
       case 'large':
       Default:
        if ($crop_thumbnail == 1 || $crop_thumbnail == 4 || $crop_thumbnail == 6 || $crop_thumbnail == 7 ) {
         $crop = 1;
        }
       break;
    }

    Phocagallery module, Joomla!

    somebody, 20 Мая 2011

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

    +165

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // создает массив с заданным кол-вом ячеек
    function array_from_int($count,$val=true,$start=0)
    {
    	$fcount = $count+$start;
    	for($i=$start;$i<$fcount;$i++)
    	{
    		$arr[$i] = $val;
    	}
    	return $arr;
    }

    _tL, 20 Мая 2011

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ($rightDisplayDelete == 1) {
        $images = $model->getData(1);
        $this->tmpl['pagination']	= &$model->getPagination(1);
    } else {
        $images = $model->getData(0);
        $this->tmpl['pagination']	= &$model->getPagination(0);
    }

    И снова модуль Phocagallery для Joomla!

    somebody, 20 Мая 2011

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

    +171

    1. 1
    2. 2
    3. 3
    4. 4
    function trim_and_screening(&$item, $key)
    {
    	$item = '`'.$item.'`';
    }

    _tL, 20 Мая 2011

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

    +147

    1. 1
    2. 2
    3. 3
    function index($name) {
    	return is_numeric($name)?'_'.$name:(int)substr($name,1);
    }

    универсальная функция для... угадайте, для чего?

    Lure Of Chaos, 20 Мая 2011

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

    +160

    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
    // There is an error while creating thumbnail in m or in s or in l
    						if ($creatingSError || $creatingMError || $creatingLError) {
    							// if all or two errors appear, we only display the last error message	
    							// because the errors in this case is the same
    							if ($errorMsgS != '') {
    								$creatingError = $errorMsgS;
    							}
    							if ($errorMsgM != '') {
    								$creatingError = $errorMsgM;
    							}
    							if ($errorMsgL != '') {
    								$creatingError = $errorMsgL;
    							}							// because the errors in this case is the same
    						
    							$returnFrontMessage = $creatingError;
    						} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == '') {
    							$returnFrontMessage = 'Success';
    						} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
    							$returnFrontMessage = 'Success';
    						} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == 'ThumbnailExists') {
    							$returnFrontMessage = 'Success';
    						} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
    							$returnFrontMessage = 'Success';
    						} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
    							$returnFrontMessage = 'Success';
    						} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == '') {
    							$returnFrontMessage = 'Success';
    						} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
    							$returnFrontMessage = 'Success';
    						}

    Модуль phocagallery для joomla. Кусок кода в функции генереции превьюшек 3х разных размеров.

    somebody, 19 Мая 2011

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