1. Поиск говнокода

    Этот поиск практически ничего не может найти! Но вы всё-таки попытайтесь, вдруг повезет.

    Найдено: 65

  2. PHP / Говнокод #1189

    +153

    1. 1
    2. 2
    3. 3
    4. 4
    <?
    if ($arResult["MANAGE_PANEL"]["MESSAGES"] == "Y"):
    endif;
    ?>

    Ну вы поняли, какая CMS
    /bitrix/modules/forum/install/components/bitrix/forum/templates/.default/bitrix/forum.menu/.default/template.php
    Семёрка, 426 строка

    guest, 11 Июня 2009

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

    +149.2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    $page = preg_replace( array( "/action=.*?\\&/i", 
    "/bx_event_calendar_request=.*?\\&/i", 
    "/clear_cache=.*?\\&/i", 
    "/bitrix_include_areas=.*?\\&/i", 
    "/bitrix_show_mode=.*?\\&/i", 
    "/back_url_admin=.*?\\&/i"), "", $arParams['pageUrl']."&" );
    
    $page = preg_replace( array( "/^(.*?)\\&\$/i", "/^(.*?)\\?\$/i" ), "\$1", $page );

    как перечислить возможные слова или символы в регулярке? Нормальные программисты делают это через (word1|word2) и [&?], но в битриксе...

    guest, 19 Февраля 2009

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

    +11.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
    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
    function SetFileAccessPermission($path, $arPermissions, $bOverWrite=true)
    	{
    		CMain::InitPathVars($site, $path);
    		$DOC_ROOT = CSite::GetSiteDocRoot($site);
    
    		if(strlen($path) <= 0)
    			$path="/";
    		if(($p = bxstrrpos($path, "/"))!==false)
    		{
    			$path_file = substr($path, $p+1);
    			$path_dir = substr($path, 0, $p);
    		}
    		else
    			return false;
    
    		if($path_file=="" && $path_dir=="")
    			$path_file = "/";
    
    		$PERM = Array();
    		if(file_exists($DOC_ROOT.$path_dir."/.access.php"))
    			@include($DOC_ROOT.$path_dir."/.access.php");
    		
    		$FILE_PERM = $PERM[$path_file];
    		if(!is_array($FILE_PERM))
    			$FILE_PERM=Array();
    
    		if(!$bOverWrite && count($FILE_PERM)>0)
    			return true;
    
    		$bDiff = false;
    
    		$str="<?\n";
    		foreach($arPermissions as $group=>$perm)
    		{
    			if(strlen($perm) > 0)
    				$str.="\$PERM[\"".$path_file."\"][\"".$group."\"]=\"".str_replace("\"", "\\\"", $perm)."\";\n";
    			if(!$bDiff && $FILE_PERM[$group]!=$perm)
    				$bDiff=true;
    		}
    
    		foreach($PERM as $file=>$arPerm)
    		{
    			if(strval($file) !==$path_file)
    				foreach($arPerm as $group=>$perm)
    					$str.="\$PERM[\"".$file."\"][\"".$group."\"]=\"".str_replace("\"", "\\\"", $perm)."\";\n";
    		}
    
    		if(!$bDiff)
    		{
    			foreach($FILE_PERM as $group=>$perm)
    				if($arPermissions[$group]!=$perm)
    				{
    					$bDiff==true;
    					break;
    				}
    		}
    
    		$str.="?".">";
    		
    		$this->SaveFileContent($DOC_ROOT.$path_dir."/.access.php", $str);
    		$GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
    		unset($this->FILE_PERMISSION_CACHE[$site."|".$path_dir."/.access.php"]);
    		
    		if($bDiff)
    		{
    			$db_events = GetModuleEvents("main", "OnChangePermissions");
    			while($arEvent = $db_events->Fetch())
    				ExecuteModuleEvent($arEvent, Array($site, $path), $arPermissions);
    		}
    		return true;
    	}

    MegaLolnii bitrix
    самое смешное с 32 строчки

    guest, 23 Января 2009

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

    +33.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
    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
    <?
     function ShowImage($strImage, $iMaxW=0, $iMaxH=0, $sParams=null, $strImageUrl="", $bPopup=false, $sPopupTitle=false, $iSizeWHTTP=0, $iSizeHHTTP=0)
     {
      global $DOCUMENT_ROOT, $DB;
    
      if(!($arImgParams = CFile::_GetImgParams($strImage, $iSizeWHTTP, $iSizeHHTTP)))
       return "";
    
      if($sParams === null || $sParams === false)
       $sParams = ' border="0" ';
    
      $iMaxW = intval($iMaxW);
      $iMaxH = intval($iMaxH);
    
      $strImage = htmlspecialchars($arImgParams["SRC"]);
      $intWidth = $arImgParams["WIDTH"];
      $intHeight = $arImgParams["HEIGHT"];
      $strAlt = $arImgParams["ALT"];
    
      if($sPopupTitle===false)
       $sPopupTitle=GetMessage("FILE_ENLARGE");
    
      $file_type = GetFileType($strImage);
      switch($file_type):
       case "FLASH":
        $iWidth = $intWidth;
        $iHeight = $intHeight;
        if($iMaxW>0 && $iMaxH>0 && ($intWidth > $iMaxW || $intHeight > $iMaxH))
        {
         $coeff = ($intWidth/$iMaxW > $intHeight/$iMaxH? $intWidth/$iMaxW : $intHeight/$iMaxH);
         $iWidth = intval(roundEx($intHeight/$coeff));
         $iHeight = intval(roundEx($intWidth/$coeff));
        }
        $strReturn = '
         <object
          classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000"
          codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
          id="banner"
          WIDTH="'.$iWidth.'"
          HEIGHT="'.$iHeight.'"
          ALIGN="">
           <PARAM NAME="movie" VALUE="'.$strImage.'" />
           <PARAM NAME="quality" VALUE="high" />
           <PARAM NAME="bgcolor" VALUE="#FFFFFF" />
           <embed
            src="'.$strImage.'"
            quality="high"
            bgcolor="#FFFFFF"
            WIDTH="'.$iWidth.'"
            HEIGHT="'.$iHeight.'"
            NAME="banner"
            ALIGN=""
            TYPE="application/x-shockwave-flash"
            PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
           </embed>
         </object>
         ';
        return $bPopup? $strReturn : print_url($strImageUrl, $strReturn);
    
       default:
        $strReturn = "<img src=\"".$strImage."\" ".$sParams." width=\"".$intWidth."\" height=\"".$intHeight."\" alt=\"".htmlspecialchars($strAlt)."\" />";
        if($iMaxW > 0 && $iMaxH > 0) //need to check scale, maybe show actual size in the popup window
        {
         //check for max dimensions exceeding
         if($intWidth > $iMaxW || $intHeight > $iMaxH)
         {
          $coeff = ($intWidth/$iMaxW > $intHeight/$iMaxH? $intWidth/$iMaxW : $intHeight/$iMaxH);
          $strReturn = "<img src=\"".$strImage."\" ".$sParams." width=\"".intval(roundEx($intWidth/$coeff))."\" height=\"".intval(roundEx($intHeight/$coeff))."\" alt=\"".htmlspecialchars($strAlt)."\" />";
    
          if($bPopup) //show in JS window
          {
           if(strlen($strImageUrl)>0)
           {
            $strReturn =
             '<a href="'.$strImageUrl.'" title="'.$sPopupTitle.'" target="_blank">'.
             '<img src="'.$strImage.'" '.$sParams.' width="'.intval(roundEx($intWidth/$coeff)).'" height="'.intval(roundEx($intHeight/$coeff)).' alt="'.htmlspecialchars($sPopupTitle).'" />'.
             '</a>';
           }
           else
           {
            CFile::OutputJSImgShw();
    
            $strReturn =
             "<a title=\"".$sPopupTitle."\" onClick=\"ImgShw('".AddSlashes($strImage)."','".$intWidth."','".$intHeight."', '".AddSlashes(htmlspecialcharsex(htmlspecialcharsex($strAlt)))."'); return false;\" href=\"".$strImage."\" target=\"_blank\">".
             "<img src=\"".$strImage."\" ".$sParams." width=\"".intval(roundEx($intWidth/$coeff))."\" height=\"".intval(roundEx($intHeight/$coeff))."\" /></a>";
           }
          }
         }
        }
        return $bPopup? $strReturn : print_url($strImageUrl, $strReturn);
    
      endswitch;
    
      return $bPopup? $strReturn : print_url($strImageUrl, $strReturn);
     }
    ?>

    Уникальный фрагмент кода из CMS Bitrix 7.x.
    Судя по всему его писал индус который не проверял его работы.
    Некотором будет непонятен тонкий юмор автора этого кода, но когда пытаешься решить с его помощью конкретную задачу становится совсем не смешно а наоборот обидно, за себя и толпы тысяч людей полагающих что Bitrix решение всех его проблем логика работы в котором напрочь отсутствует так же как и здравый смысл.
    Сделаю небольшой намёк. Весь фокус во взаимной зависимости параметров
    $iMaxW=0, $iMaxH=0, $strImageUrl="", $bPopup=false

    guest, 22 Января 2009

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

    +24

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    <?
    $arrSaveColor[0] = "CCCCCC";
    $arrSaveColor[1] = "999999";
    $arrSaveColor[2] = "FF0000";
    $arrSaveColor[3] = "FF3333";
    $arrSaveColor[4] = "CC0000";
    $arrSaveColor[5] = "FF6666";
    $arrSaveColor[6] = "CC3333";
    $arrSaveColor[7] = "990000";
    $arrSaveColor[8] = "FF9999";
    $arrSaveColor[9] = "CC6666";
    $arrSaveColor[10] = "993333";
    $arrSaveColor[11] = "FFCCCC";
    $arrSaveColor[12] = "CC9999";
    $arrSaveColor[13] = "996666";
    $arrSaveColor[14] = "FF3300";
    $arrSaveColor[15] = "FF6633";
    $arrSaveColor[16] = "CC3300";
    $arrSaveColor[17] = "FF9966";
    $arrSaveColor[18] = "CC6633";
    $arrSaveColor[19] = "993300";
    $arrSaveColor[20] = "FF6600";
    $arrSaveColor[21] = "FF9933";
    $arrSaveColor[22] = "CC6600";
    $arrSaveColor[23] = "FFCC99";
    $arrSaveColor[24] = "CC9966";
    $arrSaveColor[25] = "996633";
    $arrSaveColor[26] = "FF9900";
    $arrSaveColor[27] = "FFCC66";
    $arrSaveColor[28] = "CC9933";
    $arrSaveColor[29] = "996600";
    $arrSaveColor[30] = "CC9900";
    $arrSaveColor[31] = "FFCC33";
    $arrSaveColor[32] = "FFCC00";
    $arrSaveColor[33] = "FFFF00";
    $arrSaveColor[34] = "FFFF33";
    $arrSaveColor[35] = "CCCC00";
    $arrSaveColor[36] = "FFFF66";
    $arrSaveColor[37] = "CCCC33";
    $arrSaveColor[38] = "999900";
    $arrSaveColor[39] = "FFFF99";
    $arrSaveColor[40] = "CCCC66";
    $arrSaveColor[41] = "999933";
    $arrSaveColor[42] = "FFFFCC";
    $arrSaveColor[43] = "CCCC99";
    $arrSaveColor[44] = "999966";
    $arrSaveColor[45] = "A2CA00";
    $arrSaveColor[46] = "CCFF33";
    $arrSaveColor[47] = "99CC00";
    $arrSaveColor[48] = "CCFF66";
    $arrSaveColor[49] = "99CC33";
    $arrSaveColor[50] = "669900";
    $arrSaveColor[51] = "99FF00";
    $arrSaveColor[52] = "99FF33";
    $arrSaveColor[53] = "66CC00";
    $arrSaveColor[54] = "73E600";
    $arrSaveColor[55] = "99CC66";
    $arrSaveColor[56] = "669933";
    $arrSaveColor[57] = "66FF00";
    $arrSaveColor[58] = "99FF66";
    $arrSaveColor[59] = "66CC33";
    $arrSaveColor[60] = "339900";
    $arrSaveColor[61] = "66FF33";
    $arrSaveColor[62] = "33CC00";
    $arrSaveColor[63] = "33FF00";
    $arrSaveColor[64] = "00FF00";
    $arrSaveColor[65] = "33FF33";
    $arrSaveColor[66] = "00CC00";
    $arrSaveColor[67] = "66FF66";
    $arrSaveColor[68] = "33CC33";
    $arrSaveColor[69] = "009900";
    $arrSaveColor[70] = "99FF99";
    $arrSaveColor[71] = "66CC66";
    $arrSaveColor[72] = "339933";
    $arrSaveColor[73] = "00AA00";
    $arrSaveColor[74] = "99CC99";
    $arrSaveColor[75] = "669966";
    $arrSaveColor[76] = "00FF33";
    $arrSaveColor[77] = "33FF66";
    $arrSaveColor[78] = "00CC33";
    $arrSaveColor[79] = "66FF99";
    $arrSaveColor[80] = "33CC66";
    $arrSaveColor[81] = "009933";
    $arrSaveColor[82] = "00FF66";
    $arrSaveColor[83] = "33FF99";
    $arrSaveColor[84] = "00CC66";
    $arrSaveColor[85] = "99FFCC";
    $arrSaveColor[86] = "66CC99";
    $arrSaveColor[87] = "339966";
    $arrSaveColor[88] = "00FF99";
    $arrSaveColor[89] = "66FFCC";
    $arrSaveColor[90] = "33CC99";
    $arrSaveColor[91] = "009966";
    $arrSaveColor[92] = "33FFCC";
    $arrSaveColor[93] = "00CC99";
    $arrSaveColor[94] = "00FFCC";
    $arrSaveColor[95] = "00FFFF";
    $arrSaveColor[96] = "33FFFF";
    $arrSaveColor[97] = "00CCCC";
    $arrSaveColor[98] = "66FFFF";

    govnoBitrix again

    guest, 22 Января 2009

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