- 1
var_dump( ((int) 0 == (string) "test") ); // TRUE
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+142
var_dump( ((int) 0 == (string) "test") ); // TRUE
Бляааа...
+132
<div class="breadcrumbs">
<ul>
<li>
@if (curMenu != null)
{
<a href="@Url.Action("index", "main")">Главная</a><span class="breadcrumbs__dash"> / </span>
if (depth == 1)
{
<span>@(curMenu.Title)</span>
}
else if (depth == 2)
{
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a> <span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 3)
{
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 4)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 5)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 6)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 7)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
else if (depth == 8)
{
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
<span>@(curMenu.Title)</span>
}
}
else if (ViewBag.Title != null && url!="/")
{
<a href="@Url.Action("index", "main")">Главная</a><span class="breadcrumbs__dash"> / </span>
<span>@ViewBag.Title</span>
}
</li>
</ul>
</div>
Хлебные крошки в каталоге "неограниченной" вложенности.
+159
if(@$_POST['submit']) {
$title = "title";
$string = "";
$equal = "=";
$amper = "&";
$to = '[email protected]';
$from='[email protected]';
foreach($_POST as $key => $value) {
foreach($value as $v) {
$string=$string.$key.$equal.$v.$amper;
}
}
mail($to, $title, $string, 'From:'.$from);
}
−116
<tr style = 'height:20px;'>
<td class =len_ss >
<text>имя категории</text>
</td>
<td>
<text>тип категории</text>
</td>
<td>
<text>алиас категории</text>
</td>
<td>
<text>hidden категории</text>
</td>
</tr>
Попросил новичка сделать шапку для таблицы...
−99
- (CGPoint)itemTopLeftPoint
{
CGRect bounds = CGRectMake(0,0, 100, 100);// [[UIScreen mainScreen] bounds];
CGFloat width = bounds.size.width;
if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) {
width = bounds.size.height;
}
CGFloat x = 0, y = 0;
x = (width - (self.numberOfItemsPerRow * AGIPC_ITEM_SIZE.width)) / (self.numberOfItemsPerRow + 1);
y = x;
return CGPointMake(x, y);
}
Приспичило мне тут показать кастомный контроллер в модальном окне. А он вместо контента показывает чушь, расчитанную под другую ширину.
Обнаружено в ходе раскопок.
+138
private static Dictionary<object, object> _cache = new Dictionary<object, object>();
.........
if( _cache.ContainsKey( key ) )
{
lock( syncRoot )
{
_cache[key] = value;
return;
}
}
_cache.Add( key, value );
Бараньи мозги.
+158
if (Database::getDbType() == 'pgsql')
$stmt = Database::getInstance()->dbh->prepare("SELECT COUNT(*) AS count FROM torrent WHERE tracker = :tracker AND torrent_id = :id");
else
$stmt = Database::getInstance()->dbh->prepare("SELECT COUNT(*) AS `count` FROM `torrent` WHERE `tracker` = :tracker AND `torrent_id` = :id");
https://github.com/ElizarovEugene/TorrentMonitor/blob/master/class/Database.class.php#L625 УПРЛС
+157
function _subqery_helper ($uri){
static $i;
$i++;
if ((is_array($uri)) && (!empty($uri))) {
$keyword = array_pop($uri); //извлекаем последний элемент
if ($i==1)
{
$subqery = 'AND item.keyword= '.$this->db->escape($keyword).' '.(count($uri)? 'AND parent IN
('.$this->_subqery_helper($uri).')' : '');
}
elseif ($i > 1)
{
$subqery = 'SELECT id FROM '.$this->db->dbprefix($this->table).' WHERE keyword = '.$this->db->escape($keyword).' AND parent '.(count($uri)? 'IN
('.$this->_subqery_helper($uri).')' : ' = 0');
}
}
return $subqery;
}
массив $url очень простой:
1=>"str1",2=>"str2",3=>"str3"
это непонятная итерационная функция, которая вообще непонятно зачем такая сложная....
+139
<?php
if(!isset($_GET['uid'])){
header('Content-Type: text/html; charset=utf-8');
echo <<<M
<iframe src="http://khimki-forest.ru/to_new_year.php?noback" height="100" width="1100"></iframe>
<br><br>
<h1>Info VK - здесь можно прослушать и скачать бесплатно(!)<br> любые аудиозаписи любого пользователя ВКонтакте!</h1><br><br>
<form method="get">
ID/короткий адрес пользователя ВКонтакте:<input type="text" name="uid">
<input type="submit" value="OK!">
</form>
<br><br><h2>Автор системы: <a href="http://vk.com/i_am_angry_bird">Вадим ♦ЗЛАЯ ПТИЧКА♦ Андреев</a>.</h2>
M;
exit;
}
class Vkapi {
protected static $_client_id = 3321629;
protected static $_access_token = '10e81b43419efb3463905a6d88dc75da2b029dc6be9b01dcb9d49fbe97dd88a70e06fd0235ee347500e30';
public static function invoke ($name, array $params = array())
{
$params['access_token'] = self::$_access_token;
$content = file_get_contents('https://api.vkontakte.ru/method/'.$name.'?'.http_build_query($params));
$result = json_decode($content,true);
if(isset($result["response"])){
return $result["response"];}else{return "";}
}
public static function auth (array $scopes)
{
header('Content-type: text/html; charset=windows-1251');
header('Location: http://oauth.vkontakte.ru/authorize?'.http_build_query(array(
'client_id' => self::$_client_id,
'scope' => implode(',', $scopes),
'redirect_uri' => 'http://api.vkontakte.ru/blank.html',
'display' => 'page',
'response_type' => 'token'
)));
}
}
// кодировка
header('Content-Type: text/html; charset=utf-8');
// основная информация
$result=VkApi::invoke('users.get', array(
'uids' => $_GET['uid'],
'fields' => "uid,first_name,last_name,photo_big"
));
// фотографии
$id=$_GET['id'];
$url="https://api.vkontakte.ru/method/photos.getAll?owner_id=".$id."&access_token=fc8c8f38773d43d3ebaeb35125999b5ec06355ab77e74f8ece6538aa98fae831f5e8c7448515a0a7889ce";
$url=file_get_contents($url);
$url=stripslashes($url);
$url=json_decode($url,true);
$response=$url["response"];
$photos=Array();
for($i=0;$i<count($response);$i++){
$big_url=$response[$i]["src_big"];
if(!$big_url==""){$big_url="http://khimki-forest.ru/resize.php?url=".$big_url."&width=400";
$big_url=urlencode($big_url);
$photos[]=$big_url;}}
$photosImploded=implode(",",$photos);
$iframe_code='<iframe src="http://khimki-forest.ru/slideshow.php?images='.$photosImploded.'" width="1000" height="600"></iframe>';
echo <<<PLAYER
<iframe src="http://khimki-forest.ru/to_new_year.php?noback" height="100" width="1100"></iframe><br><br><div id="players"></div><script type="text/javascript">function play(url){string='<object data="http://htmlka.com/wp-content/uploads/2009/07/player2.swf" type="application/x-shockwave-flash" width=240 height=50><param value="http://htmlka.com/wp-content/uploads/2009/07/player2.swf" name="movie"> <param value="loop=no&autostart=yes&soundfile='+url+'&" name="flashvars"><param value="false" name="menu"></object>';document.getElementById("players").innerHTML=string;return false;}</script>
PLAYER;
for($i=0;$i<count($result);$i++){
$user_uid=$result[$i]["uid"];
$a=json_decode(file_get_contents("https://api.vkontakte.ru/method/status.get?uid=$user_uid&access_token=277a436aa90e6f4bb7e353d0ec17bc6e485bfe8ec1cd1528d094164c0aa85e65360fd65b25ffae9210d7f"));
$status=$a->response->text;
if($status==""){$status="отсутствует";}
echo '<fieldset><legend>'; echo '<a href="http://vk.com/id'. $result[$i]["uid"] . '">' . $result[$i]["first_name"] . " " . $result[$i]["last_name"] . " (статус: $status)</a>";
echo '</legend>';
echo 'Аватар:<br><img src="' . $result[$i]["photo_big"] . '"><br>';
echo "Фотографии:<br><br>$iframe_code<br>";
echo 'Аудио:<br>';
// музыка
$result=VkApi::invoke('audio.get', array(
'uid' => $result[$i]["uid"]
));
if(!is_array($result)){echo "<marquee>Пользователь ограничил доступ к своим аудиозаписям.</marquee></fieldset> <br><br><h2>Автор системы: <a href='http://vk.com/i_am_angry_bird'>Вадим ♦ЗЛАЯ ПТИЧКА♦ Андреев</a>.</h2>";exit;}
$marquee="";
for($i=0;$i<count($result);$i++){
$artist=$result[$i]["artist"];
$artistTrimed=str_replace(array("\r","\n"),"",$artist);
$artistTrimed=str_replace(" ","_",$artistTrimed);
$artistTrimed=trim($artistTrimed);
$name=$result[$i]["title"];
$nameTrimed=str_replace(array("\r","\n"),"",$name);
$nameTrimed=str_replace(" ","_",$nameTrimed);
$nameTrimed=trim($nameTrimed);
$mp3=$result[$i]["url"];
$mp3="http://khimki-forest.ru/getMp3.php?url=".$mp3."&artist=".$artistTrimed."&title=".$nameTrimed;
$i++;
$count=$i;
$i--;
$mp3WithKavyshka='"'.$mp3.'"';
$marquee=$marquee." $count. <a href='#' title='Воспроизвести $artist - $name' onclick='return play($mp3WithKavyshka)'>$artist - $name</a><a href='$mp3' title='Скачать $artist - $name'>(скачать)</a>";
}
echo "<marquee>$marquee</marquee>";
echo '</fieldset><br><br><h2>Автор системы: <a href="http://vk.com/i_am_angry_bird">Вадим ♦ЗЛАЯ ПТИЧКА♦ Андреев</a>.</h2>';
}
?>
Скачивание музыки с ВКонтакте
+128
<style>
a img, input, #hndl-show-loginpass-fields, .checkout_buttons, #shipping-method-7, #shipping-method-6, #shipping-method-5, #shipping-method-4, #shipping-method-3, #shipping-method-2, #shipping-method-1, #payment-method-7, #payment-method-6, #payment-method-5, #payment-method-4, #payment-method-3, #payment-method-2, #payment-method-1, #payment-method-8, #payment-method-9, #payment-method-12
{
border: 0;
}
</style>
Отрыл в проекте заказчика вот такую строчку CSS :)