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

    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
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    header.php
    
     <?$APPLICATION->IncludeComponent(
                    "lenal:lenal.menu",
                    "mobile",
                    array(
                        "VIEW_MODE" => "LINE",
                        "SHOW_PARENT_NAME" => "Y",
                        "IBLOCK_TYPE" => "catalog",
                        "IBLOCK_ID" => "39",
                        "SECTION_ID" => $_REQUEST["SECTION_ID"],
                        "SECTION_CODE" => "",
    
    ..................................................
    
    
    component.php
    
    if(!isset($arParams["CACHE_TIME"]))
    	$arParams["CACHE_TIME"] = 36000000;
    
    if($this->StartResultCache(false, ($arParams["CACHE_GROUPS"]==="N"? false: $USER->GetGroups())))
    {
    	/*
    	 * Lenal вы гребаные идиоты, у вас в параметрах стоит  "SECTION_ID" => $_REQUEST["SECTION_ID"] и
    	 * единственным условием у вас сброса кеша ("CACHE_TIME" => "36000000"!!!!!! бля)
    	 * ВОТ ЭТО?! Отсутствие модуля iblock ?!? 
    	 * Чтоб вы всю жизнь на жевачку работали, придурки!
    	 * 
    	 * 100 000 файлов кеша на ОДНО МЕНЮ ОДНОГО САЙТА! 
    	 * 
    	 * Дегенераты.
    	 * 
    	 */ 
    	if(!\Bitrix\Main\Loader::includeModule("iblock"))
    	{
    		$this->AbortResultCache();
    		ShowError(GetMessage("IBLOCK_MODULE_NOT_INSTALLED"));
    		return;
    	}
    /*********************

    Компонент меню на публичной части от компании Lenal (платформа 1С-Битрикс)

    lscin, 04 Июля 2016

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

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    public function payredirectAction() {
    		// Здесь еще какие-то манипуляции с $url
    		// и отключение view
    		echo "<script>window.location.href='" . $url . "';</script>";
    
    	}

    Индусский редирект
    Код на Zend_Framework 1.12

    jbot, 01 Июля 2016

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

    +6

    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
    $query_list_builder = array(
    	'1000' => " and account = $account_id and creator = $creator_id",
    	'0100' => " and account = $account_id and salepoint = $salepoint_id and creator <> $creator_id ",
    	'0010' => " and account = $account_id and creator <> $creator_id and salepoint <> $salepoint_id ",
    	'0001' => " and account IN ($watchlist) and creator <> $creator_id and salepoint <> $salepoint_id and account <> $account_id ",
    
    	'1100' => " and salepoint = $salepoint_id or creator = $creator_id and account = $account_id ",
    	'1010' => " and account = $account_id and salepoint <> $salepoint_id or creator = $creator_id ",
    	'1001' => " and account IN ($watchlist) and account <> $account_id or creator = $creator_id ",
    
    	'1110' => " and account = $account_id or creator = $creator_id and salepoint = $salepoint_id ",
    	'1101' => " and account IN ($watchlist) and account <> $account_id or creator = $creator_id or salepoint = $salepoint_id ",
    
    	'1111' => " and account IN ($watchlist) or account = $account_id or creator = $creator_id or salepoint = $salepoint_id ",
    	'0000' => " and creator <> $creator_id and salepoint <> $salepoint_id and account NOT IN ($watchlist) ",
    
    	'0011' => " and account IN ($watchlist) and salepoint <> $salepoint_id and creator <> $creator_id ",
    	'0111' => " and account IN ($watchlist) and creator <> $creator_id ",
    	'0110' => " and account = $account_id and creator <> $creator_id ",
    	'0101' => " and account IN ($watchlist) and account <> $account_id or salepoint = $salepoint_id and creator <> $creator_id ",
    	'1011' => " and account IN ($watchlist) and salepoint <> $salepoint_id or creator = $creator_id ",
    );

    daniser, 30 Июня 2016

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $do_while = DateTime::createFromFormat('d.m.Y H:i:s', $rowRequest['start_date'].":00");
    $do_while = $do_while->format('U');
    $do_while +=0;
    list($hour , $minute ) = explode(":", "24:00");$hour +=0;$minute +=0;
    $do_while +=($hour*3600 + $minute*60);
    $time = date('d.m.Y H:i',$do_while);

    Lesha, 30 Июня 2016

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $string_of_query = "select * from gisgmp.f_gisgmp_bills" . $tableName . "8mod(null, 1, UnknownValidUntil);
    if ($ValidUntil == null)
        $string_of_query = str_replace("UnknownValidUntil", "null", $string_of_query);
    else
        $string_of_query = str_replace("UnknownValidUntil", "'$ValidUntil'", $string_of_query);

    Lesha, 30 Июня 2016

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

    +2

    1. 1
    $this->a[$this->c[$this->m]] = my_substr($this->t, $prev[2], ($v[0] - $prev[2]));

    Кусочек кустарного говношаблонизатора.
    Без комментариев. В обоих смыслах.

    daniser, 30 Июня 2016

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

    +6

    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
    switch ($m->type) {
    			case 'photo':
    				echo sprintf('<div class="fb_photo %s"><a %s href="%s"><div style="background-image: url(\'%s\');"><b>%s</b><br>%s%s<div class="status">%s <img src="%s" /> %s <img src="%s" /></div></div></div>', ($showProfilePic ? 'padding65' : ''), (isset($_GET['nonavbar']) ? 'target="_top"' : 'target="_blank"'), $m->link . (isset($_GET['nonavbar']) ? '&openwithnavigation=1' : ''), str_replace("_s", "_n", $m->picture), $m->from->name, (!empty($m->message) ? $m->message.'<br>' : ''), ago($m->created_time, $timezone), isset($m->likes) && isset($m->likes->count) ? $m->likes->count : '', isset($m->likes)  && isset($m->likes->count) ? buildUri('images/icons/like.png') : '', isset($m->comments) && isset($m->comments->count) ? $m->comments->count : '', isset($m->comments) && isset($m->comments->count) ? buildUri('images/icons/comment.png') : '');
    				break;
    			case 'video':
    			case 'link':
    				echo sprintf('<div class="fb_link %s"><a %s href="%s"><div style="width: 100%%; padding: 30px;  box-sizing: border-box;border-bottom:1px solid #ccc;border-top:1px solid #ccc;"><img style="max-width: none; width:100px;" src="%s" /><div style="width: 100%%"><b>%s</b><br>%s</div></div><div style="position:absolute; right: 10px; bottom: 10px;" class="status">%s <img style="display: inline-block" src="%s" /> %s <img style="display: inline-block" src="%s" /></div></a></div>', ($showProfilePic ? 'padding65' : ''), (isset($_GET['nonavbar']) ? 'target="_top"' : 'target="_blank"'), $m->link . (isset($_GET['nonavbar']) ? '&openwithnavigation=1' : ''), $m->picture, $m->name, $m->message, ago($m->created_time, $timezone), isset($m->likes) && isset($m->likes->count) ? $m->likes->count : '', isset($m->likes) && isset($m->likes->count) ? buildUri('images/icons/like.png') : '', isset($m->comments) && isset($m->comments->count) ? $m->comments->count : '', isset($m->comments) && isset($m->comments->count) ? buildUri('images/icons/comment.png') : '');
    				//echo sprintf('<div class="fb_link"><a href="%s"><div><img src="%s" /><b>%s</b><br>%s<div class="status">%s likes, %s comments</div></div></div></div>', $m->link, str_replace("_s", "_n", $m->picture), $m->from->name, $m->message, $m->likes->count, $m->comments->count);
    				break;
    			case 'status':
    				echo sprintf('<div class="fb_link %s"><a %s href="%s"><div style="width: 100%%; padding: 30px;  box-sizing: border-box;border-bottom:1px solid #ccc;border-top:1px solid #ccc;"><img style="max-width: none; width:100px;" src="%s" /><div style="width: 100%%"><b>%s</b><br>%s</div></div><div style="position:absolute; right: 10px; bottom: 10px;" class="status">%s <img style="display: inline-block" src="%s" /> %s <img style="display: inline-block" src="%s" /></div></a></div>', ($showProfilePic ? 'padding65' : ''), '', '', $m->picture, $m->name, $m->message, ago($m->created_time, $timezone), isset($m->likes) && isset($m->likes->count) ? $m->likes->count : '', isset($m->likes)  && isset($m->likes->count) ? buildUri('images/icons/like.png') : '', isset($m->comments) && isset($m->comments->count) ? $m->comments->count : '', isset($m->comments) && isset($m->comments->count) ? buildUri('images/icons/comment.png') : '');
    				break;
    			default:
    				//echo 'TODO: ' . $m->type;
    				//var_dump($m);
    				break;
    		}

    Верстка.
    Уровень - бог.

    valentinlazy, 27 Июня 2016

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

    +3

    1. 1
    session_decode(session_encode());

    что это вообще такое и зачем оно?

    kropotor, 27 Июня 2016

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

    −2

    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
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    <div class='min_content'>
    <?php
    $query_search = '`janr` LIKE "%'.$tip.'%" AND `xarakter_filma` LIKE "%'.$xar.'%" AND `detail_janr` LIKE "%'.$det.'%"';
      $num = 12;
    // Извлекаем из URL текущую страницу
        $page = (int)$_GET['page'];               
    // Определяем общее число сообщений в базе данных
    $count = "SELECT COUNT(*) FROM kino WHERE $query_search";
    $ardyunq = $db->query($count);
    $temp = $ardyunq->fetch(PDO::FETCH_NUM);;
    If ($temp[0] > 0)
    {  
    $tempcount = $temp[0];
    // Находим общее число страниц
    $total = (($tempcount - 1) / $num) + 1;
    $total =  intval($total);
    // Определяем начало сообщений для текущей страницы
    $page = intval($page);
    // Если значение $page меньше единицы или отрицательно
    // переходим на первую страницу
    // А если слишком большое, то переходим на последнюю
    if(empty($page) or $page < 0) $page = 1;
      if($page > $total) $page = $total;  
    // Вычисляем начиная с какого номера
    // следует выводить сообщения
    $start = $page * $num - $num;
    // Выбираем $num сообщений начиная с номера $start
    $qury_start_num = " LIMIT $start, $num"; 
    }  
        $query_search = '`janr` LIKE "%'.$tip.'%" AND `xarakter_filma` LIKE "%'.$xar.'%" AND `detail_janr` LIKE "%'.$det.'%"';
    $sql = "SELECT * FROM kino WHERE $query_search ORDER BY god DESC $qury_start_num";
    $result = $db->query($sql); 
    $rows = $result->fetch(PDO::FETCH_ASSOC);
    if(count($rows) > 0){
    while($row = $result->fetch(PDO::FETCH_ASSOC)) {
         echo "
    <div class='kino'>
    <div class='tkt'>
      <h2 class='namm'><a class='linka' href='index.film.php?id={$row['id']}'>{$row['title']}</a></h2>
      <p class='ab'><span class='tt'>Год:</span> {$row['god']}</p>
      <p class='ab'><span class='tt'>Страна:</span> {$row['country']}</p>
      <p class='ab'><span class='tt'>Жанр:</span> {$row['janr_text']}</p>
      <p class='ab'><span class='tt'>Режиссер:</span> {$row['rezhiser']}</p>
      <p class='ab'><span class='tt'>Краткое описание:</span></p>
      <div class='infoner'>{$row['mini_description']}</div>
      </div>  
     <div class='pick'>
    <a class='link1' href='index.film.php?id={$row['id']}'>{$row['images']}</a>
    <div class='ocenka'>
    <span class='rati'>IMDb :</span><span class='rat'> {$row['imdb']}</span></br>
    <span class='rati'>КиноПоиск :</span><span class='rat'> {$row['kinopoisk']}</span>
    </div>
    </div>
    </div> 
           ";     
    }
    }
    else{
        echo"
        <p class='no_result'>Нет результатов, попробуйте еще!!!</p>
        <div class=''><img src='/images/minion.jpg' /></div>    
        ";    
    };
    ?>
    <?php
    if ($page != 1){ $pstr_prev = '<li><a class="pstr-prev" href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page - 1).'">&lt;</a></li>';}
    if ($page != $total) $pstr_next = '<li><a class="pstr-next" href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page + 1).'">&gt;</a></li>';
    // Находим две ближайшие станицы с обоих краев, если они есть
    if($page - 3 > 0) $page3left = '<li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page - 3).'">'.($page - 3).'</a></li>';
    if($page - 2 > 0) $page2left = '<li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page - 2).'">'.($page - 2).'</a></li>';
    if($page - 1 > 0) $page1left = '<li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page - 1).'">'.($page - 1).'</a></li>';
    if($page + 6 <= $total) $page6right = '<li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page + 6).'">'.($page + 6).'</a></li>';
    if($page + 5 <= $total) $page5right = '<li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page + 5).'">'.($page + 5).'</a></li>';
    if($page + 4 <= $total) $page4right = '<li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page + 4).'">'.($page + 4).'</a></li>';
    if($page + 3 <= $total) $page3right = '<li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page + 3).'">'.($page + 3).'</a></li>';
    if($page + 2 <= $total) $page2right = '<li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page + 2).'">'.($page + 2).'</a></li>';
    if($page + 1 <= $total) $page1right = '<li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.($page + 1).'">'.($page + 1).'</a></li>';
    if ($page+7 < $total)
    {
        $strtotal = '<li><p class="nav-point">...</p></li><li><a href="index-search_select_dop.php?xar='."$xar".'&tip='."$tip".'&det='."$det".'&page='.$total.'">'.$total.'</a></li>';
    }else
    {
        $strtotal = ""; 
    }
    
    if ($total > 1)
    {
        echo '
        <div class="pstrnave">
        <ul style="margin-left: -11px;">
        ';
        echo $pstr_prev.$page3left.$page2left.$page1left."<li><a class='pstr-active' href='index-search_select_dop.php?xar='.$xar.'&tip='.$tip.'&det='.$det.'&page=".$page."'>".$page."</a></li>".$page1right.$page2right.$page3right.$page4right.$page5right.$page6right.$strtotal.$pstr_next;
        echo '
        </ul>
        </div>
        ';   
    }    
    ?>
    </div>

    оригинал - https://toster.ru/q/331671

    loki90, 27 Июня 2016

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

    0

    1. 1
    2. 2
    3. 3
    if (strpos($route, ':') !== false) {
                    $route = str_replace(':any', '([^/]+)', str_replace(':num', '([0-9]+)', str_replace(':all', '(.+)', $route)));
                }

    Очередная обезьяна села высерать свои мысли на PHP ... Уже много говорили тут о mpak и его "cms", вот вам еще одно "чудо": https://github.com/wolfcms/wolfcms

    zenn1989, 24 Июня 2016

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