- 1
$sqo_answer['remark']!=''?$sqo_answer['remark']:''
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
$sqo_answer['remark']!=''?$sqo_answer['remark']:''
найдено на реальном проекте. один из тысячи
+2
$host = Doctrine_Core::getTable("TransfertConfij")->find(1)->emailserver;
$emailto = $form->getValue('addresstestemail');
$port = Doctrine_Core::getTable("TransfertConfij")->find(1)->port;
$encriptyon = Doctrine_Core::getTable("TransfertConfij")->find(1)->encriptyon;
$login = Doctrine_Core::getTable("TransfertConfij")->find(1)->loginemailserver;
$pass = Doctrine_Core::getTable("TransfertConfij")->find(1)->passemailserver;
$content = $form->getValue('contenttestemail');
// Далее код отправки письма.
5 запросов? Какая разница? работает ведь!
+2
<td>Текущий статус</td>
<td><select name="nStatus" size="1" disabled>
<option value="0" <?if ($row[nStatus] == '0') { echo 'SELECTED'; }?>>Cоздан</option>
<option value="1" <?if ($row[nStatus] == '1') { echo 'SELECTED'; }?>>Продан</option>
<option value="2" <?if ($row[nStatus] == '2') { echo 'SELECTED'; }?>>Тестируется</option>
<option value="3" <?if ($row[nStatus] == '3') { echo 'SELECTED'; }?>>Бесплатная работа</option>
<option value="4" <?if ($row[nStatus] == '4') { echo 'SELECTED'; }?>>Эксплуатация</option>
<option value="5" <?if ($row[nStatus] == '5') { echo 'SELECTED'; }?>>Заблокирован</option>
<option value="7" <?if ($row[nStatus] == '7') { echo 'SELECTED'; }?>>Приостановлен</option>
<option value="6" <?if ($row[nStatus] == '6') { echo 'SELECTED'; }?>>Отключен</option>
</select></td>
+2
setInterval(function() {
jQuery('#thsp-sticky-header').find('.ya-site-form__submit').removeClass('ya-site-form__submit').addClass('ya-site-form__submit2');
}, 500)
+2
bool matchingNumerals(int num)
{
QString str = QString("%1").arg(num);
for (int i = 0; i < 10; i++)
if (str.split(QString("%1").arg(i)).size() > 2)
return true;
return false;
}
Функция, определяющая, есть ли в числе одинаковые цифры на великой могучей Qt.
+2
<?php
function generate_number_part($length=2) {
$password = substr(preg_replace("/[^0-9]/", "", crypt(time())) .
preg_replace("/[^0-9]/", "", crypt(time())) .
preg_replace("/[^0-9]/", "", crypt(time())),
0, $length);
return $password;
}
Сгенерировать пароль из ровно $length цифр... или меньше
+2
public ActionResult Exception()
{
throw new Exception("You better not to execute this!");
}
нашел говнокод, оставленный прошлым архитектором)
+2
switch (button.Tag.ToString()) {
case "Ezp":
{
if (nowLayer.OpenedFiles.Count == 0)
{
nowLayer.OpenedFiles = new List<ExemplarFile> { new ExemplarFile("") };
}
if (nowLayer.OpenedFiles[0].EdinZemleps == null)
{
nowLayer.OpenedFiles[0].EdinZemleps = new List<EdinZemlep>();
}
var strName = ":ЕЗ" + (nowLayer.OpenedFiles[0].EdinZemleps.Count + 1);
nowLayer.OpenedFiles[0].EdinZemleps.Add(new EdinZemlep(strName) { Status = StatusEnum.Образуемый });
_ezpListTreeView.Add(new EzpTreeView { NameEzp = strName, ContourList = new List<ContourTreeView>(), ParcelList = new List<PartZuTreeView>(), IsEzpVisible = true, IsSelectedEzp = false } );
_dictionaryEzpTreeViewFile.Add(_ezpListTreeView[_ezpListTreeView.Count - 1], nowLayer.OpenedFiles[0]);
_dictionaryEzpTreeViewEdinZemlep.Add(_ezpListTreeView[_ezpListTreeView.Count - 1], nowLayer.OpenedFiles[0].EdinZemleps[nowLayer.OpenedFiles[0].EdinZemleps.Count - 1]);
break;
}
case "ContourEzp":
{
indexEz = TreeViewStackPanelMain.Children.IndexOf(((button.Parent as Grid).Parent as StackPanel).Parent as Grid) - _partZuListTreeView.Count;
var strName = (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].CadNum != "" ? nowLayer.OpenedFiles[0].EdinZemleps[indexEz].CadNum : nowLayer.OpenedFiles[0].EdinZemleps[indexEz].LastName) + "(" + (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Contours.Count + 1) + ")";
nowLayer.OpenedFiles[0].EdinZemleps[indexEz].AddContour(new Contour(strName) { Status = StatusEnum.Образуемый });
if (_ezpListTreeView[indexEz].ContourList == null)
{
_ezpListTreeView[indexEz].ContourList = new List<ContourTreeView>();
}
strName = nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Contours.Last().Name;
_ezpListTreeView[indexEz].ContourList.Add(new ContourTreeView { NameContour = strName, IsContourVisible = true, IsSelectedContour = false } );
for (var i = 0; i < _ezpListTreeView[indexEz].ContourList.Count; i++)
{
_ezpListTreeView[indexEz].ContourList[i].NameContour = nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Contours[i].Name;
}
break;
}
case "ZuEzp":
{
indexEz = TreeViewStackPanelMain.Children.IndexOf(((button.Parent as Grid).Parent as StackPanel).Parent as Grid) - _partZuListTreeView.Count;
var strName = ":ЗУ" + (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels.Count + 1);
if (_ezpListTreeView[indexEz].ParcelList == null)
{
_ezpListTreeView[indexEz].ParcelList = new List<PartZuTreeView>();
}
nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels.Add(new Parcel(strName) { Status = StatusEnum.Образуемый });
_ezpListTreeView[indexEz].ParcelList.Add(new PartZuTreeView { NamePartZu = strName, ContourList = new List<ContourTreeView>(), PartList = new List<PartTreeView>(), IsPartZuVisible = true, IsSelectedPartZu = false });
_dictionaryPartZuTreeViewFile.Add(_ezpListTreeView[indexEz].ParcelList[_ezpListTreeView[indexEz].ParcelList.Count - 1], nowLayer.OpenedFiles[0]);
_dictionaryPartZuTreeViewParcel.Add(_ezpListTreeView[indexEz].ParcelList[_ezpListTreeView[indexEz].ParcelList.Count - 1], nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels.Count - 1]);
break;
}
case "PartZuEzp":
{
indexEz = TreeViewStackPanelMain.Children.IndexOf(((((((button.Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid) - _partZuListTreeView.Count;
indexZu = ((((((button.Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Children.IndexOf((((((button.Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid));
var sbPrclName = nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].LastName + "/чзу" + (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels.Count + 1);
nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels.Add(new Subparcel(sbPrclName) { Status = StatusEnum.Образуемый });
if (_ezpListTreeView[indexEz].ParcelList[indexZu].PartList == null)
{
_ezpListTreeView[indexEz].ParcelList[indexZu].PartList = new List<PartTreeView>();
}
_ezpListTreeView[indexEz].ParcelList[indexZu].PartList.Add(new PartTreeView { NamePart = sbPrclName, ContourList = new List<ContourTreeView>(), IsPartVisible = true, IsSelectedPart = _ezpListTreeView[indexEz].ParcelList[indexZu].IsSelectedPartZu });
_dictionaryPartTreeViewSubparcel.Add(_ezpListTreeView[indexEz].ParcelList[indexZu].PartList[_ezpListTreeView[indexEz].ParcelList[indexZu].PartList.Count - 1], nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels[nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels.Count - 1]);
break;
}
и это продолжается, продолжается и продолжается....
+2
//Китайский цЫрк
if ($fileField = isset($this->params[0]) ? $this->params[0] : false){
}
lol)
+2
Где-то далеко в index.php:
require_once 'face.php';
А где-то внутри face.php :
require_once $_SERVER['DOCUMENT_ROOT'].'/includes/sidebar.html'
А в середине sidebar.html вот такое:
<div class="sideBoxContent" style="font-size:1.2em;">
<ul class="list">
<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/config/config.php';
$dbt=db_connect();
$dbt->query("SET NAMES 'utf8'");
$resultt = $dbt->query("SELECT * FROM a_news ORDER BY date DESC LIMIT 3");
while ($myrowt = $resultt->fetch_array(MYSQLI_ASSOC))
{
echo "
<li><script>addLink('icon go-clear','/b2b/news/news.html','".$myrowt["title"]."')</script></li>";
}
$resultt->close();
$dbt->close();
?>
</ul>
<script>addLink('icon go','/b2b/news/news.html','Все новости')</script>
</div>
</div>
P.S. addLink(c, h, t) генерит <a class="c" href="h">t</a>
Господи, господи, зачем???
Нет, возможно это не говнокод. Возможно, я чего-то не понимаю в этой жизни. Но чего???
P.S. Я даже не знаю какой язык ставить. Тут и PHP, и JS...