- 1
- 2
- 3
- 4
- 5
static $badwords = array(
...
'(?<=[_\d]) [гg]_?[оo]_?[вvb]_?[нnh]_?[оoаaяеeyу]', #говн[оаяеу]
...
);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+158.9
static $badwords = array(
...
'(?<=[_\d]) [гg]_?[оo]_?[вvb]_?[нnh]_?[оoаaяеeyу]', #говн[оаяеу]
...
);
самый дословный (мета-)говнокод.
из censure.php -- Функция пытается определить наличие мата (нецензурных, матерных слов) в html-тексте.
http://forum.dklab.ru/viewtopic.php?t=17146
+158.9
Нашел в одном индусском скрипте мега аплоадер хендлер
if($_FILES["attach1e"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach1e"]["name"]);
copy ($_FILES['attach1e']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$_POST[pid].'-attach1e.'.$file_details['extension']);
}
if($_FILES["attach2"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach2"]["name"]);
copy ($_FILES['attach2']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach2.'.$file_details['extension']);
}
if($_FILES["attach3"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach3"]["name"]);
copy ($_FILES['attach3']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach3.'.$file_details['extension']);
}
if($_FILES["attach4"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach4"]["name"]);
copy ($_FILES['attach4']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach4.'.$file_details['extension']);
}
if($_FILES["attach5"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach5"]["name"]);
copy ($_FILES['attach5']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach5.'.$file_details['extension']);
}
if($_FILES["attach6"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach6"]["name"]);
copy ($_FILES['attach6']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach6.'.$file_details['extension']);
}
if($_FILES["attach7"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach7"]["name"]);
copy ($_FILES['attach7']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach7.'.$file_details['extension']);
}
if($_FILES["attach8b"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach8b"]["name"]);
copy ($_FILES['attach8b']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$_POST[pid].'-attach8b.'.$file_details['extension']);
}
+158.9
array('entity' => $friend, 'size' => 'tiny')
Не говонокод, но смешно.
+158.9
if(this.o)
{
if((cur=='1')||(cur=='2'))cur='2';
if((cur=='3')||(cur=='4'))cur='4';
if((cur=='5')||(cur=='6'))cur='6';
if((cur=='7')||(cur=='8'))cur='8';
};
/*
Ну а чувакам пИсавшим эту функциию, посвящается:
*/
if(cur & 1)
++cur;
Фрагмент кода из CMS Bitrix 7
+158.9
if ($category) {$zapros="where category='$category'"; $f[1]=1;}
if ($group) {
//тут $row получает этот индус...
if ($f[1]==1) {$zapros.=" and idu='$row[0]'";}
else {$zapros="where idu='$row[0]'";}
$f[2]=1;
}
if ($type) {
if (($f[1]==1)||($f[2]==1)) {$zapros.=" and type='$type'";}
else {$zapros="where type='$type'";}
$f[3]=1;
}
if ($format) {
if (($f[1]==1)||($f[2]==1)||($f[3]==1)) {$zapros.=" and format='$format'";}
else {$zapros="where format='$format'";}
$f[4]=1;
}
if ($curlang) {
if (($f[1]==1)||($f[2]==1)||($f[3]==1)||($f[4]==1)) {$zapros.=" and (lang='$curlang' or lang='all')";}
else {$zapros="where (lang='$curlang' or lang='all')";}
$f[5]=1;
}
Охеренный способ составления запроса
+158.8
// PRIVACY LEVEL OPTIONS
function winks_privacy_levels($privacy_level) {
global $database, $functions_general, $functions_winks;
$lang_query = $database->database_query("SELECT languagevar_value FROM se_languagevars WHERE languagevar_id = 14000105");
$lang_array = Array();
while($item = $database->database_fetch_assoc($lang_query)) {$case0 = $item[languagevar_value];}
$lang_query = $database->database_query("SELECT languagevar_value FROM se_languagevars WHERE languagevar_id = 14000106");
$lang_array = Array();
while($item = $database->database_fetch_assoc($lang_query)) {$case1 = $item[languagevar_value];}
$lang_query = $database->database_query("SELECT languagevar_value FROM se_languagevars WHERE languagevar_id = 14000107");
$lang_array = Array();
while($item = $database->database_fetch_assoc($lang_query)) {$case2 = $item[languagevar_value];}
switch($privacy_level) {
case 0: $privacy = $case0; break;
case 1: $privacy = $case1; break;
case 2: $privacy = $case2; break;
default: $privacy = ""; break;
}
return $privacy;
}
// WINKS ENABLED
function winks_enabled(){
global $database;
$winks_query = $database->database_query("SELECT * FROM sp_winks_settings");
$winks_array = Array();
while($item = $database->database_fetch_assoc($winks_query)) {
$winks_enabled = $item[enabled];
}
return $winks_enabled;
}
С первой функцией я так и не понял что автор хотел сделать
Ну а про вторую мне вообще нечего сказать :)
+158.8
$fStr = fgets($fp);
if ($k==0 && $IsFirst)
continue;
$arLine = explode(";", $fStr);
$type = intval($arLine[0]);
$articul = trim($arLine[1]);
$section_id = intval($arLine[2]);
$model = trim($arLine[3]);
$name = trim($arLine[4]);
$brand = trim($arLine[5]);
$width = trim($arLine[6]);
$radius = trim($arLine[7]);
$pcd = trim($arLine[8]);
$et = trim($arLine[9]);
$dia = trim($arLine[10]);
$dop = trim($arLine[11]);
$color = trim($arLine[12]);
//и чуть позже
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 38, 'S', '".$articul."', null, '')";
$res = SQLResult($query);
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 25, 'L', '', ".$type.", '')";
$res = SQLResult($query);
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 17, 'S', '".$width."', null, '')";
$res = SQLResult($query);
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 18, 'S', '".$radius."', null, '')";
$res = SQLResult($query);
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 19, 'S', '".$pcd."', null, '')";
$res = SQLResult($query);
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 20, 'S', '".$et."', null, '')";
$res = SQLResult($query);
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 45, 'S', '".$dia."', null, '')";
$res = SQLResult($query);
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 21, 'S', '".$color."', null, '')";
$res = SQLResult($query);
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 22, 'S', '0', null, '')";
$res = SQLResult($query);
$query = "INSERT INTO ".$dbCatalogElProp." VALUES (null, ".$element_id.", 23, 'S', '', null, '')";
$res = SQLResult($query);
+158.8
function h_circle_1_view() {
document.getElementById("circle_1").style.display = "block";
document.getElementById("circle_2").style.display = "none";
document.getElementById("circle_3").style.display = "none";
document.getElementById("circle_4").style.display = "none";
document.getElementById("circle_5").style.display = "none";
}
function h_circle_1_none() {
document.getElementById("circle_1").style.display = "none";
}
function h_circle_2_view() {
document.getElementById("circle_1").style.display = "none";
document.getElementById("circle_2").style.display = "block";
document.getElementById("circle_3").style.display = "none";
document.getElementById("circle_4").style.display = "none";
document.getElementById("circle_5").style.display = "none";
}
function h_circle_2_none() {
document.getElementById("circle_2").style.display = "none";
}
function h_circle_3_view() {
document.getElementById("circle_1").style.display = "none";
document.getElementById("circle_2").style.display = "none"; // прячем 1, 2
document.getElementById("circle_3").style.display = "block"; // показываем 3
document.getElementById("circle_4").style.display = "none";
document.getElementById("circle_5").style.display = "none";
}
function h_circle_3_none() {
document.getElementById("circle_3").style.display = "none";
}
function h_circle_4_view() {
document.getElementById("circle_1").style.display = "none";
document.getElementById("circle_2").style.display = "none";
document.getElementById("circle_3").style.display = "none"; // прячем 1, 2
document.getElementById("circle_4").style.display = "block"; // показываем 3
document.getElementById("circle_5").style.display = "none";
}
function h_circle_4_none() {
document.getElementById("circle_4").style.display = "none";
}
function h_circle_5_view() {
document.getElementById("circle_1").style.display = "none";
document.getElementById("circle_2").style.display = "none";
document.getElementById("circle_3").style.display = "none"; // прячем 1, 2
document.getElementById("circle_4").style.display = "none"; // показываем 3
document.getElementById("circle_5").style.display = "block";
}
function h_circle_5_none() {
document.getElementById("circle_5").style.display = "none";
}
Натолкнулся вот при тестировании одного проекта
+158.8
$col=array('red','blue','green','black','yellow','magenta','blue','gray','red','blue','green','black','yellow','blue','gray','red','blue','green','black','yellow','blue','gray');
А какие ты знаешь цвета?
+158.7
if (isset($message)) {
$message = nl2br($message);
$message = str_replace("<br />","<br>",$message);
$message = str_replace("<BR />","<BR>",$message);
$message = str_replace("[u]","<u>",$message);
$message = str_replace("[U]","<u>",$message);
$message = str_replace("[i]","<i>",$message);
$message = str_replace("[I]","<i>",$message);
$message = str_replace("[b]","<B>",$message);
$message = str_replace("[B]","<B>",$message);
$message = str_replace("[/u]","</u>",$message);
$message = str_replace("[/U]","</u>",$message);
$message = str_replace("[/i]","</i>",$message);
$message = str_replace("[/I]","</i>",$message);
$message = str_replace("[/b]","</B>",$message);
$message = str_replace("[/B]","</B>",$message);
}