- 1
- 2
- 3
- 4
- 5
500 Internal Server Error
К сожалению, произошел какой-то сбой.
Бригада скорой помощи уже выехала по этому адресу.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+145
500 Internal Server Error
К сожалению, произошел какой-то сбой.
Бригада скорой помощи уже выехала по этому адресу.
+159
protected function paperSizeOrientationValidator(p_printpropertiesobj:Object):Boolean
{
var ret_val:Boolean = (p_printpropertiesobj.printJob.paperWidth == _printPaperTab.paperWidth * PRINT_DPI &&
p_printpropertiesobj.printJob.paperHeight == _printPaperTab.paperHeight * PRINT_DPI)
||
(p_printpropertiesobj.printJob.paperHeight == _printPaperTab.paperWidth * PRINT_DPI &&
p_printpropertiesobj.printJob.paperWidth == _printPaperTab.paperHeight * PRINT_DPI)
||
((p_printpropertiesobj.printJob.paperWidth > _paperPrintMarginLow * _printPaperTab.paperWidth * PRINT_DPI && p_printpropertiesobj.printJob.paperWidth < _paperPrintMarginHigh * _printPaperTab.paperWidth * PRINT_DPI) &&
(p_printpropertiesobj.printJob.paperHeight > _paperPrintMarginLow * _printPaperTab.paperHeight * PRINT_DPI && p_printpropertiesobj.printJob.paperHeight < _paperPrintMarginHigh * _printPaperTab.paperHeight * PRINT_DPI))
||
((p_printpropertiesobj.printJob.paperHeight > _paperPrintMarginLow * _printPaperTab.paperWidth * PRINT_DPI && p_printpropertiesobj.printJob.paperHeight < _paperPrintMarginHigh * _printPaperTab.paperWidth * PRINT_DPI) &&
(p_printpropertiesobj.printJob.paperWidth > _paperPrintMarginLow * _printPaperTab.paperHeight * PRINT_DPI && p_printpropertiesobj.printJob.paperWidth < _paperPrintMarginHigh * _printPaperTab.paperHeight * PRINT_DPI))
return ret_val;
}
This is actually ActionScript. An unknown former colleague was trying to "validate paper orientation" before sending the page to the printer...
+160
<?php
class Html {
static private $ShowSiblings; // Управляет отображением похожих категорий
static function Initialize($showSiblings) {
self::$ShowSiblings = $showSiblings;
}
static function SimpleLink($target, $text) { // Простая ссылка
return '<a href="'.$target.'">'.$text.'</a>';
}
static function CategorySiblingLink($targetCategory, $text) { // Формирует ссылку на похожую категорию
return '<a href="products.php?cat='.$targetCategory.'&page=1">'.$text.'</a>';
}
static function CategoryLink($targetCategory, $text) { // Формирует ссылку на указанную категорию
return '<a href="products.php?cat='.$targetCategory.'&page=1">'.$text.'</a>';
}
}
?>
Один из классов каталога продукции.
−853
Create Proc char32add1(
@char32 nvarchar(1) =Null,
@rez nvarchar(1) output,
@rez1 int=-1 output
)
As
Begin
if (@char32 is Null) return -1
Select @rez1=0
if (@char32 = "0") Begin Select @rez="1"
return 0 End
if (@char32 = "1") Begin Select @rez="2"
return 0 End
if (@char32 = "2") Begin Select @rez="3"
return 0 End
if (@char32 = "3") Begin Select @rez="4"
return 0 End
if (@char32 = "4") Begin Select @rez="5" return 0 End
if (@char32 = "5") Begin Select @rez="6" return 0 End
if (@char32 = "6") Begin Select @rez="7" return 0 End
if (@char32 = "7") Begin Select @rez="8" return 0 End
if (@char32 = "8") Begin Select @rez="9" return 0 End
if (@char32 = "9") Begin Select @rez="A" return 0 End
if (@char32 = "a" or @char32 = "A" ) Begin Select @rez="B" return 0 End
if (@char32 = "b" or @char32 = "B" ) Begin Select @rez="C" return 0 End
if (@char32 = "c" or @char32 = "C" ) Begin Select @rez="D" return 0 End
if (@char32 = "d" or @char32 = "D" ) Begin Select @rez="E" return 0 End
if (@char32 = "e" or @char32 = "E" ) Begin Select @rez="F" return 0 End
if (@char32 = "f" or @char32 = "F" ) Begin Select @rez="G" return 0 End
if (@char32 = "g" or @char32 = "G" ) Begin Select @rez="H" return 0 End
if (@char32 = "h" or @char32 = "H" ) Begin Select @rez="I" return 0 End
if (@char32 = "i" or @char32 = "I" ) Begin Select @rez="J" return 0 End
if (@char32 = "j" or @char32 = "J" ) Begin Select @rez="K" return 0 End
if (@char32 = "k" or @char32 = "K" ) Begin Select @rez="L" return 0 End
if (@char32 = "l" or @char32 = "L" ) Begin Select @rez="M" return 0 End
if (@char32 = "m" or @char32 = "M" ) Begin Select @rez="N" return 0 End
if (@char32 = "n" or @char32 = "N" ) Begin Select @rez="O" return 0 End
if (@char32 = "o" or @char32 = "O" ) Begin Select @rez="P" return 0 End
if (@char32 = "p" or @char32 = "P" ) Begin Select @rez="Q" return 0 End
if (@char32 = "q" or @char32 = "Q" ) Begin Select @rez="R" return 0 End
if (@char32 = "r" or @char32 = "R" ) Begin Select @rez="S" return 0 End
if (@char32 = "s"or @char32 = "S" ) Begin Select @rez="T" return 0 End
if (@char32 = "t" or @char32 = "T" ) Begin Select @rez="U" return 0 End
if (@char32 = "u" or @char32 = "U" ) Begin Select @rez="V" return 0 End
Select @rez1=1
if (@char32 = "v" or @char32 = "V" ) Begin Select @rez="0" return 1 End
End
−105
def show
@updates = UpdateList.new
update_id = params[:update_id]
if 'twitter' == @provider_key
provider_api = ProviderApi::Twitter.new(current_user)
if update_id.present?
begin
benchmark(" Twitter API: status") do
@api_response = provider_api.status(update_id)
end
@update = update = SocialUpdate.from_twitter_response(@api_response, true)
while update && (in_reply_to = update.in_reply_to_update_id)
benchmark(" Twitter API: status") do
@previous_status = provider_api.status(in_reply_to)
end
if error = @previous_status['error']
@updates << SocialUpdate.from_twitter_error(error)
break
else
update = SocialUpdate.from_twitter_response(@previous_status, true)
@updates << update
end
end
rescue => e
logger.info("Error in fetching status #{in_reply_to || update_id}: #{e}")
end
end
end
@update.flag_for_user(current_user) if @update
@updates.flag_for_user(current_user)
end
+143
void crash()
{
(( void(*)() )0)();
}
Crash ;]
−111
if(selectedLanguage==French)
{
FinalString = [[NSString alloc] initWithFormat:@"http://www.xyz.com/api_com.php?page_id=%d",IDValue];
url = [[NSURL alloc] initWithString:FinalString];
}
else if(selectedLanguage==German)
{
FinalString = [[NSString alloc] initWithFormat:@"http://www.x.com/api_com.php?page_id=%d",IDValue];
url = [[NSURL alloc] initWithString:FinalString];
}
else if(selectedLanguage==Nepali)
{
FinalString = [[NSString alloc] initWithFormat:@"http://www.xy.com/api_com.php?page_id=%d",IDValue];
url = [[NSURL alloc] initWithString:FinalString];
}
−116
--Если идентификатор аккаунта не передан возвращаем NULL
IF @AccountID <= 0 OR @AccountID IS NULL RETURN 3;
--Для администраторов всегда возвращаем NULL
IF @Role = 'admin' OR @Role = 'super_admin' RETURN 3;
Тело одной из хранимых процедур. Комментарии, видать, протухли.
+161
class OnBeginRequest
{
public static function run( CEvent $event )
{
Order::model()->onOrderCreate = function( Cevent $event ) {};
}
}
Cервис на yii framework. Какой сакральный смысл заложен, неизвестно. Скорее всего, какой-то невероятной крутости костыль, типа не срабатывало событие.
+161
// mysql_affected_rows порядка 200 записей
while ($row_ex=mysql_fetch_array($res_ex)){
$e_arr[trim(strtoupper($row_ex[0]))] = $row_ex[1];
$exc .= "(".preg_replace("/(\*|\+|\(|\))/","\\\\$0",$row_ex[0])."(\ |\,|\<|\n|\.)+)|";
}
if ($exc){
preg_match_all("/(".$exc.")(?!<\/a>)/i",$Tour['info'],$maches);
$mach=array_unique($maches[0]);
unset($maches);
foreach ($mach as $e_name){
$last_c=substr($e_name,-1);
if ($last_c=="<" || $last_c=="," || $last_c==".") $e_name = substr($e_name,0,-1);
if ($e_name[trim(strtoupper($e_name))])
$Tour['info'] = preg_replace("/$e_name(?!.?<\/a>)/","<a href='".$e_arr[trim(strtoupper($e_name))]."\.html'>".$e_name."<\/a>",$Tour['info']);
}
preg_match_all("/(".$exc.")(?!<\/a>)/i",$Tour['info1'],$maches);
$mach=array_unique($maches[0]);
unset($maches);
foreach ($mach as $e_name){
$last_c=substr($e_name,-1);
if ($last_c=="<" || $last_c=="," || $last_c==".") $e_name = substr($e_name,0,-1);
$e_arr[trim(strtoupper($e_name))]."\.html'>".$e_name."<\/a>",$Tour['info1']);
}
preg_match_all("/(".$exc.")(?!<\/a>)/i",$Tour['info2'],$maches);
$mach=array_unique($maches[0]);
unset($maches);
foreach ($mach as $e_name){
$last_c=substr($e_name,-1);
if ($last_c=="<" || $last_c=="," || $last_c==".") $e_name = substr($e_name,0,-1);
$e_arr[trim(strtoupper($e_name))]."\.html'>".$e_name."<\/a>",$Tour['info2']);
}
preg_match_all("/(".$exc.")(?!<\/a>)/i",$Tour['shedulle'],$maches);
$mach=array_unique($maches[0]);
unset($maches);
foreach ($mach as $e_name){
$last_c=substr($e_name,-1);
if ($last_c=="<" || $last_c=="," || $last_c==".") $e_name = substr($e_name,0,-1);
}
}
http://govnokod.ru/7602 "Регулярки? Да, слышал!"
Итого + 8-10 секунд на исполнение.