- 1
list($username) = $DB->fetch("SELECT username FROM {$CONF['sql_prefix']}_sites WHERE username = '{$TMPL['username']}'", __FILE__, __LINE__);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+164
list($username) = $DB->fetch("SELECT username FROM {$CONF['sql_prefix']}_sites WHERE username = '{$TMPL['username']}'", __FILE__, __LINE__);
Наткнулся в одной из cms...
+157
if ( '' !== $qv['second'] ) {
$this->is_time = true;
$this->is_date = true;
}
if ( '' !== $qv['minute'] ) {
$this->is_time = true;
$this->is_date = true;
}
if ( '' !== $qv['hour'] ) {
$this->is_time = true;
$this->is_date = true;
}
if ( $qv['day'] ) {
if ( ! $this->is_date ) {
$this->is_day = true;
$this->is_date = true;
}
}
if ( $qv['monthnum'] ) {
if ( ! $this->is_date ) {
$this->is_month = true;
$this->is_date = true;
}
}
if ( $qv['year'] ) {
if ( ! $this->is_date ) {
$this->is_year = true;
$this->is_date = true;
}
}
if ( $qv['m'] ) {
$this->is_date = true;
if ( strlen($qv['m']) > 9 ) {
$this->is_time = true;
} else if ( strlen($qv['m']) > 7 ) {
$this->is_day = true;
} else if ( strlen($qv['m']) > 5 ) {
$this->is_month = true;
} else {
$this->is_year = true;
}
}
ВротПресс
+162
switch ($size) {
case 'small':
if ($crop_thumbnail == 3 || $crop_thumbnail == 5 || $crop_thumbnail == 6 || $crop_thumbnail == 7 ) {
$crop = 1;
}
break;
case 'medium':
if ($crop_thumbnail == 2 || $crop_thumbnail == 4 || $crop_thumbnail == 5 || $crop_thumbnail == 7 ) {
$crop = 1;
}
break;
case 'large':
Default:
if ($crop_thumbnail == 1 || $crop_thumbnail == 4 || $crop_thumbnail == 6 || $crop_thumbnail == 7 ) {
$crop = 1;
}
break;
}
Phocagallery module, Joomla!
+165
// создает массив с заданным кол-вом ячеек
function array_from_int($count,$val=true,$start=0)
{
$fcount = $count+$start;
for($i=$start;$i<$fcount;$i++)
{
$arr[$i] = $val;
}
return $arr;
}
+159
if ($rightDisplayDelete == 1) {
$images = $model->getData(1);
$this->tmpl['pagination'] = &$model->getPagination(1);
} else {
$images = $model->getData(0);
$this->tmpl['pagination'] = &$model->getPagination(0);
}
И снова модуль Phocagallery для Joomla!
+171
function trim_and_screening(&$item, $key)
{
$item = '`'.$item.'`';
}
+147
function index($name) {
return is_numeric($name)?'_'.$name:(int)substr($name,1);
}
универсальная функция для... угадайте, для чего?
+160
// There is an error while creating thumbnail in m or in s or in l
if ($creatingSError || $creatingMError || $creatingLError) {
// if all or two errors appear, we only display the last error message
// because the errors in this case is the same
if ($errorMsgS != '') {
$creatingError = $errorMsgS;
}
if ($errorMsgM != '') {
$creatingError = $errorMsgM;
}
if ($errorMsgL != '') {
$creatingError = $errorMsgL;
} // because the errors in this case is the same
$returnFrontMessage = $creatingError;
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == '' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == 'ThumbnailExists') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == '' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == 'ThumbnailExists' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == '') {
$returnFrontMessage = 'Success';
} else if ($errorMsgS == 'ThumbnailExists' && $errorMsgM == '' && $errorMsgL == 'ThumbnailExists') {
$returnFrontMessage = 'Success';
}
Модуль phocagallery для joomla. Кусок кода в функции генереции превьюшек 3х разных размеров.
+147
// ...
// Количество распиленных досок
$spl = 0;
// Количество использованных пакетов
$clpz = 0;
if ($spl === 0) {
for ($ix = 1; $ix <= $cll; $ix++) {
$dsk[$ix] = $dd;
}
}
// ....
Встретился вот такой код. Условие по моему тут лишнее :)
+163
substr_count(strtolower(php_uname()),'windows') ? ';' : ':')
NetCat, такой NetCat. О существовании PATH_SEPARATOR даже и не знали.