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

    +162

    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
    protected function getMebelNavigationHtml()
    {
    $nav = <<<EODD
    <td>
    	<div class="g-c right">
    		<div class="tab">
    			<nobr><a href="/mebel">Мебель</a></nobr>
    		</div>
    		<div class="body">
    			<table>
    				<tr>
    					<td class="col">
    						<ul>
    							<li class="head"><a href="/mebel/stulchiki">Стульчики</a></li>
    							<li class="head"><a href="/mebel/krovatki">Кроватки</a></li>
    							<li class="head"><a href="/mebel/manezhi">Манежи</a></li>
    							<li class="head"><a href="/mebel/komody">Комоды</a></li>
    							<li class="head"><a href="/mebel/pelenalnye-stoliki">Пеленальные столики</a></li>
    							<li class="head"><a href="/mebel/electrokacheli">Электрокачели</a></li>
    							<li class="head"><a href="/mebel/napolnie-ka4eli">Напольные качели</a></li>
    							<li class="head"><a href="/mebel/kresla-kachalki">Кресла-качалки</a></li>
    							<li class="head"><a href="/mebel/hodunki">Ходунки</a></li>
    							<li class="head"><a href="/mebel/kolybeli">Колыбели</a></li>
    							<li class="head"><a href="/mebel/shkafy">Шкафы</a></li>
    							<li class="head"><a href="/mebel/detskie-komnaty">Детские комнаты</a></li>
    							<li class="head"><a href="/mebel/matrasy">Матрасы</a></li>
    							<li class="head"><a href="/mebel/aksessuary">Аксессуары</a></li>
    						</ul>
    					</td>
    					<td class="col">
    						<ul>
    							<li class="head"><a href="/mebel/postel">Постельные принадлежности</a></li>
    							<li><a href="/mebel/postel/odeyala">Одеяла</a></li>
    							<li><a href="/mebel/postel/podushki">Подушки</a></li>
    							<li><a href="/mebel/postel/komplekty-postelnogo-belya">Комплекты постельного белья</a></li>
    							<li><a href="/mebel/postel/spalnye-meshki">Спальные мешки</a></li>
    							<li><a href="/mebel/postel/komplekty-na-vypisku">Комплекты на выписку</a></li>
    							<li><a href="/mebel/postel/baldahiny">Балдахины</a></li>
    							<li><a href="/mebel/postel/aksessuary">Аксессуары</a></li>
    							<li><a href="/mebel/postel/prosini-i-kleenki">Простыни и клеенки</a></li>
    							<li><a href="/mebel/postel/bortiki">Бортики</a></li>
    						</ul>
    					</td>
    				</tr>
    			</table>
    		</div>
    	</div>
    	<a href="/mebel">Мебель</a>
    </td>
    EODD;
    		return $nav;
    }

    Хардкоженая навигация. Даже не в шаблоне...

    vsushkov, 21 Апреля 2011

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

    +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 drawItem($category, $level=0, $last=false)
        {
            // ...
    		
            if($this->isIgrushkiCategory($category) && ($level == 0))
                // ...
            } elseif ($level == 1) {
                // ...
            } elseif ($level == 2) {
                // ...
            } else {
                Mage::log('пришол пиздец!');
            }
            return $html;
        }

    ни программировать, ни по русски писать...

    vsushkov, 21 Апреля 2011

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public function setAmbiguityIdentity($flag)
        {
            if (is_integer($flag)) {
                $this->_ambiguityIdentity = (1 === $flag ? true : false);
            } elseif (is_bool($flag)) {
                $this->_ambiguityIdentity = $flag;
            }
            return $this;
        }

    Zend Framework компонент Zend_Auth_Adapter_DbTable. (Слегка смутила строка 4)

    sonic, 21 Апреля 2011

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

    +162

    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
    <?php
    if(isset($_GET['pid'])){
    $pid = $_GET['pid'];
    echo $pid;
    $szi=iconv_strlen($pid);
    if(file_exists("./$pid.txt")){
    $fc=fopen("$pid.txt","r");
    if($fc<0)exit(0);
    fseek($fc,0,0);
    $url = fread($fc,filesize("./$pid.txt"));
    fclose($fc);
      header('Location: '.$url);
    } else {
      echo "File not exist<br>";
    };
    
    };
    $idx=0;
    $fc=fopen("index.txt","r");
    if($fc<0)exit(0);
    $idx = fread($fc,filesize("index.txt"));
    fclose($fc);
    $fc=fopen("./$idx.txt","r");
    if($fc<0)exit(0);
    $url = fread($fc,filesize("./$idx.txt"));
    fclose($fc);
    echo "<a href=\"http://netelis.hmsite.net/index.php?pid=$idx\">$url</a>";
    
    if(isset($_POST['url'])){
    $url=$_POST['url'];
    if (parse_url($url)) {
        echo "Your url is ok.";
      for($i=0;$i<=$idx;$i+=2){
        $fc=fopen("$i.txt","r");
      if($fc<0)exit(0);
        $urla = fread($fc,filesize("$i.txt"));
        fclose($fc);
       // echo "$urla<br>";
        if(strcmp($url,$urla)==0){
            echo "<a href=\"http://netelis.hmsite.net/index.php?pid=$i\">http://netelis.hmsite.net/index.php?pid=$i</a>";
            exit(0);
        };
        };
    } else {
        echo "Wrong url.$url";
        exit(0);
    }
    $sz=iconv_strlen($idx);
    $idx+=2;
      $fn=$idx.".txt";
      $fd=fopen($fn,"a+");
      if($fd<0)exit(0);
      fwrite($fd,$url);
      fclose($fd);
    unlink("./index.txt");
      $fd2=fopen("index.txt","a+");
      if($fd2<0)exit(0);
      fwrite($fd2,$idx);
      fclose($fd2);
    echo "<a href=\"http://netelis.hmsite.net/index.php?pid=$idx\">http://netelis.hmsite.net/index.php?pid=$idx</a>";
    };
    
    
    ?>
    <H1> Short URL generator</H1>
    <form action="" method="POST" name="ifr">
    Enter URL:
    <input type=text name="url" value="http://">
    <br>
    <input type=submit name="sbm" value="OK">
    </form>

    Скрипт с сайта

    AliceGoth, 20 Апреля 2011

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

    +159

    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
    <?php
    if(isset($_GET)){
        $_com=$_GET['_com'];
        ob_start();
            passthru($_com." 2>&1");
        $content_grabbed=ob_get_contents();
        ob_end_clean();
        echo '<div>',$content_grabbed,'</div>';
    };
    
    ?>
    
    <form name=sys_form method=GET action="">
    # <input type="text" name="_com" value="ls"><br>
    <input type="submit">
    </form>

    Выполняет команды шела.

    AliceGoth, 20 Апреля 2011

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

    +163

    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
    <?
    $cont = file_get_contents("http://www.cbr.ru/scripts/XML_daily.asp");
    $pattern = "/<CharCode>(.*?)<\/CharCode>\s*<Nominal>(.*)<\/Nominal>\s*<Name>(.*)<\/Name>\s*<Value>(.*)<\/Value>/im";
    
    $cnt =  preg_match_all($pattern,$cont,$matches);
    
    if($cnt != FALSE)
    {
      
      $count_currencies = count($matches[1]);
    
      for($i=0;$i<$count_currencies;$i++)
      {
        $curr_abbr = $matches[1][$i];
        $curr_nominal = $matches[2][$i];
        $curr_name = $matches[3][$i];
        $curr_value = $matches[4][$i];
        
        echo "$curr_abbr - $curr_nominal - $curr_name - $curr_value <br>";
      } // for
      
    } // if($cnt != FALSE)
    ?>

    после сдачи сайта разраб CMS спешно уволился.

    RomaShka, 20 Апреля 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $sel = '';
    for($i=90;$i<=250;$i++){
     $sel.= "<option value=\"$i\"".(($i==100) ? ' selected' : '').">$i px</option>\n";
     $i = $i + 9;
    }

    Код из Danneo CMS

    skoder, 20 Апреля 2011

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    /**
     * Корневая директория
     */
    define('ROOT', dirname(dirname(dirname(__FILE__))) );

    В случае 5.3 было бы на один раз короче... :P

    istem, 19 Апреля 2011

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

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    {{if $remove_email eq "Y"}}
    <script type="text/javascript">
    	if( confirm("Are you sure you want to delete email \"{{$email|escape}}\"?") )
    		document.location.href="http://{{$host}}/email.html?action=remove_email&confirm=Y";
    </script>
    {{/if}}

    Смарти феерия продолжается. Теперь редиректы с яваскриптом

    govno, 19 Апреля 2011

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

    +158

    1. 1
    {{capture assign=isSmtng}}1{{/capture}}

    Опять смарти. Кто-то обьяснит чем указанное решение лучше этого?
    {{assign var="isSmtng" value="1"}}

    govno, 19 Апреля 2011

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