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

    +3

    1. 1
    2. 2
    $arParams["SET_TITLE"] = $arParams["SET_TITLE"]!="N";
    $arParams["SET_LAST_MODIFIED"] = $arParams["SET_LAST_MODIFIED"]==="Y";

    news.detail - cтандартный компонент Битрикса

    pgood, 27 Июля 2016

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

    +1

    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
    static function saveoprosform_ajax()
    {
        global $DB, $USER;
        $task_id = $_REQUEST["task_id"];
        $qlist = $_REQUEST["qlist"];
    
        $sql = "DELETE FROM `tickets_qc_results` WHERE `task_id`=" . $DB->F($task_id) . ";";
        $DB->query($sql);
        $DB->free();
    
        if ($task_id && $qlist) {
            // другой говнокод
            $sql = "INSERT INTO `tickets_qc_results`...';
            $DB->query($sql);
        } else {
            $ret["error"] = "Недостаточно данных для выполнения операции!";
        }
        echo json_encode($ret);
        return false;
    }

    Сначала удаляем, потом проверяем by ©senior shaurma developer

    pahhan, 27 Июля 2016

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

    0

    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
    /**
         * Sets the user in the token.
         *
         * The user can be a UserInterface instance, or an object implementing
         * a __toString method or the username as a regular string.
         *
         * @param string|object $user The user
         *
         * @throws \InvalidArgumentException
         */
        public function setUser($user)
        {
            if (!($user instanceof UserInterface || (is_object($user) && method_exists($user, '__toString')) || is_string($user))) {
                throw new \InvalidArgumentException('$user must be an instanceof UserInterface, an object implementing a __toString method, or a primitive string.');
            }
            if (null === $this->user) {
                $changed = false;
            } elseif ($this->user instanceof UserInterface) {
                if (!$user instanceof UserInterface) {
                    $changed = true;
                } else {
                    $changed = $this->hasUserChanged($user);
                }
            } elseif ($user instanceof UserInterface) {
                $changed = true;
            } else {
                $changed = (string) $this->user !== (string) $user;
            }
            if ($changed) {
                $this->setAuthenticated(false);
            }
            $this->user = $user;
        }

    https://github.com/symfony/security-core/blob/master/Authentication/Token/AbstractToken.php#L93

    craaazy19, 26 Июля 2016

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

    +5

    1. 1
    2. 2
    3. 3
    4. 4
    function is_assoc( $array ) {
    
    	return is_array($array) && substr( json_encode($array), 0, 1 ) == '{';
    }

    bot, 26 Июля 2016

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

    −4

    1. 1
    Можно, я похерю Вам настроение?

    Можно, я похерю Вам настроение?

    CRITICAL_ERROR, 25 Июля 2016

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

    +7

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function redirect($url)
    {
    	header('Location:'.$url);
    	echo '<script>document.location.href = \''.$url.'\';</script>';
    	exit;
    }

    eskrano, 24 Июля 2016

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

    +7

    1. 1
    github.com/natribu/natribu.org

    Исходники официального сайта нахуй, жесть

    dm_fomenok, 22 Июля 2016

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

    0

    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
    function CheckPropertyForSend(&$fields) {
        if ($fields["IBLOCK_ID"] == CATALOG_ID) {
            $arFilter = array("IBLOCK_ID" =>CATALOG_ID, "ID"=>$fields["ID"], "PROPERTY_NOT_ALLOWED" =>92);
            $res = CIBlockElement::GetList(Array(), $arFilter);
    
            if($res->SelectedRowsCount() == 1){
                $GLOBALS['NEED_CHECK'] = true;
            }else{
                $GLOBALS['NEED_CHECK'] = false;
            }
    
            $prod = LenalHelp::getProductInfo($fields["ID"]);
            $count = 0;
            $cheked = ( $fields["PROPERTY_VALUES"][580][0]["VALUE"] == 92 ) ? true : false;
            foreach ( $prod["STORES"] as $item ) {
                if ( $item["PRODUCT_AMOUNT"] ) {
                    $count += $item["PRODUCT_AMOUNT"];
                }
            }
    
            // -- убираем фдаг "нет в наличии" ---
            if ( $count > 0 && $cheked ) {
                $fields["PROPERTY_VALUES"][580] = "";
            }
            // -- устанавливаем фдаг "нет в наличии" ---
            if ( $count == 0 && !$cheked ) {
                $fields["PROPERTY_VALUES"][580][0]["VALUE"] = 92;
            }
    
        }
    }

    Платформа Битрикс, Lenal гребанные ублюдки

    lscin, 22 Июля 2016

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

    +2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    <?if( $arResult['PROPERTIES']['NOT_ALLOWED']['VALUE'] == 'да' || $arItem["PROPERTIES"]["NOT_ALLOWED"]["VALUE_XML_ID"] == "Y" ) { ?>
    				<div class="alert-empty alert--licence">
    					<?$APPLICATION->IncludeComponent(
    						"bitrix:main.include",
    						"",
    						Array(
    							"AREA_FILE_SHOW" => "file",
    							"PATH" => SITE_DIR."/inc/card_not_allowed.php",
    							"EDIT_TEMPLATE" => ""
    						)
    					);?>

    Платформа Битрикс, очередное творение Lenal в шаблоне компонента.

    Сравнение значения с КИРИЛИЦЕЙ в template.php.

    lscin, 22 Июля 2016

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

    −3

    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
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    <?php
    
    if(!class_exists('avia_breadcrumb'))
    {
    	class avia_breadcrumb
    	{
    		var $options;
    
    	function __construct($options = ""){
    
    		$this->options = array( 	//change this array if you want another output scheme
    		'before' => '<span class="arrow"> ',
    		'after' => ' </span>',
    		'delimiter' => '&raquo;'
    		);
    
    		if(is_array($options))
    		{
    			$this->options = array_merge($this->options, $options);
    		}
    
    
    		$markup = $this->options['before'].$this->options['delimiter'].$this->options['after'];
    
    		global $post;
    		echo '<p class="breadcrumb"><span class="breadcrumb_info">'.__('You are here:','avia_framework').'</span> <a href="'.get_bloginfo('url').'">';
    			bloginfo('name');
    			echo "</a>";
    			if(!is_front_page()){echo $markup;}
    
    			$output = $this->simple_breadcrumb_case($post);
    
    			echo "<span class='current_crumb'>";
    			if ( is_page() || is_single()) {
    			the_title();
    			}else{
    			echo $output;
    			}
    			echo " </span></p>";
    		}
    
    		function simple_breadcrumb_case($der_post)
    		{
    			global $post;
    
    			$markup = $this->options['before'].$this->options['delimiter'].$this->options['after'];
    			if (is_page()){
    				 if($der_post->post_parent) {
    					 $my_query = get_post($der_post->post_parent);
    					 $this->simple_breadcrumb_case($my_query);
    					 $link = '<a href="';
    					 $link .= get_permalink($my_query->ID);
    					 $link .= '">';
    					 $link .= ''. get_the_title($my_query->ID) . '</a>'. $markup;
    					 echo $link;
    				  }
    			return;
    			}
    
    		if(is_single())
    		{
    			$category = get_the_category();
    			if (is_attachment()){
    
    				$my_query = get_post($der_post->post_parent);
    				$category = get_the_category($my_query->ID);
    
    				if(isset($category[0]))
    				{
    					$ID = $category[0]->cat_ID;
    					$parents = get_category_parents($ID, TRUE, $markup, FALSE );
    					if(!is_object($parents)) echo $parents;
    					previous_post_link("%link $markup");
    				}
    
    			}else{
    
    				$postType = get_post_type();
    
    				if($postType == 'post')
    				{
    					$ID = $category[0]->cat_ID;
    					echo get_category_parents($ID, TRUE, $markup, FALSE );
    				}
    				else if($postType == 'portfolio')
    				{
    					$terms = get_the_term_list( $post->ID, 'portfolio_entries', '', '$$$', '' );
    					$terms = explode('$$$',$terms);
    					echo $terms[0].$markup;
    
    				}
    			}
    		return;
    		}

    Собственно вся суть, 2а раза генерируются, смотрел в функшин где написан код, все чисто, но все равно 2а раза генерируется

    Получается грубо говоря:

    You here: Home / <b>Hello world</b> / %category% / <b>Hello world</b>

    Не могли бы помочь. Или куда смотреть, был бы благодарен.

    olee444, 21 Июля 2016

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