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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    ...
    </tr>
    </tbody>
    <?  if($color == "#ffffff") 
              $color = "#ffffff"; 
          else 
              $color = "#ffffff";  
    ?>
    </table>

    Гений блин... Правда так и не понятно что хотелось этим сказать...

    vahminator, 24 Февраля 2012

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

    +155

    1. 1
    2. 2
    3. 3
    $pathToAction = str_replace("\\", "/", $pathToAction);
    while (substr($pathToAction, strlen($pathToAction) - 1, 1) == "/")
        $pathToAction = substr($pathToAction, 0, strlen($pathToAction) - 1);

    nikita2206, 24 Февраля 2012

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

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    function unbb($str)
    {
    	return preg_replace('#\[(.*?)\]#ui', '', preg_replace('#\[(.*?)\](.*?)\[\/(.*?)\]#ui', '', $str));
    }

    varg242, 24 Февраля 2012

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

    +154

    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
    $query = rawurldecode(A::get('query'));
    $maps = strtolower($query);
    $maps_array = array();
    
    // cs_assault,"de_dust",de_inferno
    $map = strtok($maps, ',');
    
    do
    {
    	$map = trim($map);
    	
    	// если экранирование кавычками то искать точное совпадение, пример: "de_dust"
    	if(preg_match('/^"(.*)"$/', $map, $match_map))
    	{
    		$map = mysql::safe(end($match_map));
    		$maps_array[] = "map = '".$map."'";
    	}
    	else
    	{
    		$maps_array[] = "map LIKE '%".mysql::safe($map)."%'";
    	}
    	
    } while($map = strtok(','));
    
    mysql::query("SELECT * FROM servers WHERE status=1 ".join(" OR ", $maps_array));

    Zend, 23 Февраля 2012

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $comment_msg=$row['comm'];
    $comment_msg=cuthtml($comment_msg);
    $comment_msg=cutbb($comment_msg);
    $comment_msg=wordwrap($comment_msg, 10, " ", 1);
    $comment_msg=viewworld($comment_msg,4).$massparam['lastend'];

    Один фрагмент из кучки говнокода, относительно популярного скрипта комментариев commentit

    dayw, 23 Февраля 2012

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

    +172

    1. 1
    2. 2
    if ( is_int(intval($_GET['y'])) ) {
      //...

    Lowezar, 22 Февраля 2012

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

    +177

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    public static function textCorrections($text)
        {
            $text=str_replace("Ų", "Ø", $text);
            $text=str_replace("? фаски", "Ø фаски", $text);
            $text=str_replace("? отверстия", "Ø отверстия", $text);
            $text=str_replace("рем?нного", "ремённого", $text);
            return $text;
        }

    Вот такая заплатка для текстов в фомате UTF-8.

    Edd, 22 Февраля 2012

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

    +168

    1. 1
    2. 2
    3. 3
    $isHttp = $_tumbpath[0] == 'h' && $_tumbpath[1] == 't' && $_tumbpath[2] == 't' && $_tumbpath[3] == 'p';
    
    if ($isHttp){...}

    хорошо еще, что слово - http :)

    unVooDoo, 22 Февраля 2012

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

    +155

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public function get_included_js () 
     {
         if (count($this->included_js)) {
             return "\r\n".'<script type="text/javascript" src="'
             .implode('"></script>'."\r\n".'<script type="text/javascript" src="', $this->included_js)
             .'"></script>'."\r\n";
         } else {
             return '';
         }
     }

    Разгребаю чужой проект. Может быть чего-то не понимаю в этой жизни.

    zii, 22 Февраля 2012

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

    +160

    1. 1
    2. 2
    $v2 = str_replace('\"', '"', $v2);
    $v2 = str_replace("\'", "'", $v2);

    no comments

    englandpost, 22 Февраля 2012

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