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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <?php if( !Yii::app()->user->checkAccess('Manager')){ ?><td class="text-center"><?php  if($project->c1Projects->stat_id==23){
                    echo '|';
                    }elseif($project->c1Projects->stat_id==496){
                        echo '||';
                    }else{
                       echo  '-';
                    }
    
        ?></td><?php } ?>

    Вюха одного проекта

    Elenberg, 24 Февраля 2015

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    taras@host ~/host/sites/default $ drush phpsh-console
    php> var_dump(eval('array()'));
    bool(false)
    PHP Parse error:  syntax error, unexpected end of file in /usr/local/lib/python2.7/dist-packages/phpsh/phpsh.php(591) : eval()'d code(1) : eval()'d code on line 1

    О мой мозг...! А Python здесь причем?

    kissarat, 24 Февраля 2015

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

    +161

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    there is a reason why opencart is the no.1 most used ecommerce solution in places like china and india, its the easiest code base to understand!
    
    --
    
    many apps servers! what does that mean? you mean different applications running from the same framework?
    you build each application starting from the index.php file and include what ever library classes you require.
    
    --
    
    "I agree with you that it's harder to write simple code, because REPEATING CODE IS HARD TO DEBUG HARD TO READ AND TO CORRECT. so it makes you waste a lot of time."
    
    this is what search and replace is for!

    Создатель опенкарта (Daniel Kerr) исходит на говно, много мякотки
    http://www.techchattr.com/never-use-opencart#comment-1151857248

    Fike, 22 Февраля 2015

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

    +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
    foreach (scandir(DIR.'app'.SLASH.'lib') as $filename) {
        $path = DIR.'app'.SLASH.'lib'.SLASH.$filename;
        if (is_file($path) && substr($filename,strlen($filename)-4,4)=='.php') {
            require_once($path);
        }
    }
    foreach (scandir(DIR.'app'.SLASH.'models') as $filename) {
        $path = DIR.'app'.SLASH.'models'.SLASH.$filename;
        if (is_file($path) && substr($filename,strlen($filename)-4,4)=='.php') {
            require_once($path);
        }
    }
    foreach (scandir(DIR.'app'.SLASH.'ext') as $filename) {
        $path = DIR.'app'.SLASH.'ext'.SLASH.$filename;
        if (is_file($path) && substr($filename,strlen($filename)-4,4)=='.php') {
            require_once($path);
        }
    }

    Начался разбор проблемы со слов заказчика - "сайт долго грузится"

    Crawdaunt, 22 Февраля 2015

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function getMinQueueOrdering()
      {
        $sql="SELECT MAX(ordering)
              FROM priceloaddata_queue";
      .........
      }

    нет слов.

    Vasiliy, 19 Февраля 2015

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

    +168

    1. 1
    define("OUTPUT_DIR_CSV", "kokoko/kukarek/files" . DIRECTORY_SEPARATOR);

    Stallman, 19 Февраля 2015

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

    +161

    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
    public function set_debug($fparam) {
         $this->set_debug_mode($fparam);
    }
    
    protected function set_debug_mode($fparam) {
          $this->set_localization_debug_mode($fparam);
    }
    
    private function set_localization_debug_mode($fparam) {
          $this->set_localization_debug_mode_log_service($fparam);
    }
    
    private function set_localization_debug_mode_log_service($fparam) {
          $conf = //...тут уже что-то делает, наконец-то
    }

    Я понимаю, если бы они просто были алиасами... Но почему protected/private?

    Lowezar, 18 Февраля 2015

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

    +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
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    if ($sub_sub_sub_sub_category_id !== null) {
    
    													if ($this->core->countUrl > 5) {
    														header('Location: /404/');
    													}
    
    													foreach ($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id] as $k1 => $v1) {
    														if ($k1 !== 0) {
    															foreach ($v1 as $k2 => $v2) {
    																if ($k2 !== 0) {
    																	if ($this->core->translit($v2[0]) == $sub_sub_sub_category) {
    																		$sub_sub_sub_sub_sub_category_id = $k1;
    																		$sub_sub_sub_sub_sub_sub_category_id = $k2;
    																		break;
    																	}
    																}
    															}
    														}
    													}
    
    													$this->core->title($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_sub_category_id][0]);
    													$bread_crumbs[] = array(
    														'text' => $categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_sub_category_id][0],
    														'url' => $location['alias'] . '/' . $this->core->translit($categories[$category_id][0]) . '/' . $this->core->translit($categories[$category_id][$sub_category_id][$sub_sub_category_id][0]) . '/' . $this->core->translit($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][0]) . '/' . $this->core->translit($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_sub_category_id][0])
    													);
    
    													$query_add = "
    														AND (`market_item`.`category_key` = '" . $category_id . "')
    														AND  `market_item`.`param` REGEXP '(\&quot;" . $sub_sub_sub_sub_category_id . "\&quot;)'
    													";
    													
    													$vip_query_add = "
    														AND `market_item`.`category_key` = '" . $category_id . "'
    													";
    
    												}

    qualitycode, 16 Февраля 2015

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

    +158

    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
    if ( !defined ('BX_SKIP_INSTALL_CHECK') && file_exists( $dir['root'] . 'install' ) ) {
        $ret = <<<EOJ
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
    <head>
        <title>Dolphin Installed</title>
        <link href="{$site['url']}install/general.css" rel="stylesheet" type="text/css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body class="bx-def-font">
        <div class="adm-header">
            <div class="adm-header-content">
                <div class="adm-header-title bx-def-margin-sec-left">
                    <img class="adm-header-logo" src="{$site['url']}administration/templates/base/images/logo.png" />
                    <div class="adm-header-text bx-def-font-h1">Dolphin {$site['ver']}</div>
                    <div class="clear_both">&nbsp;</div>
                </div>
                <div class="clear_both">&nbsp;</div>
            </div>
        </div>
        <div id="bx-install-main" class="bx-def-border bx-def-round-corners bx-def-margin-top">
            <div id="bx-install-content" class="bx-def-padding">
                <div class="bx-install-header-caption bx-def-font-h1 bx-def-margin-bottom">
                    Well done, mate! Dolphin is now installed.
                </div>
                <div class="bx-install-header-text bx-def-font-large bx-def-font-grayed">
                    Remove directory called <b>"install"</b> from your server and <a href="{$site['url']}administration/modules.php">proceed to Admin Panel to install modules</a>.
                </div>
            </div>
        </div>
    </body>
    </html>
    EOJ;
        echo $ret;
        exit();
    }

    Какой веселый вывод HTML (Dolphin 7)

    jey-val-star, 15 Февраля 2015

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

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <?php
    namespace MultipleHashMapQueueMessageRetrieverCriterias\Domain\MultipleHashMapQueueMessageRetrieverCriterias\Adapters\Exceptions;
    use MultipleHashMapQueueMessageRetrieverCriterias\Domain\Exceptions\MultipleHashMapQueueMessageRetrieverCriteriaException;
    
    final class CannotConvertMultipleHashMapQueueMessageRetrieverCriteriaToMultipleQueueMessageRetrieverCriteriaException extends MultipleHashMapQueueMessageRetrieverCriteriaException {
        const CODE = 1;
        public function __construct($message, MultipleHashMapQueueMessageRetrieverCriteriaException $parentException = null) {
            parent::__construct($message, self::CODE, $parentException);
        }
    }

    http://www.reddit.com/r/lolphp/comments/2vrgr6/irestfulmultiplehashmapqueuemessageretri evercriter/
    https://github.com/irestful/MultipleHashMapQueueMessageRetrieverCrit erias/blob/master/MultipleHashMapQueueMessageRetrieverCrit erias/Domain/MultipleHashMapQueueMessageRetrieverCrit erias/Adapters/Exceptions/CannotConvertMultipleHashMapQueueMessage RetrieverCriteriaToMultipleQueueMessageR etrieverCriteriaException.php

    Алсо, обратите внимание на структуру гитхабовских репозиториев

    myaut, 15 Февраля 2015

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