- 1
UniqueNamesTableUtils.putPortletRequestIntoResourceRecordLazyLoadAdminTableModelInSession(portletrequest);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+92.2
UniqueNamesTableUtils.putPortletRequestIntoResourceRecordLazyLoadAdminTableModelInSession(portletrequest);
Это IBM WebSphere Portal 6.0 - код является частью портлета, отвечающего за управление объектами портала (административный интерфейс).
+107.8
string status = ProcessData("db1");
if (status == "ERROR") goto ErrorOccured;
status = ProcessData("db2");
if (status == "ERROR") goto ErrorOccured;
status = ProcessData("db3");
if (status == "ERROR") goto ErrorOccured;
if (status == "OK") goto NoError;
ErrorOccured:
tran.Rollback();
return status;
NoError:
tran.Commit()
пятница однако... :)
вот "обнаружил" кодЪ (не забываем, что C#)::
чем товарищЪ думал, трудно понять...
+152
public function step($step = 1)
{
switch ( $step )
{
case 1 :
return $this->step1();
break;
/*
case 2 :
return $this->step2();
break;
case 3 :
return $this->step3();
break;
case 4 :
return $this->step4();
break;
case 11 :
return $this->step11();
break;
*/
default :
return $this->step1();
break;
}
}
^%)
+137.7
foreach ($_pp as $k => $v){
if ($v['qty'] == $_pp[$i*count($groups)]['qty']){
$qtys[$i][]=$v;
}
За такое надо кромсать
+118.6
boolean b;
// ....
switch (b)
{
case true: // ....
case false: // .....
default: // (!) тут был код, и он отличался от предыдущих двух пунктов!
}
автор кода - какой-то индус. это не копипаст, но смысл передан верно
+147
var _U = "undefined";
if (blabla == _U)
var obj = {
'init': function (){o=this;o.param=true},
'somefunction': function (){return o.param;}
}
Пара примеров обфускации.
+143.1
function ExportExcel(boolean forceComplete)
{
if (forceComplete){
var oXML = document.createElement('XML');
if (document.getElementById('ExportExcel') != null)
document.body.removeChild(document.getElementById('ExportExcel'));
var URL = 'ExportExcelHandler.ashx?taskID=' + document.getElementById("hTaskId").value +
'&guids=' + document.getElementById("hSelIds").value
oXML.src = URL;
document.body.appendChild(oXML);
oXML.ondatasetcomplete = showExcelFile;
} else {
setTimeout("ExportExcel(true);", 100);
}
}
суровый аякс :) ждем 100 миллисекунд и считаем, что документ загрузился)
+144.1
... and p.products_group_access like '%,". $customer_group_id.",%'
OR
p.products_group_access like '%,". $customer_group_id."'
OR
p.products_group_access like '". $customer_group_id.",%'
OR
p.products_group_access = '". $customer_group_id."')";
REGEXP уже не рулят
+154
function query_safe()
{
$time_before = $this->get_real_time();
if(!$this->connected) $this->connect(DBUSER, DBPASS, DBNAME, DBHOST);
$args = func_get_args();
$tmpl =& $args[0];
$tmpl = str_replace("%", "%%", $tmpl);
$tmpl = str_replace("?", "%s", $tmpl);
foreach ($args as $i=>$v) {
if(!$i) continue;
if(is_int($v)) continue;
$args[$i] = "'".mysql_escape_string($v)."'";
}
for($i=$c=count($args)-1; $i<$c+20; $i++)
$args[$i+1] = "UNKNOWN_SQL_COMMAND_$i";
$sql = call_user_func_array("sprintf", $args);
//echo $sql;
exit;
if(!($this->query_id = mysql_query($sql, $this->db_id) )) {
$this->mysql_error = mysql_error();
$this->mysql_error_num = mysql_errno();
if($show_error) {
$this->display_error($this->mysql_error, $this->mysql_error_num, $query);
}
}
$this->MySQL_time_taken += $this->get_real_time() - $time_before;
$this->query_num ++;
return $this->query_id;
}
Что же тут творится?? :)))
+151.5
function custom_print ($custom_category, $custom_template, $aviable, $custom_from, $custom_limit, $custom_cache, $do){
global $db, $is_logged, $member_id, $xf_inited, $cat_info, $config, $user_group, $category_id, $_TIME, $lang;
$do = $do ? $do : "main";
$aviable = explode ('|', $aviable);
if(!(in_array($do, $aviable)) AND ($aviable[0] != "global")) return "";
$custom_category = $db->safesql(str_replace(',', '|', $custom_category));
$custom_from = intval($custom_from);
$custom_limit = intval($custom_limit);
$thisdate = date ("Y-m-d H:i:s", (time()+ $config['date_adjust']*60));
if (intval($config['no_date'])) $where_date = " AND date < '".$thisdate."'"; else $where_date = "";
$tpl = new dle_template;
$tpl->dir = TEMPLATE_DIR;
//if ($custom_cache == "yes") $config['allow_cache'] = "yes"; else $config['allow_cache'] = false;
if ($is_logged AND ($user_group[$member_id['user_group']]['allow_edit'] AND !$user_group[$member_id['user_group']]['allow_all_edit'])) $config['allow_cache'] = false;
$content = dle_cache("custom", "cat_".$custom_category."template_".$custom_template."from_".$custom_from."limit_".$custom_limit, true);
if ($content) { return $content; }
else {
$allow_list = explode (',', $user_group[$member_id['user_group']]['allow_cats']);
if ($allow_list[0] != "all") {
if ($config['allow_multi_category']) {
$stop_list = "category regexp '[[:<:]](".implode ('|', $allow_list).")[[:>:]]' AND ";
} else {
$stop_list = "category IN ('".implode ("','", $allow_list)."') AND ";
}
} else $stop_list = "";
if ($user_group[$member_id['user_group']]['allow_short']) $stop_list = "";
if ($cat_info[$custom_category]['news_sort'] != "") $config['news_sort'] = $cat_info[$custom_category]['news_sort'];
if ($cat_info[$custom_category]['news_msort'] != "") $config['news_msort'] = $cat_info[$custom_category]['news_msort'];
if ($config['allow_multi_category']) {
$where_category = "category regexp '[[:<:]](".$custom_category.")[[:>:]]'";
} else {
$custom_category = str_replace ("|", "','", $custom_category);
$where_category = "category IN ('".$custom_category."')";
}
$sql_select = "SELECT " . PREFIX . "_post.id, gallery, autor, date," . PREFIX . "_post.image," . PREFIX . "_post.imgtype, short_story, full_story, " . PREFIX . "_post.xfields, title, category, alt_name, " . PREFIX . "_post.comm_num, " . PREFIX . "_post.allow_comm, allow_rate, " . PREFIX . "_post.rating, " . PREFIX . "_post.vote_num, news_read, " . PREFIX . "_post.flag, " . PREFIX . "_users.fullname FROM " . PREFIX . "_post , " . PREFIX . "_users WHERE " . PREFIX . "_post.autor=" . PREFIX . "_users.name and ".$stop_list.$where_category." AND approve = '1'".$where_date." ORDER BY ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$custom_from.",".$custom_limit;
//echo $sql_select;
include (ENGINE_DIR.'/modules/show.custom.php');
if ($config['files_allow'] == "yes")
if ( strpos( $tpl->result['content'], "[attachment=" ) !== false)
{
$tpl->result['content'] = show_attach($tpl->result['content'], $attachments);
}
create_cache("custom", $tpl->result['content'], "cat_".$custom_category."template_".$custom_template."from_".$custom_from."limit_".$custom_limit, true);
}
return $tpl->result['content'];
}
Не пишите так функции, пожалейте того, кто будет ее поддерживать после вас.