1. Список говнокодов пользователя daniser

    Всего: 3

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

    −3

    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
    function formSelect($itxt, $name = '', $val = array(), $selected = 0, $data = 0, $nullF = false, $atr = '', $optatr = array()) {
    	if(is_array($selected)) { $atr .= ' multiple'; }
    	$html = '<select  name="'.$name.'" '.$atr.">\r\n";
    	if($nullF) {
    		$t = ($nullF === true) ? ' ' : $nullF;
    		$html .= '<option value="0">'.$t.'</option>'; }
    	if($data == 3) { $start = $itxt; $count = $val[0]; $step = $val[1]; }
    	else { $count = count($itxt); }
    	for($i = 0; $i < $count; $i++) {
    			// 4 - для быза данных
    		switch($data) {
    			case 1: $key = $val[$i]; $txt = $itxt[$i]; break;
    			case 2: $key = $i; $txt = $itxt[$i]; break;
    			case 3: $txt = $key = ($start + ($step*$i)); break;
    			case 4: $key = $itxt[$i][$val[0]]; $txt = $itxt[$i][$val[1]]; break;
    			default: $key = $txt = $itxt[$i]; break;
    		}
    		$sel = '';
    		if(is_array($selected)) {
    			if(in_array($key, $selected)) { $sel = 'selected'; }
    		} elseif($selected == $key) { $sel = 'selected'; }
    		if(!empty($optatr[$i])) { $opt = $optatr[$i]; } else { $opt = ''; }
    		$html .= '<option value="'.$key.'" '.$sel.$opt.'>'.$txt."</option>\r\n";
    	}
    	$html .= "</select>\r\n";
    	return $html;
    }

    Теперь бызить вореции как никогда просто!

    daniser, 19 Июля 2016

    Комментарии (2)
  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 / Говнокод #20297

    +2

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

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

    daniser, 30 Июня 2016

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