- 1
<td valign="top" class="pt" <?echo "style='width:20%;max-width: 237px;'";?>>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+162
<td valign="top" class="pt" <?echo "style='width:20%;max-width: 237px;'";?>>
В шаблоне сайта Битрикса.
+162
if(isset($_POST['submit']) AND $_POST['submit'] == 'add_program')
{
if($this->form_validation->run('add_program') == TRUE)
{
// Добавляем программу обучения
$this->Settings_model->add_program($_POST['title']);
$id = $this->db->insert_id();
for ($x = 0; $x < 61; $x++)
{
if ($x <= 12)
{
$title = $x;
$year = 1;
}
elseif ($x > 12 AND $x <= 24)
{
if($x == 13) {$title = 1;}
if($x == 14) {$title = 2;}
if($x == 15) {$title = 3;}
if($x == 16) {$title = 4;}
if($x == 17) {$title = 5;}
if($x == 18) {$title = 6;}
if($x == 19) {$title = 7;}
if($x == 20) {$title = 8;}
if($x == 21) {$title = 9;}
if($x == 22) {$title = 10;}
if($x == 23) {$title = 11;}
if($x == 24) {$title = 12;}
$year = 2;
}
elseif ($x > 24 AND $x <= 36)
{
if($x == 25) {$title = 1;}
if($x == 26) {$title = 2;}
if($x == 27) {$title = 3;}
if($x == 28) {$title = 4;}
if($x == 29) {$title = 5;}
if($x == 30) {$title = 6;}
if($x == 31) {$title = 7;}
if($x == 32) {$title = 8;}
if($x == 33) {$title = 9;}
if($x == 34) {$title = 10;}
if($x == 35) {$title = 11;}
if($x == 36) {$title = 12;}
$year = 3;
}
elseif ($x > 36 AND $x <= 48)
{
if($x == 37) {$title = 1;}
if($x == 38) {$title = 2;}
if($x == 39) {$title = 3;}
if($x == 40) {$title = 4;}
if($x == 41) {$title = 5;}
if($x == 42) {$title = 6;}
if($x == 43) {$title = 7;}
if($x == 44) {$title = 8;}
if($x == 45) {$title = 9;}
if($x == 46) {$title = 10;}
if($x == 47) {$title = 11;}
if($x == 48) {$title = 12;}
$year = 4;
}
else
{
if($x == 49) {$title = 1;}
if($x == 50) {$title = 2;}
if($x == 51) {$title = 3;}
if($x == 52) {$title = 4;}
if($x == 53) {$title = 5;}
if($x == 54) {$title = 6;}
if($x == 55) {$title = 7;}
if($x == 56) {$title = 8;}
if($x == 57) {$title = 9;}
if($x == 58) {$title = 10;}
if($x == 59) {$title = 11;}
if($x == 60) {$title = 12;}
$year = 5;
}
if($x != 0)
{
// Добавляем месяцы обучения
$this->Settings_model->add_tutorial_months($id,$year,$title);
}
}
Тяжело супортить чейто проект
+162
taras@host ~/host/sites/default $ drush phpsh-console
php> var_dump(eval('array()'));
bool(false)
PHP Parse error: syntax error, unexpected end of file in /usr/local/lib/python2.7/dist-packages/phpsh/phpsh.php(591) : eval()'d code(1) : eval()'d code on line 1
О мой мозг...! А Python здесь причем?
+162
function loadScript(varStr, codeStr) {
var $script = $('<script>').attr('type', 'text/javascript');
$script.html('var ' + varStr + ' = ' + codeStr);
document.getElementsByTagName("head")[0].appendChild($script[0]);
}
Как инициализировать переменную, используя любимый поисковик и jQuery
+162
class StupidClass
{
public function __toString()
{
return 'this';
}
public function hax()
{
return $this === $$$$$$this;
}
}
var_dump((new StupidClass)->hax()); // true
Уииии
+162
if ($n > '25') {
$list = floor($n / 25) + 1;
$str .= '<div id="srt_page" align="center">';
for ($q = 1; (($q) <= $list); $q++) {
if ((((isset($_GET['page'])) && ($_GET['page'] == $q)) || ((!isset($_GET['page'])) && ($q == 1))))
$str .= ' <b>' . $q . '</b> ';
else {
if ((($q == ($pg - 1)) && (($pg - 1) != 1) && (($pg - 1) != $list)) || (($q == ($pg - 2)) && (($pg - 2) != 1) && (($pg - 2) != $list)) || (($q == ($pg - 3)) && (($pg - 3) != 1) && (($pg - 3) != $list)) || (($q == ($pg - 4)) && (($pg - 4) != 1) && (($pg - 4) != $list)) || (($q == ($pg + 1)) && (($pg + 1) != 1) && (($pg + 1) != $list)) || (($q == ($pg + 2)) && (($pg + 2) != 1) && (($pg + 2) != $list)) || (($q == ($pg + 3)) && (($pg + 3) != 1) && (($pg + 3) != $list)) || (($q == ($pg + 4)) && (($pg + 4) != 1) && (($pg + 4) != $list)) || ($q == $list) || ($q == 1)) {
if (($q == $list) && (($pg + 4) < ($list - 1)))
$str .= '...';
$str .= ' <a class="link_page" href="?page=' . $q . '"> ' . $q . ' </a> ' . "\n";
if (($q == 1) && (($pg - 4) > 2))
$str .= '...';
}
}
}
$str .= '</div>';
}
return $str;
Кто не понял, это такой pagination %))
+162
€ = $.noConflict();
SyntaxError: illegal character. Обидно ;(
+162
switch (response.statusCode) {
case 200:
status = "up";
break;
case 404:
status = "up";
break;
case 403:
status = "up";
break;
case 500:
status = "up";
break;
case 200:
status = "up";
break;
default:
status = "up";
}
Каков ассортимент вариантов! .)
+162
public static function QFV($query_input, $row, $field_name, $linkname)
{
$qres = self::Q($query_input, $linkname);
$ret = self::FV($qres, $row, $field_name);
self::FreeRes($qres);
return $ret;
}
public static function QFA($query_input, $linkname) {
$qres = self::Q($query_input, $linkname);
$ret = self::FA($qres);
self::FreeRes($qres);
return $ret;
}
public static function QFO($query_input, $linkname) {
$ret = NULL;
$qres = self::Q($query_input, $linkname);
if ($qres->result) {
$ret = self::FO($qres);
self::FreeRes($qres);
}
return $ret;
}
public static function QFOL($query_input, $num, $linkname)
{
$ret = NULL;
$qres = self::Q($query_input, $linkname);
if ($qres) {
$ret = self::FOL($qres, $num);
self::FreeRes($qres);
}
return $ret;
}
public static function QFFF($query_input, $linkname)
{
$qres = self::Q($query_input, $linkname);
$res = self::FFF($qres);
self::FreeRes($qres);
return $res;
}
// И ещё несколько десятков безымянных функций без каких-либо комментариев
Абстрактный слой работы с базой.
+162
(strrev "hello") #=> "olleh"
(array_sum [array 1 2 3]) #=> 6
(array-product [array 4 5 6]) #=> 120
(substring "world" 2) #=> "rld"
Теперь ваш Lisp и в PHP: https://github.com/lisphp/lisphp