- 1
- 2
- 3
- 4
- 5
public function extractPublicPlace($item)
{
list($a['name'], list($a['lat'], $a['lon'])) = $item;
return $a;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
public function extractPublicPlace($item)
{
list($a['name'], list($a['lat'], $a['lon'])) = $item;
return $a;
}
просто оставлю
+2
applications_menu_container.find('a').click(function () {
if ($(this).parent('.disabled').length === 0 || $(this).parent('.active').length === 0) {
applications_menu_container.find('li').removeClass('active');
$(this).parent().addClass('active');
switch ($(this).attr('id')) {
case 'active_applications':
applications_history_container.hide();
applications_history_pagination_toolbar.hide();
application_add_container.hide();
active_applications_sub_menu.hide();
change_application_sub_container.hide();
application_history_sub_container.hide();
application_files_sub_container.hide();
applications_history_sub_menu.hide();
historical_application_history_sub_container.hide();
historical_application_files_sub_container.hide();
load_active_applications(0, 10);
break;
case 'applications_history':
active_applications_container.hide();
active_applications_bottom_toolbar.hide();
application_add_container.hide();
active_applications_sub_menu.hide();
change_application_sub_container.hide();
application_history_sub_container.hide();
application_files_sub_container.hide();
applications_history_sub_menu.hide();
historical_application_history_sub_container.hide();
historical_application_files_sub_container.hide();
load_applications_history(0, 10);
break;
case 'new_application':
default:
active_applications_container.hide();
active_applications_bottom_toolbar.hide();
applications_history_container.hide();
applications_history_pagination_toolbar.hide();
active_applications_sub_menu.hide();
change_application_sub_container.hide();
application_history_sub_container.hide();
application_files_sub_container.hide();
applications_history_sub_menu.hide();
historical_application_history_sub_container.hide();
historical_application_files_sub_container.hide();
show_add_application_form();
break;
}
}
return false;
});
Переключение вкладок.
+1
public function k($heh) {
return ($heh == "") ? rand() : $heh;
}
// ...
$stars += count(array_intersect(
array($this->k($this->id_type), $this->k($this->id_type2), $this->k($this->id_type3)),
array($this->k($that->id_type), $this->k($that->id_type2), $this->k($that->id_type3))
));
// ...
не учитываем пустые id_type
+3
protected function onAfterDispatchInitUsersInactivityFeatureIfNotDisabled()
{
if (!$this->disableUserInactivityFeature)
$this->initUsersInactivityFeature();
}
−94
Для Каждого Ст Из ВремяФактическое Цикл
ВремяПрибытияНаЗагрузкуДляРасчета = ?(МаршрутыТаблица[Ст.НомерСтроки-1].ДатаПогрузкиПлан >= Ст.ВремяПрибытияНаЗагрузку,МаршрутыТаблица[Ст.НомерСтроки-1].ДатаПогрузкиПлан,Ст.ВремяПрибытияНаЗагрузку);
ВремяПрибытияНаВыгрузкуДляРасчета = ?(?(ЗначениеЗаполнено(МаршрутыТаблица[Ст.НомерСтроки-1].ДатаРазгрузкиПлан),МаршрутыТаблица[Ст.НомерСтроки-1].ДатаРазгрузкиПлан,Ст.ВремяПрибытияНаВыгрузку) >= Ст.ВремяПрибытияНаВыгрузку,?(ЗначениеЗаполнено(МаршрутыТаблица[Ст.НомерСтроки-1].ДатаРазгрузкиПлан),МаршрутыТаблица[Ст.НомерСтроки-1].ДатаРазгрузкиПлан,Ст.ВремяПрибытияНаВыгрузку),Ст.ВремяПрибытияНаВыгрузку);
ВремяНаПогрузке = -1*(ВремяПрибытияНаЗагрузкуДляРасчета - Ст.ВремяУбытияСЗагрузки)/60;//В минутах
ВремяНаВыгрузке = -1*(ВремяПрибытияНаВыгрузкуДляРасчета - Ст.ВремяУбытияСВыгрузки)/60;//В минутах
ОбщееВремя.Добавить(ВремяНаПогрузке+ВремяНаВыгрузке);
КонецЦикла;
Когда любишь тернарные операторы больше чем маму и президента.
+8
TOO_ENOUGH_DATA
+4
ob_start();
print_r($_GET);
$get = ob_get_contents();
ob_end_clean();
ob_start();
$m = $_POST;
$m["password"] = "********";
$m["pass1"] = "********";
$m["pass2"] = "********";
print_r($m);
$post = ob_get_contents();
ob_end_clean();
Экстремальный __toString для массивов (для последующей записи в лог)
+1
public EntityTypes GetEntityType(DBContext Entities, int EntityTypeID)
{
DateTime? Null = null;
var entityType = (from entitytypes in Entities.EntityTypes.Include("GlobalText").Include("GlobalText.GlobalTextInstance")
where entitytypes.EntityTypeId.Equals(EntityTypeID)
&& (Null == null ? entitytypes.ActiveUntil == null : entitytypes.ActiveUntil == Null)
select entitytypes).FirstOrDefault();
return entityType;
}
Помимо самой первозданной красоты этого куска, он, собственно, еще и продублирован в местах, эдак 12-15
+3
<?php
if ($site_url == 'http://'.$_SERVER['HTTP_HOST'].'/'){
if(!isset($_SESSION['access_token'])){
$all_likes = mysqli_result(mysqli_query($con, "SELECT sum(likes) FROM tb_members"),0,0);
?>
<div style="text-align:center; padding-top: 20px;">
<img src="<?=$site_url; ?>images/banner.jpg" alt="бесплатные лайки здесь">
</div>
<div style="text-align: center;">
<div class="form-search" id="loginform">
<?php
if($_POST['token']){
if(preg_match("/^[a-zA-Z0-9]+$/", $_POST['token'])){
$s = file_get_contents('http://ulogin.ru/token.php?token=' . $_POST['token'] . '&host=' . $_SERVER['HTTP_HOST']);
$user = json_decode($s, true);
if($user['network'] == "vkontakte"){
$id = preg_replace('|^(?:https?://)?vk\.com/?|i', '', $user['identity']);
if(mb_substr($id, 0, 2) == 'id')
$id = mb_substr($id, 2);
$id = str_replace('/', '', $id);
if($id!=""){
$num = mysqli_num_rows(mysqli_query($con, "SELECT id FROM tb_members WHERE uid = '".$id."'"));
$req = file_get_contents("https://api.vk.com/method/users.get?fields=photo_100&uids=".$id);
$data_user = json_decode($req, true);
$time = time()+(24*3600);
if($num==0){
if($_SESSION['referer']!=""){
$num = mysqli_num_rows(mysqli_query($con, "SELECT id FROM tb_members WHERE uid = '".$_SESSION['referer']."'"));
if($num==1){
mysqli_query($con, "UPDATE tb_members SET likes = likes + '".$refl."', money = money + '".$refm."', refs = refs + 1 WHERE uid = '".$_SESSION['referer']."'") OR die(mysql_error());
$time = time();
$message = "Новый реферал. <strong>VK ID: ".$id."</strong>";
mysqli_query($con, "INSERT INTO tb_events (`uid`,`message`,`time`) VALUES ('".$_SESSION['referer']."','$message','$time')");
}else{
$_SESSION['referer']="";
}
}
mysqli_query($con, "INSERT INTO tb_members (`uid`,`name`,`likes`,`lastname`,`referer`,`bonus`,`registration_date`) VALUES ('".$id."','".$data_user["response"][0]["first_name"]."','".$rbon."','".$data_user["response"][0]["last_name"]."','".$_SESSION['referer']."',$time,'".time()."')");
echo '<script type="text/javascript">alert("Вам начислен ежедневный бонус в '.$rbon.' лайков! :)");</script> ';
}
$row = mysqli_fetch_array(mysqli_query($con, "SELECT id, bonus, pro FROM tb_members WHERE uid = '".$id."'"));
session_unset();
$_SESSION["access_token"] = true;
$_SESSION["site_id"] = $row["id"];
$_SESSION["user_id"] = $id;
$_SESSION["img"] = $data_user["response"][0]["photo_100"];
$id = $row['id'];
mysqli_query($con, "UPDATE tb_members SET visit_date = ".time()." WHERE id = $id");
if($row['bonus']<time()){
if(status_pro($row['pro']) == true){
$dbon = $premiumbon;
mysqli_query($con, "UPDATE tb_members SET rating = rating + $premiumratind_bon WHERE id = $id");
mysqli_query($con, "UPDATE tb_members SET likes = likes + $dbon, bonus = $time WHERE id = $id");
echo '<script type="text/javascript">alert("Вам начислен ежедневный бонус в '.$dbon.' лайков и +'.$premiumratind_bon.' баллов рейтинга! :)");</script> ';
}else{
mysqli_query($con, "UPDATE tb_members SET likes = likes + $dbon, bonus = $time WHERE id = $id");
echo '<script type="text/javascript">alert("Вам начислен ежедневный бонус в '.$dbon.' лайков! :)");</script> ';
}
$a = mysqli_fetch_array(mysqli_query($con, "SELECT * FROM tb_members WHERE id = $id"));
$b = $a['referral_rate'];
if($a['refs'] > 0){
mysqli_query($con, "UPDATE tb_members SET likes = likes + referral_rate WHERE id = $id");
echo '<script type="text/javascript">alert("Вам начислено '.$b.' баллов от рефералов");</script> ';
mysqli_query($con, "UPDATE tb_members SET referral_rate = referral_rate - referral_rate WHERE id = $id");
}
}
?>
<script type="text/javascript">
location.replace("/");
</script>
<?php
}
}
}
}
Class login{
var $user;
var $AllStatus = array();
function __construct($AllStatus){
global $con;
$this -> AllStatus = $AllStatus;
if(isset($_POST['second'])){
$check = $this -> second_check();
if($check != NULL){
echo '<span style="color:#b32d2d; font-size:18px;">Ошибка: '.$check.'</span>';
}else{
$this -> ouath();
echo '<script type="text/javascript">location.replace("/");</script>';
return;
}
}
if(isset($_SESSION['vkk'])){
$this -> second();
return;
}
if(isset($_POST['subm'])){
$check = $this -> checkForm();
if($check != NULL){
Куча с toplikers.ru. Наклали так наклали.. И весь "проект" такой
0
<?php
$urlcontent=file_get_contents("http://services.swpc.noaa.gov/text/3-day-solar-geomag-predictions.txt");
$smm[1]=0;
$smm[2]=0;
$smm[3]=0;
$smm[4]=0;
$smm[5]=0;
$smm[6]=0;
for ($j=0; $j<24; $j=($j+3)){
$rgs = "~High\/".swt($j)."UT\s{1,}(\d{1,2})\s{1,}(\d{1,2})\s{1,}(\d{1,2})\n~";
preg_match($rgs,$urlcontent,$ball);
$smm[1]=$smm[1]+$ball[1];
$smm[2]=$smm[2]+$ball[2];
$smm[3]=$smm[3]+$ball[3];
if ($smm[4]<$ball[1]) $smm[4]=$ball[1];
if ($smm[5]<$ball[2]) $smm[5]=$ball[2];
if ($smm[6]<$ball[3]) $smm[6]=$ball[3];
}
$smm[1]=$smm[1]/8;
$smm[2]=$smm[2]/8;
$smm[3]=$smm[3]/8;
$rgs = "~Mid/Minor_Storm\s{1,}(\d{1,2})\s{1,}(\d{1,2})\s{1,}(\d{1,2})\n~";
preg_match($rgs,$urlcontent,$ball1);
$rgs = "~High/Minor_Storm\s{1,}(\d{1,2})\s{1,}(\d{1,2})\s{1,}(\d{1,2})\n~";
preg_match($rgs,$urlcontent,$ball2);
$result = '<table BORDER=1>
<tbody>
<tr>
<td>February 25 </td>
<td>February 26 </td>
<td>February 27 </td>
</tr>
<tr>
<td>'.$smm[4].'<br> Max Kp </td>
<td>'.$smm[5].'<br> Max Kp </td>
<td>'.$smm[6].'<br> Max Kp </td>
</tr>
<tr>
<td>
Prob-M '.$ball1[1].'%<br>
Prob-H '.$ball2[1].'%
</td>
<td>
Prob-M '.$ball1[2].'%<br>
Prob-H '.$ball2[2].'%
</td>
<td>
Prob-M '.$ball1[3].'%<br>
Prob-H '.$ball2[3].'%
</td>
</tr>
</tbody>
</tabbe>';
echo $result;
//$resp = json_encode($result);
//echo $resp;
// ---functions ---------
...
наговнокодил лично чтоб в табличном виде представлять данные и текстового файла