- 1
Если ВРЕГ(ДанныеСчета.УсловияЗаполнения)<>"ЛОЖЬ" Тогда
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−90
Если ВРЕГ(ДанныеСчета.УсловияЗаполнения)<>"ЛОЖЬ" Тогда
УПП 1.3 (1.3.75.2)
ОбщиеМодули.СчетаУчетаВДокументах
Подскажите если изменятся языковые настройки конфигурации как себя поведет данный код?
+5
$(document).on('click', 'a.switcher_link', function(e) {
e.preventDefault();
var btn = $(this);
$.getJSON(btn.attr('href'), {type: 'json'}, function(data) {
btn.parent().parent().parent().parent().parent().parent().parent().parent().replaceWith(data.data);
});
});
Нашел и ахуел....
−1
<?php
/**
* Provides URL shortening functionality, like tinyurl.com, bit.ly, ow.ly and other popular services.
* (c) 2011, it-in, http://it-in.ru
* @author Sergey Kovalev <[email protected]>
* @version 1.0
*/
/**
* Basic URL path, to which short code will be added.
*/
define("BASE_SHORT_PATH", "http://it-in.ru/~");
/**
* ID of the infoblock which holds information about shortned URLs.
*/
define("TINYURL_IBLOCK_ID", 11);
Class TinyURL
{
/**
* Converts decimal number to any base
* @param integer $num Your decimal integer
* @param integer $base Base to which you wish to convert $num (leave it 0 if you are providing $index or omit if you're using default (62))
* @param string $index If you wish to use the default list of digits (0-1a-zA-Z), omit this option, otherwise provide a string (ex.: "zyxwvu")
* @return string
* @link http://www.php.net/manual/ru/function.base-convert.php#52450
*/
private static function dec2any( $num, $base=62, $index=false ) {
if (! $base ) {
$base = strlen( $index );
} else if (! $index ) {
$index = substr( "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ,0 ,$base );
}
$out = "";
for ( $t = floor( log10( $num ) / log10( $base ) ); $t >= 0; $t-- ) {
$a = floor( $num / pow( $base, $t ) );
$out = $out . substr( $index, $a, 1 );
$num = $num - ( $a * pow( $base, $t ) );
}
return $out;
}
/**
* Converts number in any base to decimal
* @param integer $num Your custom-based number (string) (ex.: "11011101")
* @param integer $base Base with which $num was encoded (leave it 0 if you are providing $index or omit if you're using default (62))
* @param string $index If you wish to use the default list of digits (0-1a-zA-Z), omit this option, otherwise provide a string (ex.: "abcdef")
* @return integer
* @link http://www.php.net/manual/ru/function.base-convert.php#52450
*/
private static function any2dec( $num, $base=62, $index=false ) {
if (! $base ) {
$base = strlen( $index );
} else if (! $index ) {
$index = substr( "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, $base );
}
$out = 0;
$len = strlen( $num ) - 1;
for ( $t = 0; $t <= $len; $t++ ) {
$out = $out + strpos( $index, substr( $num, $t, 1 ) ) * pow( $base, $len - $t );
}
return $out;
}
/**
* Shortens URL.
* @param string $url Absolute URL to be shortened, like http://www.yandex.ru.
* @return string
*/
public static function shorten($url)
{
CModule::IncludeModule("iblock") || die("Couldn't load one of the required modules. Error fe51e037.");
// Check if there is already shortened version of the required URL.
$res = CIBlockElement::GetList(
array(),
array('IBLOCK_ID' => TINYURL_IBLOCK_ID, 'PREVIEW_TEXT' => $url),
false,
false,
array('ID')
);
if($ob = $res->GetNextElement())
{
$arFields = $ob->GetFields();
return BASE_SHORT_PATH . self::dec2any($arFields['ID']);
}
// Shorten new URL and create a record in database.
$el = new CIBlockElement;
$ELEMENT_ID = $el->Add(array(
'IBLOCK_ID' => TINYURL_IBLOCK_ID,
'NAME' => $url,
'PREVIEW_TEXT' => $url,
'PREVIEW_TEXT_TYPE' => 'html',
));
if($ELEMENT_ID)
return BASE_SHORT_PATH . self::dec2any($ELEMENT_ID);
else
die($el->LAST_ERROR);
}
/**
* Converts short code to full URL, e.g. 8UdA -> http://yandex.ru.
* @param string $short_code
* @return string Full URL.
Продолжаем копаться в недрах гитхаба в поисках изумрудов от bitrix.
Данное творение некого адепта битрикса (из it-in, http://it-in.ru) для создания tinyurl
0
if (empty($_GET['mms']) and empty($_GET['mass']) and empty($_GET['showuser']) and empty($_GET['user']) and empty($_GET['rate'])) {
$db = mysql_connect ( "mysql.hostinger.ru", "u391920429_gala", "kirill1998" );
mysql_select_db ( "u391920429_gala", $db );
$pas = $_POST['pas'];
$pass1 = $_POST['pass1'];
$pass2 = $_POST['pass2'];
$lop = addcslashes($pass1, '?%');
$jjj = mysql_real_escape_string ($lop);
$pol = addcslashes($pass2, '?%');
$kkk = mysql_real_escape_string ($pol);
$i = $_GET['edit'];
$mail = $_POST['mail'];
$stat = $_POST['stat'];
$ava = $_POST['ava'];
$ie = addcslashes($i, '?%');
$ieq = mysql_real_escape_string ($ie);
$id = preg_replace('~[^a-z0-9 \x80-\xFF]~i', "",$ieq);
$lol = addcslashes($mail, '?%');
$ooo = mysql_real_escape_string ($lol);
$per = addcslashes($stat, '?%');
$adr = mysql_real_escape_string ($per);
$po = addcslashes($ava, '?%');
$popa = mysql_real_escape_string ($po);
$re=mysql_query("SELECT * FROM users WHERE id='$id'", $db);
$user = $_SESSION["id"];
if (mb_strlen($_POST['mail']) >= 4) {
$up=mysql_query("UPDATE users SET email='$ooo' WHERE id='$user'", $db);
}
if (mb_strlen($_POST['stat']) >= 5) {
$up=mysql_query("UPDATE users SET stat='$adr' WHERE id='$user'", $db);
}
if (mb_strlen($_POST['ava']) >= 4) {
$up=mysql_query("UPDATE users SET ava='$popa' WHERE id='$user'", $db);
}
$name = $_SESSION["name"];
$result=mysql_query("SELECT * FROM users WHERE name='$name'", $db);
$myrow=mysql_fetch_array($result);
$passs = md5($pas);
if ($passs == $myrow["pass"]) {
if ($jjj == $kkk) {
if (mb_strlen($jjj) >=5) {
$mdpass = md5($jjj);
$up=mysql_query("UPDATE users SET pass='$mdpass' WHERE id='$user'", $db);
}
}
}
$res=mysql_fetch_array($re);
if ($_SESSION["id"] == $id) {
if ($res['ban'] == 1) {
echo '<div class="user_prof">
<div class="name_prof_block">Профиль</div>
<form name="set" action="/prof.php?edit='.($res['id']).'" method="post">
<div class="name_prof_b">Почта</div>
<input class="form_mail" value="'.$res['email'].'" name="mail" type="text"/>
<div class="name_prof_b">Аватар</div>
<input class="form_ava" value="'.$res['ava'].'" name="ava" type="text"/>
<div class="name_prof_b">Статус</div>
<div class="bb_code_div">'.BB_PANEL('set','stat').'</div>
<textarea class="form_status" name="stat" type="text">'.$res['stat'].'</textarea>
<input class="add_news" value="Сохранить" type="submit"/>
</form>
</div>';
echo '<div class="stat_prof">
<div class="name_prof_block">Пароль</div>
<form action="" method="post">
<input class="form_mail" placeholder="Старый пароль" name="pas" type="text"/>
<input class="form_mail" placeholder="Новый пароль" name="pass1" type="text"/>
<input class="form_ava" placeholder="Повторите новый пароль" name="pass2" type="text"/>
<input class="add_news" value="Сменить пароль" type="submit"/>
</form>
</div>';
}
if ($res['ban'] == 0) {
echo '<div class="user_prof">Ваш аккаунт заблокирован<a class="logout_prof" href="/?step=exit">Выход</a></div>';
}
}
else {
echo 'Доступ запрещен';
}
}
+2
function plays(){
var snd = new Audio("http://boobooka.com/wp-content/uploads/2013/02/33bells33.mp3");
snd.preload = "auto";
snd.play();
}
function showTime()
{
var dat = new Date();
var ch = dat.getDate();
var montha = new Array();
montha[0] = "января";
montha[1] = "февраля";
montha[2] = "марта";
montha[3] = "апреля";
montha[4] = "мая";
montha[5] = "июня";
montha[6] = "июля";
montha[7] = "августа";
montha[8] = "сентября";
montha[9] = "октября";
montha[10] = "ноября";
montha[11] = "декабря";
var mon = montha[dat.getMonth()];
var ye = dat.getYear()+ 1900;
var ned = dat.getDay();
var day = new Array();
day[1] = "Понедельник";
day[2] = "Вторник";
day[3] = "Среда";
day[4] = "Четверг";
day[5] = "Пятница";
day[6] = "Суббота";
day[0] = "Воскресенье";
var nedel = day[dat.getDay()];
var H = '' + dat.getHours();
H = H.length<2 ? '0' + H:H;
var M = '' + dat.getMinutes();
M = M.length<2 ? '0' + M:M;
var S = '' + dat.getSeconds();
S =S.length<2 ? '0' + S:S;
var clock = H + ':' + M + ':' + S;
var cl = H + M + S;
var chislo = ch+" "+mon;
var chisl = ye+" года";
document.getElementById('time_div').innerHTML=clock;
document.getElementById('ned_div').innerHTML=nedel;
document.getElementById('chi_div').innerHTML=chislo;
document.getElementById('chis_div').innerHTML=chisl;
if(clock == '09:00:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '09:40:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '09:50:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '10:30:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '10:40:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '11:20:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '11:40:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '12:20:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '12:30:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '13:10:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '13:20:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '14:00:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '14:20:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '15:00:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '15:10:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '15:50:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '16:00:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '16:40:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '16:45:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '17:25:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '17:30:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '18:10:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '18:15:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '18:55:00'){if(1<=ned && ned<=6){plays();}}
setTimeout(showTime,1000);
if(1<=ned && ned<=6)
{
if(cl >= 090000 && cl < 094000) {document.getElementById('mes_div').innerHTML="Идет 1-й урок (09:00-09:40)";}
if(cl >= 094000 && cl < 095000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (09:40-09:50)";}
if(cl >= 095000 && cl < 103000) {document.getElementById('mes_div').innerHTML="Идет 2-й урок (09:50-10:30)";}
if(cl >= 103000 && cl < 104000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (10:30-10:40)";}
if(cl >= 104000 && cl < 112000) {document.getElementById('mes_div').innerHTML="Идет 3-й урок (10:40-11:20)";}
if(cl >= 112000 && cl < 114000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (11:20-11:40)";}
if(cl >= 114000 && cl < 122000) {document.getElementById('mes_div').innerHTML="Идет 4-й урок (11:40-12:20)";}
if(cl >= 122000 && cl < 123000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (12:20-12:30)";}
if(cl >= 123000 && cl < 131000) {document.getElementById('mes_div').innerHTML="Идет 5-й урок (12:30-13:10)";}
if(cl >= 131000 && cl < 132000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (13:10-13:20)";}
if(cl >= 132000 && cl < 140000) {document.getElementById('mes_div').innerHTML="Идет 6-й урок (13:20-14:00)";}
if(cl >= 140000 && cl < 142000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (14:00-14:20)";}
if(cl >= 142000 && cl < 150000) {document.getElementById('mes_div').innerHTML="Идет 7-й урок (14:20-15:00)";}
if(cl >= 150000 && cl < 151000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (15:00-15:10)";}
if(cl >= 151000 && cl < 155000) {document.getElementById('mes_div').innerHTML="Идет 8-й урок (15:10-15:50)";}
if(cl >= 155000 && cl < 160000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (15:50-16:00)";}
if(cl >= 160000 && cl < 164000) {document.getElementById('mes_div').innerHTML="Идет 9-й урок (16:00-16:40)";}
if(cl >= 164000 && cl < 164500) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (16:40-16:45)";}
if(cl >= 164500 && cl < 172500) {document.getElementById('mes_div').innerHTML="Идет 10-й урок (16:45-17:25)";}
if(cl >= 172500 && cl < 173000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (17:25-17:30)";}
if(cl >= 173000 && cl < 181000) {document.getElementById('mes_div').innerHTML="Идет 11-й урок (17:30-18:10)";}
if(cl >= 181000 && cl < 181500) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (18:10-18:15)";}
if(cl >= 181500 && cl < 185500) {document.getElementById('mes_div').innerHTML="Идет 12-й урок (18:15-18:55)";}
if(cl >= 185500 && cl < 235959) {document.getElementById('mes_div').innerHTML=" ";}
Исходный код из "научно-практической" работы школьника.
Прихватил с конференции. (Не всё влезло)
+5
Результат работы нашего бывшего верстальщика.
http://pastebin.com/sDndiz9Q
Результат работы нашего бывшего верстальщика.
http://pastebin.com/sDndiz9Q
+1
<p class="name">
{% if (file.url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
{% } else { %}
<span>{%=file.name%}</span>
{% } %}
</p>
{% if (file.error!="SyntaxError: Unexpected token <") { %}
<div><span class="label label-danger">Error</span> {%=file.error%}</div>
{% } %}
Шедевральный человек! Оригинал http://www.yiiframework.ru/forum/viewtopic.php?t=15956#p119944
+1
void CScene::IncludeObjects()
{
// Reset All.
ExcludeObjects();
// fill Vershiny of piramid...
point3d versh[4];
point3d eye = {IniSet.ptCamPos.x, IniSet.ptCamPos.y, IniSet.ptCamPos.z};
Screen2World(0, 0, versh[0]);
Screen2World(nScreenSzX, 0, versh[1]);
Screen2World(nScreenSzX, nScreenSzY, versh[2]);
Screen2World(0, nScreenSzY, versh[3]);
// Increase before OO...
int ix, sz = parrObjs.Size();
point3d vect;
for(ix = 0; ix < 4; ix++){
sub_vectors(&vect.x, &versh[ix].x, &eye.x);
norm_vect(&vect.x);
scale_vect(&vect.x, 200.f);
versh[ix] = vect;
}
// Create faces of piramid and search collision with it...
point3d Piramid[4][3];
Piramid[0][0] = eye;
Piramid[1][0] = eye;
Piramid[2][0] = eye;
Piramid[3][0] = eye;
Piramid[0][1] = versh[0];
Piramid[0][2] = versh[1];
Piramid[1][1] = versh[1];
Piramid[1][2] = versh[2];
Piramid[2][1] = versh[2];
Piramid[2][2] = versh[3];
Piramid[3][1] = versh[3];
Piramid[3][2] = versh[0];
// Dyadya WALERA!!!!
for(ix = nObjOff; ix < sz; ix++){
CObj3d *pObj = parrObjs.e(ix);
pObj->Transform(FALSE);
point3d ptPos = pObj->GetPosition();
if(IniSet.nIncludeObjectMode == WS_INCLUDE_BARYCENTER){
point3d ptCentr = IniSet.ptCamTarget;
point3d vtVect;
sub_vectors(&vtVect.x, &ptPos.x, &ptCentr.x);
plane plGran;
point3d ptCross;
for(int jx = 0; jx < 4; jx++){
comp_plane_eqn(&plGran.a, &Piramid[jx][0].x, &Piramid[jx][1].x, &Piramid[jx][2].x);
cross_line_plane(vtVect, &plGran.a, ptCentr, ptCross);
float f1, f2;
f1 = plGran.a * ptPos.x + plGran.b * ptPos.y + plGran.c * ptPos.z + plGran.d;
f2 = plGran.a * ptCentr.x + plGran.b * ptCentr.y + plGran.c * ptCentr.z + plGran.d;
if(f1 * f2 < 0.f){
if(point_in_triangle(Piramid[jx][0], Piramid[jx][1], Piramid[jx][2], ptCross)){
ptCross = ConvertPos3D(ptCross);
if(IniSet.bMirrorH){ ptCross.y = -ptCross.y; }
if(IniSet.bMirrorV){ ptCross.x = -ptCross.x; }
if(IniSet.bMirrorD){ ptCross.z = -ptCross.z; }
transform_back_point(&ptCross, &ptCross, &IniSet.mtMatr);
pObj->ptSavedPos = ptCross;
break;
}
}
}
}else{ // XYZ Axes.
point3d vtXYZ[3] = {{1.f, 0.f, 0.f},
{0.f, 1.f, 0.f},
{0.f, 0.f, 1.f}};
BOOL bFound = FALSE;
for(int ax = 0; ax < 3; ax++){
point3d vtVect;
transform_point(&vtVect, &vtXYZ[ax], &IniSet.mtMatr);
for(int jx = 0; jx < 4; jx++){
plane plGran;
comp_plane_eqn(&plGran.a, &Piramid[jx][0].x, &Piramid[jx][1].x, &Piramid[jx][2].x);
point3d ptCentr = IniSet.ptCamTarget;
point3d ptCross;
cross_line_plane(vtVect, &plGran.a, ptPos, ptCross);
float f1, f2;
f1 = plGran.a * ptPos.x + plGran.b * ptPos.y + plGran.c * ptPos.z + plGran.d;
f2 = plGran.a * ptCentr.x + plGran.b * ptCentr.y + plGran.c * ptCentr.z + plGran.d;
point3d vtDif;
sub_vectors(&vtDif.x, &ptCross.x, &IniSet.ptCamPos.x);
if(vec_length(&vtDif.x) < 0.01f){ continue; } // avoid crossing with eye.
Гавнокод: включить все 3Д объекты в экран.
+2
public function get($userId = null, $advense = false) {
if ($userId === null) $userId = $this->currentId;
$user = DB::table('users')
->select(
'*',
DB::raw('IF(email IS NOT NULL AND email_confirm IS NULL, 1, 0) AS email_confirm'),
DB::raw('IF(phone IS NOT NULL AND phone_confirm IS NULL, 1, 0) AS phone_confirm'),
DB::raw('IF(birthday IS NOT NULL, TIMESTAMPDIFF(YEAR,birthday,CURDATE()), NULL) AS age'),
DB::raw('IF(phone IS NOT NULL AND phone_confirm IS NULL AND email IS NOT NULL AND email_confirm IS NULL AND (new_first_name IS NOT NULL OR new_last_name IS NOT NULL OR new_status_text IS NOT NULL OR new_image_url IS NOT NULL), 1, 0) AS on_moderate'))
->where('id', $userId)->first();
if ($user === null) throw new Exception ('User is not found', 404);
unset($user->password);
$user->locality = Geo::get($user->locality_id);
$rating = $this->rating($userId);
$user->rating = (float)$rating->avg;
$user->rating_counter = (int)$rating->cnt;
$user->counters = $this->getCounters($userId);
$contact = $this->contacts->isMyContact($userId);
if ($userId != $this->currentId) {
$user->created = null;
$user->updated = null;
$user->birthday = null;
$user->email_confirm = null;
$user->phone_confirm = null;
$user->subscribed = null;
$user->organizations = null;
$contact = $this->contacts->isMyContact($userId);
// Если пользователь не контакт авторизованного, сотрем контактную информацию
if ( $contact === null || $contact === 'declined') {
$user->phone = null;
$user->email = null;
$user->last_name = mb_substr($user->last_name, 0, 1, 'UTF-8');
}
} else {
if($user->new_first_name !== null) {
$user->first_name = $user->new_first_name;
}
if($user->new_last_name !== null) {
$user->last_name = $user->new_last_name;
}
if($user->new_image_url !== null) {
$user->image_url = $user->new_image_url;
}
if($user->new_status_text !== null) {
$user->status_text = $user->new_status_text;
}
$user->organizations = Organizations\Organizations::getByUserId($userId);
$user->is_followed = null;
$user->is_my_contact = null;
$user->has_my_contact = null;
$user->has_my_opinion = null;
}
unset($user->new_status_text);
unset($user->new_image_url);
unset($user->new_last_name);
unset($user->new_first_name);
unset($user->reset_code);
$user->is_followed = $this->followers->isFollowed($userId);
$user->is_my_contact = $this->contacts->isMyContact($userId);
$user->has_my_contact = $this->contacts->hasMyContact($userId);
return $user;
}
Тыдыдыдыдыыыц, laravel code О_О
Что же тут вообще происходит?
−10
if (0) {
unserialize ("");
is_bool ("");
is_array ("");
is_string ("");
is_integer ("");
is_float ("");
}
github.com/vk-com/kphp-kdb/blob/master/KPHP/functions.txt