1. Лучший говнокод

    В номинации:
    За время:
  2. ActionScript / Говнокод #14631

    −122

    1. 1
    ObjectUtils.deleteFromDictionary(showTweens,  slideView);

    Для тех, кто не в курсе:

    delete dictionary[key];

    wvxvw, 18 Февраля 2014

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

    +155

    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
    function compileStr($arrStrings) {
    	if (is_array($arrStrings)) {
    		$part1 = 'a:2:{s:5:"VALUE";a:';
    		$part2 = 's:11:"DESCRIPTION";a:';
    		$part3 = '}';
    
    		$ornums = array();
    
    		foreach ($arrStrings as $str) {
    			$exp = explode(",", str_replace(" ", "", $str));
    			$ornums = array_merge($ornums, $exp);
    		}
    
    		$ecount = count($ornums);
    		$s1 = $ecount.':{';
    		$s2 = $ecount.':{';
    
    		for ($i = 0; $i < $ecount; $i++) {
    			$s1 .= 'i:'.$i.';s:'.strlen($ornums[$i]).':"'.$ornums[$i].'";';
    			$s2 .= 'i:'.$i.';s:0:"";';
    		}
    
    		$s1 .= '}';
    		$s2 .= '}';
    
    		$result = $part1.$s1.$part2.$s2.$part3;
    		return $result;
    	}
    }

    Нашел в дебрях проекта. Писать php-сериализатор на php - это концептуально )))
    если кто не понял функция делает вот это:
    if (is_array($arrStrings)) {
    $ornums = explode(',', implode(',', str_replace(' ', '', $arrStrings)));
    return serialize(array("VALUE" => $ornums, "DESCRIPTION" => array_fill(0, count($ornums), '')));
    }

    Homess, 14 Февраля 2014

    Комментарии (1)
  4. Perl / Говнокод #14557

    −151

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    if( my $row = &dbselectrow( $sql ) )
            {
                    if( $row -> { 'ofid' } == 9782 ) # moscow
                    {
                            if( $row -> { 'jt' } =~ /Начальник /i )
                            {
                                    &subscribe_to_management( $row -> { 'email' } );
                            }
                    }
            }

    Автоматическая подписка сотрудника руководящей должности на список рассылки для руководителей.

    kainwinterheart, 13 Февраля 2014

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

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    public function GetSubscriptions()
    {
            return $this->repaymentPay->check();
    }

    А я сказал горбатый!

    dimkich, 30 Января 2014

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

    +149

    1. 1
    2. 2
    3. 3
    array_unshift($available, $noSize);
    if (is_null($noSize))
        unset($available[0]);

    CRRaD, 15 Января 2014

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

    +142

    1. 1
    string"==typeof a[d]||"number"==typeof a[d]||"boolean"==typeof a[d])&&bk_addPageCtx(d,a[d]);}}},doTag:function(i,j,k,l,m,n,o,p,q){var r={site:i,limit:j,excludeBkParams:k,partnerID:l,allowMultipleCalls:m,callback:n,allData:o,timeOut:p,ignoreOutsideIframe:q};for(var s in g){g.hasOwnProperty(s)&&"undefined"!=typeof window["bk_"+g[s]]&&(r[s]=window["bk_"+g[s]]);}if("object"==typeof i){for(var t in g){g.hasOwnProperty(t)&&"undefined"!=typeof i[g[t]]&&(r[t]=i[g[t]]);}}if(!(r.suppressMultipleCalls===!0||"undefined"!=typeof f&&f&&r.allowMultipleCalls!==!0)){f=!0,void 0===r.timeOut&&(r.timeOut=1000),e.unshift("ret="+(r.callback?"js":"html"));var u="undefined"!=typeof r.partnerID&&null!==r.partnerID;u&&e.unshift("partner="+encodeURIComponent(r.partnerID));var v={2607:1,2834:1,2894:1,3316:1,3317:1,3318:1,3319:1,3321:1,3322:1,3323:1,3324:1,3325:1,3326:1,3327:1,3328:1,3329:1,3330:1,3331:1,3332:1,3333:1,3334:1,3338:1,3339:1,3340:1,3341:1,3344:1,3345:1,3346:1,3348:1};if(!r.excludeBkParams&&!r.excludeTitle&&""!==document.title&&h.addBkParam("t",document.title),!r.excludeBkParams&&!r.excludeKeywords&&h.addBkParam("k",b.getKwds()),!r.excludeBkParams&&!r.excludeReferrer&&"referrer" in document&&""!==document.referrer&&h.addBkParam("pr",document.referrer),!r.excludeBkParams&&!r.excludeLocation&&h.addBkParam("l",window.location.toString()),r.callback?h.addParam("jscb",encodeURIComponent(r.callback)):"undefined"!=typeof r.limit&&h.addParam("limit",encodeURIComponent(r.limit)),r.allData===!0&&h.addParam("data","all"),r.disableMobile!==!0&&r.suppressStatidPayload!==!0&&(b.isMobile()||c>d||r.sendStatidPayload||-1!==window.location.search.indexOf("force=bkfpd"))&&"undefined"!=typeof fortyone&&"undefined"!=typeof numis&&(h.addParam("bkfpd",fortyone.collect()),h.addParam("bknms",numis.collect())),r.suppressEventScheduling!==!0&&r.eventScheduling===!0&&b.addEvent("message",function(a){if("http://tags.bluekai.com"===a.origin){var b=document.getElementById("__bkframe"),c=function(a){return function(){b.contentWindow.postMessage(JSON.stringify({event:a}),"*"),b.contentWindow.postMessage(JSON.stringify({schedule:"run"}),"*");};},d=JSON.parse(a.data);if(d.status&&"loaded"===d.status&&b.contentWindow.postMessage(JSON.stringify({get:"events"}),"*"),d.scheduled){var e=JSON.parse(d.scheduled);for(var f in e){var g="window"===e[f]?window:document.getElementById(e[f]);g.addEventListener(f,c(f),!1);}}d.status&&"complete"===d.status&&b.contentWindow.postMessage(JSON.stringify({status:"ack"}),"*");}},!1),r.suppressFirstParty!==!0&&r.useFirstParty&&(readCookie("bkrid")||createCookie("bkrid",Math.floor(Math.random()*Math.pow(2,31)),180),readCookie("bkrid")&&h.addParam("bkrid",encodeURIComponent(readCookie("bkrid")))),(b.isDebug()||r.isDebug)&&h.addParam("debug","1"),!r.excludeBkParams&&"undefined"!=typeof r.paramList&&h.getGlobals(r.paramList),!r.excludeBkParams&&"undefined"!=typeof r.jsList&&h.getGlobals(r.jsList),!r.excludeBkParams&&"undefined"!=typeof r.metaVars){for(var w=0;w<r.metaVars.length;w++){var x=b.getMeta(r.metaVars[w]);null!==x&&h.addBkParam(r.metaVars[w],x);}}r.suppressCacheBusting!==!0&&h.addParam("r",parseInt(99999999*Math.random(),10));var y="https://stags.bluekai.com/",z="http://tags.bluekai.com/",A=("https:"===document.location.protocol?r.pixelSecure?r.pixelSecure:y:r.pixelUrl?r.pixelUrl:z)+(u?"psite":"site")+"/"+r.site,B=A+"?"+e.join("&");if(r.limitGetLength&&(B=B.substr(0,2000)),BKTAG._dest=h._dest=B,r.callback){if(r.useImage){var C=document.createElement("span");C.style.display="none";var D=document.getElementsByTagName("body")[0];D.appendChild(C);var E=document.createElement("img");E.src=h._dest,C.appendChild(E);}else{var F=document.createElement("script");F.type="text/javascript",F.src=h._dest,F.id="__bk_script__",v[""+i]&&setTimeout(function(){var a=document.getElementById("__bk_script__");a&&(a.removeNode?a.removeNode(!0):a.parentNode.removeChild(a));},r.timeOut),document.getElementsByTagName("head")[0].appendChild(F);}}else{if(a.checkFrame(function(){if(r.useMultipleIframes){var b=a.createFrame("__bkframe_"+r.site+"_"+(new Date).valueOf());b.className="__bkframe_site_"+r.site,b.src=B,document.getElementsByTagName("body")[0].appendChild(b);}else{if(frames&&frames.__bkframe){frames.__bkframe.location.replace(B);}else{var c=a.createFrame("__bkframe");document.

    ...

    bahamot, 14 Января 2014

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

    +116

    1. 1
    "{7790769C-0471-11D2-AF11-00C04FA35D02}");},function(a){return a.b("{89820200-ECBD-11CF-8B85-00AA005B4340}");},function(a){return a.b("{283807B5-2C60-11D0-A31D-00AA00B92C03}");},function(a){return a.b("{4F216970-C90C-11D1-B5C7-0000F8051515}");},function(a){return a.b("{44BBA848-CC51-11CF-AAFA-00AA00B6015C}");},function(a){return a.b("{9381D8F2-0288-11D0-9501-00AA00B911A5}");},function(a){return a.b("{4F216970-C90C-11D1-B5C7-0000F8051515}");},function(a){return a.b("{5A8D6EE0-3E18-11D0-821E-444553540000}");},function(a){return a.b("{89820200-ECBD-11CF-8B85-00AA005B4383}");},function(a){return a.b("{08B0E5C0-4FCB-11CF-AAA5-00401C608555}");},function(a){return a.b("{45EA75A0-A269-11D1-B5BF-0000F8051515}");},function(a){return a.b("{DE5AED00-A4BF-11D1-9948-00C04F98BBC9}");},function(a){return a.b("{22D6F312-B0F6-11D0-94AB-0080C74C7E95}");},function(a){return a.b("{44BBA842-CC51-11CF-AAFA-00AA00B6015B}");},function(a){return a.b("{3AF36230-A269-11D1-B5BF-0000F8051515}");},function(a){return a.b("{44BBA840-CC51-11CF-AAFA-00AA00B6015C}");},function(a){return a.b("{CC2A9BA0-3BDD-11D0-821E-444553540000}");},function(a){return a.b("{08B0E5C0-4FCB-11CF-AAA5-00401C608500}");},function(){return eval("navigator.appCodeName");},function(){return eval("navigator.appName");},function(){return eval("navigator.appVersion");},function(a){return a.exec(["navigator.productSub","navigator.appMinorVersion"]);},function(){return eval("navigator.browserLanguage");},function(){return eval("navigator.cookieEnabled");},function(a){return a.exec(["navigator.oscpu","navigator.cpuClass"]);},function(){return eval("navigator.onLine");},function(){return eval("navigator.platform");},function(){return eval("navigator.systemLanguage");},function(){return eval("navigator.userAgent");},function(a){return a.exec(["navigator.language","navigator.userLanguage"]);},function(){return eval("document.defaultCharset");},function(){return eval("document.domain");},function(){return eval("screen.deviceXDPI");},function(){return eval("screen.deviceYDPI");},function(){return eval("screen.fontSmoothingEnabled");},function(){return eval("screen.updateInterval");},function(a){return a.h();},function(a){return a.i(c);},function(){return"@UTC@";},function(a){return a.n(c);},function(a){return a.m();},function(){return eval("screen.width");},function(){return eval("screen.height");},function(a){return a.plugins.Acrobat;},function(a){return a.plugins.Flash;},function(a){return a.plugins.QuickTime;},function(a){return a.plugins["Java Plug-in"];},function(a){return a.plugins.Director;},function(a){return a.plugins.Office;},function(){return(new Date).getTime()-c.getTime();},function(a){return a.e;},function(a){return a.f;},function(){return c.toLocaleString();},function(){return eval("screen.colorDepth");},function(){return eval("window.screen.availWidth");},function(){return eval("window.screen.availHeight");},function(){return eval("window.screen.availLeft");},function(){return eval("window.screen.availTop");},function(a){return a.a("Acrobat");},function(a){return a.a("Adobe SVG");},function(a){return a.a("Authorware");},function(a){return a.a("Citrix ICA");},function(a){return a.a("Director");},function(a){return a.a("Flash");},function(a){return a.a("MapGuide");},function(a){return a.a("MetaStream");},function(a){return a.a("PDFViewer");},function(a){return a.a("QuickTime");},function(a){return a.a("RealOne");},function(a){return a.a("RealPlayer Enterprise");},function(a){return a.a("RealPlayer Plugin");},function(a){return a.a("Seagate Software Report");},function(a){return a.a("Silverlight");},function(a){return a.a("Windows Media");},function(a){return a.a("iPIX");},function(a){return a.a("nppdf.so");},function(a){return a.o();}];this.q();for(var e="",f=0;f<d.length;f++){b&&(e+=this.j(d[f].toString(),'"',"'",!0),e+="=");var g;try{g=d[f](this);}catch(h){g="";}e+=b?g:escape(g),e+=";",b&&(e+="\\n");}return e=this.j(e,escape("@UTC@"),(new Date).getTime());},this.l=function(a){try{if(!a){return this.k();}var b;if(b=this.r(a),null!==b){try{b.value=this.k();}catch(c){b.value=escape(c.message);}}}catch(d){}},this.a=function(a){try{if(navigator.plugins&&navigator.plugins.length){for(var b=0;b<navigator.plugins.length;b++){var c=navigator.plugins[b];if(c.name.indexOf(a)>=0){return c.name+(c.description?"|"+c.description:"");}}}}catch(d){}return"";},this.o=function(){var a=document.createElement("span");a.innerHTML="&nbsp;",a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a);var b=a.offsetHeight;return document.body.removeChild(a),b;};};try{fortyone.c=document.createElement("span"),"undefined"!=typeof fortyone.c.addBehavior&&fortyone.c.addBehavior("#default#clientCaps");}catch(i){}window.fortyone=fortyone,window.fortyone.collect=fortyone.l,define("../vendor/fortyone",function(){}),"object"!=typeof JSON&&(JSON={}),function(){function f(a){return 10>a?"0"+a:a;}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+a+'"';}function str(a,b){var c,d,e,f,g,h=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),

    ...

    bahamot, 14 Января 2014

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

    +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
    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
    public static function getAssoc($constBlock,$const){
            if (defined($constBlock)){
                $arLabels = unserialize($const);
                $assoc = array(
                    $arLabels['news_day'] => array(
                        'img' => array(
                            0 => array(
                                'class' => 'sticker infoBlock news_of_day',
                                'big' => '/static/img/labels/news_of_day.png',
                                'small' => '/static/img/labels/news_of_day_s.png'
                            ),
                            /*1 => array(
                                'class' => 'sticker news_of_day_r',
                                'big' => '/static/img/labels/news_of_day_r.png',
                                'small' => '/static/img/labels/news_of_day_s_r.png'
                            ),*/
                        )
                    ),
                    $arLabels['hot'] => array(
                        'img' => array(
                            0 => array(
                                'class' => 'sticker hot infoBlock',
                                'big' => '/static/img/labels/hot.png',
                                'small' => '/static/img/labels/hot_s.png'
                            )
                        )
                    ),
                    $arLabels['gossip'] => array(
                        'img' => array(
                            0 => array(
                                'class' => 'sticker infoBlock gossip',
                                'big' => '/static/img/labels/gossip.png',
                                'small' => '/static/img/labels/gossip_s.png'
                            )
                        )
                    ),
                    $arLabels['thing_of_week'] => array(
                        'img' => array(
                            0 => array(
                                'class' => 'sticker thing_of_week infoBlock',
                                'big' => '/static/img/labels/thing_of_week.png',
                                'small' => '/static/img/labels/thing_of_week_s.png'
                            )
                        )
                    ),
                    ...
                    ...
                    ...
                    ...
                    ...
                    $arLabels['new_role'] => array(
                        'img' => array(
                            0 => array(
                                'class' => 'sticker new_role infoBlock',
                                'big' => '/static/img/labels/new_role.png',
                                'small' => '/static/img/labels/new_role_s.png'
                            )
                        )
                    )
                );
            }
            return $assoc;
        }

    Так пишут "грамотные разработчики на битриксе" (они знают неймспейсы). Естественно, что все методы в классах должны быть статическими. Это по-битриксовому, значит правильно. Заполнение массива ChinaStyle, т.е. вручную - это тоже правильно, ибо тоже по-битриксовому. И конечно же, вся эта НЁХ должна храниться в текущем методе. "Циклы? Нет, не слышали... Запросы к базе данных? Битрикс говорит, что это плохо, поэтому мы с уверенностью эти лекции проебали. Зато мы знаем неймспейсы!"

    sturm, 26 Декабря 2013

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

    +129

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <ul>
      <li data-stage="details"><span>1. Details</span></li>
      <li data-stage="adscreate"><span>2. Creatives</span></li>
      <li data-stage="targets"><span>3. Targeting</span></li>
      <li data-stage="pricing_scheduling" style="width:245px;"><span>4. Pricing &amp; Scheduling</span></li>
      <li data-stage="preview"><span>5. Preview</span></li>
    </ul>

    Ul over Ol!

    wvxvw, 25 Декабря 2013

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

    +153

    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
    <?php
    sfConfig::set('show_counters', true);
    /**
     * Lite
     *
     * @category Symfony
     * @package Plugins
     * @subpackage liteSearchsite
     * @author 
     * @since 12.11.2008
     * @version $Id: actions.class.php 28664 2011-03-15 13:14:49Z ringtail $
     */
    
    /**
     * class liteSearchsiteActions. Функции для работы с поиском
     *
     * @category Symfony
     * @package Plugins
     * @subpackage liteSearchsite
     * @author Tretyakov Ilya <[email protected]>
     * @version $Id: actions.class.php 28664 2011-03-15 13:14:49Z ringtail $
     */
    class liteSearchsiteActions extends sfActions
    {
      protected $searchsite;
      protected $search_server = 'http://217.148.52.134:17000/';
    
      /**
       * конструктор
       *
       * @see sfComponent
       */
      public function __construct($context, $moduleName, $actionName)
      {
        $this->searchsite = new liteSearchsite();
        parent::__construct($context, $moduleName, $actionName);
      }
    
      /**
       * Поиск. главная
       *
       * @param unknown_type $request
       */
      public function executeIndex($request)
      {
        if ($request) {
          $page = $request->getParameter('id');
          $this->text = htmlspecialchars($request->getParameter('search_text'));
          $reqid = $request->getParameter('reqid');
          $page = $request->getParameter('p');
          $numdoc = $request->getParameter('numdoc');
    
        }
        if (!$page) $page = 0;
    
        if (!$this->searchsite->checkServer($this->search_server)) { throw new sfException('Ахтунг!'); }
        if (!1) {
          $this->search_work = 0;
        } else
        if ($this->searchsite->uploadXml($this->search_server, $this->text, $reqid, $page, $numdoc)) {
    
          $this->pages_found = $this->searchsite->getCountItem();
          $this->start_page = $this->searchsite->getStartPage();
    
          $this->pages_found_word = $this->searchsite->getWordLinks();
          $this->reqid = $this->searchsite->getRegId();
          $this->pages = $this->searchsite->getPages();
          $this->count_results = $this->searchsite->getDifPages();
    
          if ($this->pages) {
            $this->nextpagelink = $this->searchsite->getLinkNextPage();
            $this->prepagelink = $this->searchsite->getLinkPrePage();
          }
    
          $this->search_work = 1;
    
          if (!$this->pages_found) {
            $this->no_result = 1;
            $this->pages_found = 0;
          } else {
            $this->no_result = 0;
    
            $this->list = $this->searchsite->getList($page);
    
            //пересчитаем
            //$this->pages_found = $this->searchsite->getCountItem();
            //$this->searchsite->setCountPages();
            //$this->pages_found_word = $this->searchsite->getWordLinks();
            //$this->pages = $this->searchsite->getPages();
            //$this->count_results = $this->searchsite->getDifPages();
    
            if ($this->pages) {
              $this->nextpagelink = $this->searchsite->getLinkNextPage();
              $this->prepagelink = $this->searchsite->getLinkPrePage();
            }
          }
        } else {
          $this->search_work = 0;
        }
      }

    kix, 11 Декабря 2013

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