- 1
- 2
- 3
- 4
- 5
- 6
- 7
for (conn_vector::iterator i = m_connections.begin(); i != m_connections.end(); ++i) {
if (*i == conn) {
toDelete = *i;
m_connections.erase(i);
break;
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
for (conn_vector::iterator i = m_connections.begin(); i != m_connections.end(); ++i) {
if (*i == conn) {
toDelete = *i;
m_connections.erase(i);
break;
}
}
Да, С++98. Да, в std::find не умеем. Да, сегфолт. Да, моё.
+135
try
{
HttpWebRequest httpWebReq = (HttpWebRequest)WebRequest.Create(this.OURURL);
httpWebReq.Timeout = 2000;
httpWebReq.Method = "POST";
string Response = ResponseStreamReader.ReadToEnd();
// bla-bla-bla ...
httpWebReq.GetResponse().Close();
httpWebReq = null;
Response = null;
}
+164
.error(function(error) {
sendResult(500, "ERROR. " + error);
})
})
.error(function(error) {
sendResult(500, "ERROR. " + error);
})
})
.error(function(error) {
sendResult(500, "ERROR. " + error);
})
})
.error(function(error) {
sendResult(500, "ERROR. " + error);
});
})
.error(function(error) {
sendResult(500, "ERROR. " + error);
});
})
.error(function(error) {
sendResult(500, "ERROR. " + error);
});
})
.error(function(error) {
sendResult(500, "ERROR. " + error);
});
+154
function parseString($str) {
$op = array();
$pairs = explode("&", $str);
foreach ($pairs as $pair) {
list($k, $v) = array_map("urldecode", explode("=", trim($pair)));
$op[$k] = $v;
}
return $op;
}
if (!isset($HTTP_RAW_POST_DATA))
{
$HTTP_RAW_POST_DATA = file_get_contents("php://input");
}
И это уже не в первый раз. А когда надо отправить форму, то php-шники делают это через raw socket.
+155
jQuery(document).ready(function($) {
var url=document.location.href;
$.each($(".menu a"),function(){
if(this.href==url){$(this).addClass('activetopmenu');};
});
});
И это при том, что для генерации страниц используется php...
+154
/*
* BANERS
*/
$IMG="<div class=\"tovMain\" id=\"bnList1_imgBlock\"></div>
<script type=\"text/javascript\">
var bnList1_images=[";
$banerId=$res->show1Var("s_rzd","page='".PAGE_BANER."'","id");
$imgPreRes=$res->showTabAsPage("s_cnt","rzdId='".$banerId."' AND image>'' AND `show`='Y'","image","id",0);
foreach($imgPreRes as $imgRes){
$IMG.="'{ROOTPATH}images/".$imgRes["image"]."',";
}
$IMG=substr($IMG,0,-1);
$IMG.="];
var bnList1_old_image='';
var bnList1_x=10;
var bnList1_y=3;
var bnList1_mercaniy=2;
var bnList1_speed=500;
var bnList1_speed1=800;
var bnList1_w=Math.round(document.getElementById(\"bnList1_imgBlock\").offsetWidth/bnList1_x);
var bnList1_h=Math.round(document.getElementById(\"bnList1_imgBlock\").offsetHeight/bnList1_y);
var tek=0;
bnList1Listing(bnList1_images[tek]);
setInterval(\"tek=(bnList1_images.length>(tek+1)?tek+1:0);bnList1Listing(bnList1_images[tek]);\",5000);
for(var i=1;i<=bnList1_x;i++){
for(var j=1;j<=bnList1_y;j++){
bnList1CreateBlocks(\"bnList1_block_\"+i+\"_\"+j+\"_1\",bnList1_w,bnList1_h,bnList1_w*(i-1),bnList1_h*(j-1));
bnList1CreateBlocks(\"bnList1_block_\"+i+\"_\"+j+\"_2\",bnList1_w,bnList1_h,bnList1_w*(i-1),bnList1_h*(j-1));
}
}
</script>";
/*$rndBanerId=array_rand($imgPreRes);
$img=$imgPreRes[$rndBanerId]["image"];
$IMG="<div class=\"tovMain\" id=\"slideshow\">
<img src=\"{ROOTPATH}images/empty.gif\" alt=\"\" />
<img src=\"{ROOTPATH}img.php?image=".$img."&w=656&h=189\" alt=\"\" />
</div>"; // Простая сквозная картинка
//$HD_IMG="<div class=\"tovMain\">".($cntRes->hdImg())."</div>"; // Сменяющиеся картинки
* s
*/
$BANER=$cntRes->site_simpleStr(PAGE_BANER,"text");
$content=str_replace("{BANER}",$BANER,$content);
$content=str_replace("{IMG}",$IMG,$content);
/*
* IMAG
*/
$TOVMAIN=$imagRes->showAsTovList("main");
$content=str_replace("{TOVMAIN}",$TOVMAIN,$content);
unset($TOVMAIN);
/*
* CONTENT
*/
$NAV_ROW=$cntRes->site_nav();
$STR=$cntRes->site_pageHd();
$STR.=$cntRes->site_imagFilter();
$STR.=$cntRes->site_cont();
$SUB_STR=$cntRes->commonStr();
$content=str_replace("{NAV_ROW}",$NAV_ROW,$content);
$content=str_replace("{STR}",$STR,$content);
$content=str_replace("{SUB_STR}",$SUB_STR,$content);
unset($STR,$SUB_STR);
$content=str_replace("{BACK}",BACK,$content);
$content=str_replace("{UP}",UP,$content);
$content=str_replace("{SEND}",SEND,$content);
$content=str_replace("{FORM_SEND_ZAG}",FORM_SEND_ZAG,$content);
$content=str_replace("{FORM_NAME}",FORM_NAME,$content);
$content=str_replace("{FORM_POSTADDR}",FORM_POSTADDR,$content);
$content=str_replace("{FORM_PHONE}",FORM_PHONE,$content);
$content=str_replace("{FORM_EML}",FORM_EML,$content);
$content=str_replace("{FORM_MSG}",FORM_MSG,$content);
$content=str_replace("{FORM_SEND_SUCCESS}",FORM_SEND_SUCCESS,$content);
$content=str_replace("{FORM_SEND_ERROR}",FORM_SEND_ERROR,$content);
$content=str_replace("{REQUIRED_FIELDS}",REQUIRED_FIELDS,$content);
$content=str_replace("{MAIN}",MAIN,$content);
if(__lang=="en"){
$content=str_replace("logo.png","logo_en.png",$content);
}
templates/default/template.php
Знакомьтесь, "DEFAULT SITE TEMPLATE" (Кусок 2-й) ;)
+151
$mas=split("/",$_FILES["filename"]["type"]);
if ((count($mas)==2) and ($mas[0]=="audio"))
{
...
}
А то вдруг там в MIME-типе двадцать слешей.
+152
function page_from_template_no_headers($t,$vl) {
global $s,$m;
if (!is_array($vl)) $vl = array();
$vl = array_merge($vl,get_common_variables());
$style = find_style(); $t = template_select($t,0,$style);
$vl[styles] = '<LINK href="'.$s[site_url].'/styles/'.$style.'/bootstrap.css" rel="StyleSheet">';
$fh = fopen($t,'r'); while(!feof($fh)) $line .= fgets($fh, 4096); fclose($fh);
foreach ($vl as $k=>$v) $line = str_replace("#%$k%#",$v,$line);
$line = preg_replace("/#%[a-z0-9_]*%#/i",'',$line);
echo stripslashes($line);
exit;
}
Напоминает частушку,
Опа опа срослась ...зда и ..опа.
Этого не может быть
Промежуток должен быть.
+154
[ITEAM] => Array
(
[0] => Array
(
[CITY_NAME] => value
[CITY_DETAIL_URL] => value
[OBJECT_NAME] => value
[OBJECT_ID] => 2487
[DATE_CREATE] => 02.07.2006
[STATUS] => Y
[PAID_STATUS] => Y
[DATEIL_OBJECT_URL] => value
)
[1] => Array
(
[CITY_NAME] => value
[CITY_DETAIL_URL] => value
[OBJECT_NAME] => value
[OBJECT_ID] => 2489
[DATE_CREATE] => 02.07.2006
[STATUS] => Y
[PAID_STATUS] => N
[DATEIL_OBJECT_URL] => value
)
Битрикс!!
Особое внимание на ключи:
ITEAM и DATEIL_OBJECT_URL )))
http://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&LESSON_ID=3014
#bitrix #black chi
+41
catch(...)
{
static int j = 0;
//if we enter this catch clause more than 1 time
//it is very likely that the RestartSystem() command
//did not succeed. If this is the case we just exit.
if(j>0)
exit(0);
else
SWFMonitorT::GetInstance()->RestartSystem();
j++;
throw;
}
Приключения в мире байтоёбиков...