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

    Всего: 5

  2. Ruby / Говнокод #17095

    −82

    1. 1
    2. 2
    3. 3
    4. 4
    @old_article_purchase.old_article.warehouse_placement = '102A1'
    if @old_article_purchase.old_article.valid?
       @old_article_purchase.old_article.save   
     end

    andrejlr, 12 Ноября 2014

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

    −136

    1. 1
    2. 2
    3. 3
    4. 4
    it 'traders email should be nil' do
       trader = FactoryGirl.create(:trader, :email => nil)
       trader.email.should be nil
    end

    captain obvious test

    andrejlr, 28 Мая 2014

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

    +165

    1. 1
    echo str_repeat('<br />', 25);

    Делаем правильные отступы

    andrejlr, 27 Октября 2011

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

    +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
    72. 72
    73. 73
    74. 74
    75. 75
    <tbody>
    		<script type="application/json">
    		{
    			"remoteURL" : "/index.php?module=User&controller=Ajax_Group",
    			"saveState" : true,
    			"browseable":
    			{
    				"entriesTotal": {$amountGroups},
    				"entriesPage": {$itemsPerPage},
    				"activePage": {$activePage}
    			},
    			"columns":
    			{
    				"title":
    				{
    					"dataType": "string"
    				},
    				"description":
    				{
    					"dataType": "string"
    				}
    			},
    			"searchable":
    			{
    				"searchCols": [ "title", "description" ],
    				"activeSearch": "{addcslashes( $searchTerm, '"' )}",
    				"minSearchLength" : {$searchMinWordLength}
    			},
    			"sortable":
    			{
    				"sortCols": [ "title", "description" ],
    				"activeCol":
    				{
    					"column": "{$sortColumn}",
    					"sortDir" : "{$sortDirection}"
    				}
    			},
    			"clickable":
    			{
    				"defaultAction": [ "{Common_Image_Icon_Ajax::EDIT}" ]
    			}
    		}
    		</script>
    		{foreach $Groups as $Group}
    		{$group_id = $Group->getGroup_Id()}
    		<tr>
    			{if $rightToExport}
    			<td class="selector"><input type="checkbox" name="checkedGroups[]" value="{$group_id}"></td>
    			{/if}
    			<td>{$Group->escapeTitle()}</td>
    			<td>{$Group->escapeDescription()}</td>
    			{if $rightEdit || $rightDelete || $rightMail}
    			<td class="actions">
    				{Common_Image_Icon_Overlay::fetchIcon(Common_Image_Icon::EDIT, _( 'Edit' ), Common_Http_Query::fetch( ['module' => 'User', 'controller' => 'Overlay_Group', 'action' => 'edit', 'id' => $Group->getGroup_Id()] ))}
    
    				{if $rightDelete}
    				{$sql = "SELECT assessment_id FROM cobit_assessments WHERE usergroup_id = {$Group->getGroup_Id()} LIMIT 0,1"}
    				{$MySqlI = DatabaseConnector::getConnector()}
    				{$Result = $MySqlI->query( $sql )}
    				{if !( is_object( $Result ) and $Result->getNumRows() > 0 )}
    				{Common_Image_Icon_Ajax::fetchDelete( _( 'Delete' ), _( 'Do you really want to delete this Group?' ), Common_Http_Query::fetch( ['module' => 'User', 'controller' => 'Ajax_Group', 'action' => 'delete', 'id' => $Group->getGroup_Id()] ), $Group->getGroup_Id() )}
    				{else}
    				{Common_Image_Icon::fetchIcon(Common_Image_Icon::INFO, _("User Group is not deletable, because it is in use."))}
    				{/if}
    				{/if}
    
    				{if $rightMail}
    				{$sJavaScriptAction = Common_Event_Trigger_Overlay::fetch( Common_Event_Trigger_Overlay::OPEN, [ 'url' => "/index.php?module=User&controller=Overlay_Group&action=sendGroupMail&id={$Group->getGroup_Id()}"] )}
    				{Common_Image_Icon_Ajax::fetchIcon( Common_Image_Icon_Ajax::EMAIL, _('Send mail'), $sJavaScriptAction)}
    				{/if}
    			</td>
    			{/if}
    		</tr>
    		{/foreach}
    	</tbody>

    Smarty Ajax SQL Table
    Как все таки вставить SQL в Smarty.

    andrejlr, 14 Октября 2011

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

    +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
    $sql = "SELECT aps.* FROM apps_applicationinterfaceincoming aps
    WHERE aps.applicationid = '$id' ORDER BY aps.name ASC";
                           $Result = $Database->query( $sql );
                           foreach( $Result as $aResult )
                           {
                                   $editIcon = Common_Image_Icon_Overlay::fetchIcon(
    Common_Image_Icon_Overlay::EDIT, _('Edit interface' ),
    '/apps/serveroverlay.php?table=apps_applicationinterfaceincoming&edit=1&mode='.AppsEnvironment::iVIEWMODE_EDIT.'&id='.$aResult['id']
    );
                                   $deleteIcon = Common_Image_Icon_Ajax::fetch(
    Common_Image_Icon_Ajax::DELETE, array( 'aLinkAttributes' => array(
    'onclick' => "new Browser.Http.Ajax.Updater( '#interfacein',
    '/apps/interfacein_ajax.php?action=remove&id={$aResult['id']}' );" ) )
    );
                                   $html .= <<<EOF
                                                   <tr>
                                                           <td>{$aResult['name']}</td>
                                                           <td>{$aResult['frequency_data_transfers']}</td>
                                                           <td>{$aResult['type_of_interface']}</td>
                                                           <td>{$aResult['internal_external']}</td>
                                                           <td>{$aResult['description']}</td>
                                                           <td class="actions">{$editIcon} {$deleteIcon}</td>
                                                   </tr>
    EOF;
                           }
                           $html .= <<<EOF
                                           </tbody>
                                   </table>
                           </fieldset>
    EOF;

    PHP Bestpractice php + sql + html + js in one file
    или даэже in one String.

    ... 800 строк в том же духе. (толко в етом файле)

    andrejlr, 10 Октября 2011

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