public function test_time_conversions() { $this->assertEquals(172800, convert_time(2, 'days', 'seconds')); $this->assertEquals(2880, convert_time(2, 'days', 'minutes')); $this->assertEquals(48, convert_time(2, 'days', 'hours')); $this->assertEquals(1, convert_time(450, 'days', 'years')); $this->assertEquals(1209600, convert_time(2, 'weeks', 'seconds')); $this->assertEquals(20160, convert_time(2, 'weeks', 'minutes')); $this->assertEquals(336, convert_time(2, 'weeks', 'hours')); $this->assertEquals(1, convert_time(60, 'weeks', 'years')); }
/** * Turn a date/timestamp into select boxes * * @param mixed $time * @param string $prefix prefix elements with * @return string */ function date_to_select($time = null, $name = 'date') { //If it is a timestamp - make an array if (!ctype_digit($time) or !$time) { $time = convert_time($time); } //Convert to an array $time = timestamp_to_array($time); $output = array(); foreach ($time as $type => $value) { $output[$type] = '<select name="' . $name . '[' . $type . ']" class="' . $type . '">' . "\n"; //Create years if ($type == 'year') { for ($x = -2; $x <= 2; $x++) { $year = $value + $x; $output[$type] .= "\t" . '<option value="' . $year . '"' . ($year == $value ? ' selected="selected"' : '') . '>' . $year . '</option>' . "\n"; } } //Create months if ($type == 'month') { /* We need to hard code the months because timezones can throw off the PHP date function and return two month choices that are the same. */ $months = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec'); for ($x = 1; $x <= 12; $x++) { $output[$type] .= "\t" . '<option value="' . $x . '"' . ($x == $value ? ' selected="selected"' : '') . '>' . $months[$x] . '</option>' . "\n"; } } // Cannot caculate days based off current month! So we must just list all 32! if ($type == 'day') { for ($x = 1; $x < 32; $x++) { $output[$type] .= "\t" . '<option value="' . $x . '"' . ($x == $value ? ' selected="selected"' : '') . '>' . $x . '</option>' . "\n"; } } if ($type == 'hour') { for ($x = 1; $x < 24; $x++) { $output[$type] .= "\t" . '<option value="' . $x . '"' . ($x == $value ? ' selected="selected"' : '') . '>' . $x . '</option>' . "\n"; } } if ($type == 'minute' or $type == 'second') { for ($x = 0; $x < 60; $x += 5) { $output[$type] .= "\t" . '<option value="' . $x . '"' . ($value >= $x && $value <= $x + 4 ? ' selected="selected"' : '') . '>' . $x . '</option>' . "\n"; } } //Close $output[$type] .= '</select>' . "\n"; } return $output; }
public function index_json() { $dateFrom = $this->input->post('dateFrom'); $dateTo = $this->input->post('dateTo'); // do we have valid dates? is_date($dateFrom); is_date($dateTo); // include timezone adjustment $dateFromTimeZone = $this->input->post('dateFromTimeZone'); $dateToTimeZone = $this->input->post('dateToTimeZone'); // convert strings to date objects including the time zone $dateFrom = new DateTime($dateFrom . ' ' . $dateFromTimeZone); $dateTo = new DateTime($dateTo . ' ' . $dateToTimeZone); // check if dateFrom is earlier than dateTo, if not then swap them over, we are caldulating // the difference so this should be fine. if ($dateFrom->getTimestamp() > $dateTo->getTimestamp()) { $tempDate2 = $dateFrom; $dateFrom = $dateTo; $dateTo = $tempDate2; } // build up an objct to return as json $numberOfDays = number_of_days($dateFrom, $dateTo); $numberOfDaysResults = new stdClass(); $numberOfDaysResults->days = $numberOfDays; $numberOfDaysResults->seconds = convert_time($numberOfDays, "days", "seconds"); $numberOfDaysResults->minutes = convert_time($numberOfDays, "days", "minutes"); $numberOfDaysResults->hours = convert_time($numberOfDays, "days", "hours"); $numberOfDaysResults->years = convert_time($numberOfDays, "days", "years"); $numberOfWeekDays = number_of_weekdays($dateFrom, $dateTo); $numberOfWeekDaysResults = new stdClass(); $numberOfWeekDaysResults->days = $numberOfWeekDays; $numberOfWeekDaysResults->seconds = convert_time($numberOfWeekDays, "days", "seconds"); $numberOfWeekDaysResults->minutes = convert_time($numberOfWeekDays, "days", "minutes"); $numberOfWeekDaysResults->hours = convert_time($numberOfWeekDays, "days", "hours"); $numberOfWeekDaysResults->years = convert_time($numberOfWeekDays, "days", "years"); $numberOfCompleteWeeks = number_of_complete_weeks($dateFrom, $dateTo); $numberOfCompleteWeeksResults = new stdClass(); $numberOfCompleteWeeksResults->weeks = $numberOfCompleteWeeks; $numberOfCompleteWeeksResults->seconds = convert_time($numberOfCompleteWeeks, "weeks", "seconds"); $numberOfCompleteWeeksResults->minutes = convert_time($numberOfCompleteWeeks, "weeks", "minutes"); $numberOfCompleteWeeksResults->hours = convert_time($numberOfCompleteWeeks, "weeks", "hours"); $numberOfCompleteWeeksResults->years = convert_time($numberOfCompleteWeeks, "weeks", "years"); $dateCalcResults = new stdClass(); $dateCalcResults->numberOfDays = $numberOfDaysResults; $dateCalcResults->numberOfWeekDays = $numberOfWeekDaysResults; $dateCalcResults->numberOfCompleteWeeks = $numberOfCompleteWeeksResults; // output as json $this->output->set_content_type('application/json')->set_output(json_encode($dateCalcResults)); }
function tzs_tr_sh_table_record_out($row, $form_type, $profile_td_text = null) { // $user_info = tzs_get_user_meta($row->user_id); if ($form_type === 'shipments') { $prefix = 'sh'; } else { $prefix = 'tr'; } $type = trans_types_to_str($row->trans_type, $row->tr_type); $path_segment_cities = explode(";", $row->path_segment_cities); //$cost = tzs_cost_to_str($row->cost, true); $cost = tzs_price_query_to_str($row); $dt_created = convert_time($row->time, "d.m.Y (Hч:iмин)"); $dt_created = explode(" ", $dt_created); if ($row->dt_pickup != '0000-00-00 00:00:00') { $dt_pickup = convert_time($row->dt_pickup, "d.m.Y (Hч:iмин)"); $dt_pickup = explode(" ", $dt_pickup); } else { $dt_pickup = ''; } // Определение статуса записи $output_tbody = '<tr rid="' . $row->id . '"'; if ($row->top_status == 2) { $output_tbody .= $row->order_status == 1 ? ' class="vip_top_record"' : ($profile_td_text && $row->order_status !== null && $row->order_status == 0 ? ' class="pre_vip_top_record"' : ''); } else { if ($row->top_status == 1) { $output_tbody .= ' class="top_record"'; } else { } } $output_tbody .= '>'; if ($profile_td_text == 'no') { $output_tbody .= '<td><input type="radio" order-status="' . ($row->order_status == null ? '' : $row->order_status) . '" top-status="' . $row->top_status . '" order-id="' . $row->order_id . '" record-active="' . $row->active . '" id="r_table_record_id" name="r_table_record_id" value="' . $row->id . '"'; if (isset($_POST['table_record_id']) && $_POST['table_record_id'] == "{$row->id}") { $output_tbody .= 'checked="checked"'; } $output_tbody .= '></td>'; } /* <div class="record_number"> <span class="middle" title="Номер заявки"> № '.$row->id.' </span> </div><br> */ $output_tbody .= ' <td> <div class="date_label" title="Дата публикации заявки"> ' . $dt_created[0] . ' </div> <div class="time_label" title="Время публикации заявки"> ' . str_replace(':', ' : ', $dt_created[1]) . ' </div><br>'; if ($dt_pickup != '') { $output_tbody .= '<div class="date_label" title="Дата бесплатного поднятия заявки в ТОП"> ' . $dt_pickup[0] . ' </div> <div class="time_label" title="Время бесплатного поднятия заявки в ТОП"> ' . str_replace(':', ' : ', $dt_pickup[1]) . ' </div>'; } $output_tbody .= '</td> <td style="min-width: 260px; width: 260px;"> <div class="tbl_trucks_path_td"> <div class="city_label">' . htmlspecialchars(tzs_get_city($row->from_sid)) . (count($path_segment_cities) > 2 ? '...' : '') . '</div> <div class="country_flag"><img id ="first_city_flag" src="/wp-content/plugins/tzs/assets/images/flags/' . $row->from_code . '.png" width=18 height=12 alt=""></div> </div> <div class="tbl_trucks_dtc_td"> <div class="date_from_label" title="Дата погрузки"> ' . convert_date_year2($prefix === 'tr' ? $row->tr_date_from : $row->sh_date_from) . '<br/> </div> </div> <div class="tbl_trucks_path_td"> <div class="region_label">' . ($row->from_rid != NULL && $row->from_rid > 0 && $row->from_rid != 20070188 ? str_replace('область', 'обл.', htmlspecialchars(tzs_get_region($row->from_rid))) : ' ') . '</div> </div> <div class="tbl_distance_td2"> <div class="distance_label"> '; if ($row->distance > 0 && $prefix === 'tr') { //$output_tbody .= ' расстояние '.tzs_make_distance_link($row->distance, false, array($row->tr_city_from, $row->tr_city_to)); $output_tbody .= ' расстояние ' . tzs_make_distance_link($row->distance, false, explode(";", $row->path_segment_cities)); } else { if ($row->distance > 0 && $prefix === 'sh') { //$output_tbody .= ' расстояние '.tzs_make_distance_link($row->distance, false, array($row->sh_city_from, $row->sh_city_to)); $output_tbody .= ' расстояние ' . tzs_make_distance_link($row->distance, false, explode(";", $row->path_segment_cities)); } } $output_tbody .= ' (см. карту)</div>'; $output_tbody .= ' </div> <div class="tbl_trucks_path_td"> <div class="city_label">' . (count($path_segment_cities) > 2 ? '...' : '') . htmlspecialchars(tzs_get_city($row->to_sid)) . '</div> <div class="country_flag"><img id ="second_city_flag" src="/wp-content/plugins/tzs/assets/images/flags/' . $row->to_code . '.png" width=18 height=12 alt=""></div> </div> <div class="tbl_trucks_dtc_td"> <div class="date_to_label" title="Дата выгрузки"> ' . convert_date_year2($prefix === 'tr' ? $row->tr_date_to : $row->sh_date_to) . ' </div> </div> <div class="tbl_trucks_path_td"> <div class="region_label">' . ($row->to_rid != NULL && $row->to_rid > 0 && $row->to_rid != 20070188 ? str_replace('область', 'обл.', htmlspecialchars(tzs_get_region($row->to_rid))) : ' ') . '</div>'; if ($row->cash + $row->nocash + $row->way_ship + $row->way_debark + $row->soft + $row->way_prepay > 5) { $output_tbody .= '<div> <div>'; } $output_tbody .= ' </div> </td>'; if ($prefix === 'sh') { $output_tbody .= '<td> <div title="Тип груза">' . (isset($GLOBALS['tzs_sh_types'][$row->sh_type]) ? $GLOBALS['tzs_sh_types'][$row->sh_type] : '') . '</div><br> <div class="tr_type_label" title="Тип транспортного средства">' . $type . '</div> </td>'; $output_tbody .= '<td><div>'; if ($row->tr_weight > 0 || $row->sh_weight > 0) { $output_tbody .= '<span title="Вес груза">' . remove_decimal_part($prefix === 'tr' ? $row->tr_weight : $row->sh_weight) . ' т</span><br>'; } if ($row->tr_volume > 0 || $row->sh_volume > 0) { $output_tbody .= '<span title="Объем груза">' . remove_decimal_part($prefix === 'tr' ? $row->tr_volume : $row->sh_volume) . ' м³</span>'; } $output_tbody .= '</div></td> <td><div title="Описание груза">' . $row->sh_descr . '</div></td>'; } else { $output_tbody .= '<td> <div class="tr_type_label" title="Тип транспортного средства">' . $type . '</div> </td> <td><div title="Описание транспортного средства">'; $tr_ds1 = ''; $tr_ds2 = ''; if ($row->tr_length > 0) { $tr_ds1 .= 'Д'; $tr_ds2 .= intval($row->tr_length); } if ($row->tr_width > 0) { if ($tr_ds1 !== '') { $tr_ds1 .= 'x'; } if ($tr_ds2 !== '') { $tr_ds2 .= 'x'; } $tr_ds1 .= 'Ш'; $tr_ds2 .= intval($row->tr_width); } if ($row->tr_height > 0) { if ($tr_ds1 !== '') { $tr_ds1 .= 'x'; } if ($tr_ds2 !== '') { $tr_ds2 .= 'x'; } $tr_ds1 .= 'В'; $tr_ds2 .= intval($row->tr_height); } if ($tr_ds1 !== '' && $tr_ds2 !== '') { $output_tbody .= $tr_ds1 . ': ' . $tr_ds2 . ' м<br>'; } if ($row->tr_weight > 0) { $output_tbody .= remove_decimal_part($row->tr_weight) . ' т<br>'; } if ($row->tr_volume > 0) { $output_tbody .= remove_decimal_part($row->tr_volume) . ' м³<br>'; } if ($row->tr_descr && strlen($row->tr_descr) > 0) { $output_tbody .= $row->tr_descr . '<br>'; } $output_tbody .= '</div></td> <td><div title="Желаемый груз">' . $row->sh_descr . '</div></td>'; } $output_tbody .= '<td>'; //if ($row->price > 0) { // round($row->price / $row->distance, 2).' '.$GLOBALS['tzs_curr'][$row->price_val]. // number_format($row->cost, 0, '.', ' ').' '.$GLOBALS['tzs_curr'][$row->price_val].'<div><br> // $row->price.' '.$GLOBALS['tzs_curr'][$row->price_val]. // '/км)</div>'; $output_tbody .= '<div class="price_label" title="Стоимость перевозки груза">' . $cost[0] . '<div><br>'; if (strlen($cost[1]) > 0) { $output_tbody .= '<div class="cost_label" title="Цена за 1 км перевозки груза">(' . $cost[1] . ')</div>'; } //} else { // $output_tbody .= '<div class="price_label" title="Стоимость перевозки груза">'.$cost[0].'</div>'; //} // <div class="payment_label" title="Форма оплаты услуг по перевозке груза">'.$cost[1].'</div> $output_tbody .= ' </td> <td> <div class="payment_label" title="Форма оплаты услуг по перевозке груза">' . str_replace(', ', ',<br>', $cost[2]) . '</div> </td>'; //<div class="payment_label" title="Форма оплаты услуг по перевозке груза">'.str_replace(', ', ',<br>', $cost[1]).'</div> if ($prefix === 'tr') { //$output_tbody .= '<td><div title="Комментарии">'.$row->comment.'</div></td>'; } if ($profile_td_text == 'no') { $output_tbody .= ''; } else { if ($profile_td_text) { $output_tbody .= '<td>' . $profile_td_text . '</td>'; } else { $output_tbody .= '<td>' . tzs_print_user_contacts($row, $form_type, 0) . '</td>'; } } $output_tbody .= '</tr>'; return $output_tbody; }
mysql_query("UPDATE users SET money=money+" . $money . " WHERE login='******'"); mysql_query("INSERT INTO les (user_id, take) VALUES('" . $db["id"] . "','" . $_POST['takemoney'] . "')"); $money = $money . " Зл."; history($login, 'Нашел ', $money, $ip, 'Темный Лес'); echo "<b style='color:green'>Вы нашли " . $money . " !!!</b>"; } else { echo "<b style='color:#ff0000'>Ничего не произошло!!!</b>"; } } else { if ($_SESSION['captcha_keystring'] != $_POST['keystring']) { echo "<b style='color:#ff0000'>Ошибка при введении кода!!!</b>"; } } } unset($_SESSION['captcha_keystring']); echo "<div align=right><b style='color:#ff0000'>Ещё: " . convert_time($db['walktime']) . "</b>"; echo " <input type='button' class='btn' onclick=\"window.location='?action=vixod'\" value='Выход'></div>"; //---------------------------------------------------- if (!isset($_SESSION["xy"])) { $_SESSION["xy"] = "9x4"; $xx = 9; $yy = 4; } else { $cor = explode("x", $_SESSION["xy"]); $xx = $cor[0]; $yy = $cor[1]; } //------------BATLLE WHEN WALK-------------------------------------- if ($_GET["action"] == 'walk') { $at = rand(0, 100); if ($at > 75) {
echo " <a href='?action=del_topic_full&fid={$fid}&tid={$tid}&id={$top_id}' style='text-decoration:none;font-size:8pt;color:#99CC99;'>[Удалить Полностью]</a>"; } echo "</td></tr></table>"; echo "<br>" . $msg . "<br><br></td>\n\t\t\t\t</tr>"; } echo "</table>"; } } if (isset($_SESSION["login"]) && $USER_DATA['forum_shut'] < time() && $USER_DATA["level"] >= 4) { include "inc_message.php"; } else { if (!isset($_SESSION["login"])) { echo "<center><i>Вы не авторизованы</i></center>"; } else { if ($USER_DATA['forum_shut'] > time()) { echo "<center><small>Персонаж бедет молчать на форуме ещё " . convert_time($USER_DATA['forum_shut']) . " </small></center>"; } } } } ?> <table border=0 cellspacing=0 cellpadding=0 bgcolor=#d0eed0 width=100%> <tr><td bgcolor=#003300></td></tr> <tr><td width=30% align=right> <?php include "../counter.php"; ?> </td></tr> <tr><td bgcolor=#003300></td></tr> </table> <div id=hint4 style="VISIBILITY: hidden; WIDTH: 240px; POSITION: absolute;top:160px; left:40px;"></div>
$abodata['listes'][$row['liste_id']]['archives'][] = $row; } $output->addHiddenfield('mode', 'archives'); $output->page_header(); $output->set_filenames(array('body' => 'archives_body.tpl')); $output->assign_vars(array('TITLE' => $lang['Title']['archives'], 'L_EXPLAIN' => $lang['Explain']['archives'], 'L_VALID_BUTTON' => $lang['Button']['valid'], 'S_HIDDEN_FIELDS' => $output->getHiddenFields())); foreach ($abodata['listes'] as $liste_id => $listdata) { if (!isset($abodata['listes'][$liste_id]['archives'])) { continue; } $num_logs = count($abodata['listes'][$liste_id]['archives']); $size = $num_logs > 8 ? 8 : $num_logs; $select_log = '<select id="liste_' . $liste_id . '" name="log[' . $liste_id . '][]" class="logList" size="' . $size . '" multiple="multiple" style="min-width: 200px;">'; for ($i = 0; $i < $num_logs; $i++) { $logrow = $abodata['listes'][$liste_id]['archives'][$i]; $select_log .= '<option value="' . $logrow['log_id'] . '"> – ' . htmlspecialchars(cut_str($logrow['log_subject'], 40), ENT_NOQUOTES); $select_log .= ' [' . convert_time('d/m/Y', $logrow['log_date']) . ']</option>'; } $select_log .= '</select>'; $output->assign_block_vars('listerow', array('LISTE_ID' => $liste_id, 'LISTE_NAME' => $listdata['liste_name'], 'SELECT_LOG' => $select_log)); } $output->pparse('body'); break; default: $output->page_header(); $output->set_filenames(array('body' => 'index_body.tpl')); $output->assign_vars(array('TITLE' => $lang['Title']['profil_cp'], 'L_EXPLAIN' => nl2br($lang['Welcome_profil_cp']))); $output->pparse('body'); break; } $output->page_footer();
if ($num_inscrits == 1) { $l_num_inscrits = sprintf($lang['Registered_subscriber'], wa_number_format($num_inscrits / $days)); } else { $l_num_inscrits = $lang['No_registered_subscriber']; } } if ($num_temp > 1) { $l_num_temp = sprintf($lang['Tmp_subscribers'], $num_temp); } else { if ($num_temp == 1) { $l_num_temp = $lang['Tmp_subscriber']; } else { $l_num_temp = $lang['No_tmp_subscriber']; } } $output->build_listbox(AUTH_VIEW, false, './view.php?mode=liste'); $output->page_header(); $output->set_filenames(array('body' => 'index_body.tpl')); if ($num_logs > 0) { if ($num_logs > 1) { $l_num_logs = sprintf($lang['Total_newsletters'], $num_logs, wa_number_format($num_logs / $month)); } else { $l_num_logs = sprintf($lang['Total_newsletter'], wa_number_format($num_logs / $month)); } $output->assign_block_vars('switch_last_newsletter', array('DATE_LAST_NEWSLETTER' => sprintf($lang['Last_newsletter'], convert_time($nl_config['date_format'], $last_log)))); } else { $l_num_logs = $lang['No_newsletter_sended']; } $output->assign_vars(array('TITLE_HOME' => $lang['Title']['accueil'], 'L_EXPLAIN' => nl2br($lang['Explain']['accueil']), 'L_DBSIZE' => $lang['Dbsize'], 'L_FILESIZE' => $lang['Total_Filesize'], 'REGISTERED_SUBSCRIBERS' => $l_num_inscrits, 'TEMP_SUBSCRIBERS' => $l_num_temp, 'NEWSLETTERS_SENDED' => $l_num_logs, 'DBSIZE' => is_numeric($dbsize) ? formateSize($dbsize) : $dbsize, 'FILESIZE' => formateSize($filesize))); $output->pparse('body'); $output->page_footer();
echo "<b style='color:brown'>Doyuw sisteminin Deyiwenleri:</b><BR>"; echo "creator: <b>" . $res['battle_pos'] . "</b><BR>"; echo "bid: <b>" . $res['battle'] . "</b><BR>"; echo "zayavka: <b>" . $res['zayavka'] . "</b><BR>"; echo "team: <b>" . $res['battle_team'] . "</b><hr>"; $k = mysql_fetch_array(mysql_query("SELECT * FROM teams WHERE player='" . $res['login'] . "'")); echo "team: <b>" . (int) $k['team'] . "</b><BR>"; echo "battle_id: <b>" . (int) $k['battle_id'] . "</b><hr>"; echo "Zayava: <b>" . (int) $res['zayava'] . "</b><hr>"; echo "</TD></TR></TABLE>"; echo "<br><table width=500 class='l3' cellpadding=5 cellspacing=1><tr class='l1'><td>"; echo "<b style='color:brown'>—осто¤ние:</b><br>"; $s = mysql_query("SELECT * FROM effects LEFT JOIN scroll on scroll.id=effects.elik_id WHERE effects.user_id=" . $res["id"]); while ($sc = mysql_fetch_array($s)) { $kkk++; echo "<img src='img/" . $sc["img"] . "' border=0 alt='" . $sc["name"] . "\n" . $sc["descs"] . "\n" . "≈ще " . convert_time($sc['end_time']) . "'> "; if ($kkk % 6 == 0) { echo "<br>"; } } echo "</TD></TR></TABLE>"; echo "<br><table width=500 class='l3' cellpadding=5 cellspacing=1><tr class='l1'><td>"; echo "<b style='color:brown'>”ровень брони:</b><br>"; echo " Х Ѕрон¤ головы: <b>" . ceil($res["bron_head"]) . "</b><br>\n\t\t\t Х Ѕрон¤ корпуса: <b>\t" . ceil($res["bron_corp"]) . "</b><br>\n\t\t\t Х Ѕрон¤ по¤са: <b>\t" . ceil($res["bron_poyas"]) . "</b><br>\n\t\t\t Х Ѕрон¤ ног: <b>\t\t" . ceil($res["bron_legs"]) . "</b><br><br>\n\t\t\t\n\t\t\t Х «ащита от режущего урона: <b>" . ceil($res["protect_rej"] + $effect["p_rej"]) . "</b><br>\n\t\t\t Х «ащита от дроб¤щего урона:<b>" . ceil($res["protect_drob"] + $effect["p_drob"]) . "</b><br>\n\t\t\t Х «ащита от колющего урона: <b>" . ceil($res["protect_kol"] + $effect["p_kol"]) . "</b><br>\n\t\t\t Х «ащита от руб¤щего урона: <b>" . ceil($res["protect_rub"] + $effect["p_rub"]) . "</b><br><br>\n\t\t\n\t\t\t Х «ащита от урона: <b>" . ceil($res["protect_udar"] + $effect["add_bron"] + $res["power"] * 1.5) . "</b><br>\n\t\t\t Х «ащита от магии: <b>" . ceil($res["protect_mag"] + $effect["add_mg_bron"] + $res["power"] * 1.5) . "</b><br><br>\n\t\t\t\n\t\t\t Х ѕонижение защиты от магии ќгн¤: \t<b>" . ceil($res["protect_fire"] + $effect["protect_fire"]) . "</b><br>\n\t\t\t Х ѕонижение защиты от магии ¬оды: \t<b>" . ceil($res["protect_water"] + $effect["protect_water"]) . "</b><br>\n\t\t\t Х ѕонижение защиты от магии ¬оздуха: \t<b>" . ceil($res["protect_air"] + $effect["protect_air"]) . "</b><br>\n\t\t\t Х ѕонижение защиты от магии «емли: \t<b>" . ceil($res["protect_earth"] + $effect["protect_earth"]) . "</b><br>\n\t\t\t Х ѕонижение защиты от магии —вета: \t<b>" . ceil($res["protect_svet"] + $effect["protect_svet"]) . "</b><br>\n\t\t\t Х ѕонижение защиты от магии “ьмы: \t<b>" . ceil($res["protect_tma"] + $effect["protect_tma"]) . "</b><br>\n\t\t\t Х ѕонижение защиты от —ерой магии: \t<b>" . ceil($res["protect_gray"] + $effect["protect_gray"]) . "</b><br><br>\n\t\t\t\t\n\t\t\t Х ћф.блока щитом: <b>" . ceil($res["shieldblock"]) . "</b><br><br>\n\t\n\t\t\t</td></tr></table>"; echo "<br><table width=500 class='l3' cellpadding=5 cellspacing=1><tr class='l1'>\n\t\t\t<td valign=top>"; $k1 = mysql_fetch_array(mysql_query("SELECT is_modified, add_rej, add_drob, add_kol, add_rub FROM `inv` WHERE id=" . $res["hand_r"])); $k2 = mysql_fetch_array(mysql_query("SELECT is_modified, add_rej, add_drob, add_kol, add_rub FROM `inv` WHERE id=" . $res["hand_l"])); $mf_rub1 = $k1["add_rub"]; $mf_kol1 = $k1["add_kol"]; $mf_drob1 = $k1["add_drob"]; $mf_rej1 = $k1["add_rej"];
$bottommenu = "<a href='?panel=all&{$getinc}bots'><b>All Bots</b></a> ||\n\t\t<a href='?panel=online&{$getinc}bots'><b>Online Bots</b></a> ||\n\t\t<a href='?panel=offline&{$getinc}bots'><b>Offline Bots</b></a> ||\n\t\t<a href='?panel=active&{$getinc}bots'><b>Active Bots</b></a> ||\n\t\t<a href='?panel=dead&{$getinc}bots'><b>Dead Bots</b></a>"; if (isset($_GET['del'])) { $del = $db->prepare("DELETE FROM bots WHERE id = ? LIMIT 1;"); if ($del->execute(array($_GET['del']))) { echo "Deleted"; } } foreach ($db->query("SELECT * FROM bots") as $bot) { $lasttime = round($bot['connect']); $disptime = $time - $lasttime; if ($disptime > $knocktime) { $lastconnect = "<span style='color: #CC0000;'>" . convert_time($disptime) . "</span>"; } else { $lastconnect = convert_time($disptime); } $info = '<tr><td>' . $bot['id'] . "</td><td>" . $bot['version'] . "</td><td>" . $bot['os'] . "</td><td>" . $bot['ip'] . "</td><td>" . $bot['country'] . "</td><td>" . convert_time($bot['idle']) . "</td><td>" . $lastconnect . "</td><td style='text-align: center;'><a href='?panel={$_GET['panel']}&{$getinc}bots&del={$bot['id']}'>X</a></td></tr>"; $offlinetime = $knocktime * 3; if ($disptime <= $offlinetime) { $online[] = $info; $onlinebots++; } else { if ($disptime <= $deadtime) { $offlinebots++; $offline[] = $info; } else { $deadbots++; $dead[] = $info; } } } $totalbots = $onlinebots + $offlinebots;
} //--------------------------------------------------- if (isset($_POST['text']) && $_POST['text'] != "") { $text = htmlspecialchars(addslashes(trim($_POST['text']))); $text = wordwrap($text, 40, " ", 1); $next_time = time() + 24 * 3600; $now = time(); $find = @mysql_fetch_array(mysql_query("SELECT * FROM elka WHERE login='******' ORDER BY time DESC LIMIT 1")); $my_time = $find['time']; if ($my_time <= $now) { mysql_query("LOCK TABLES elka WRITE"); mysql_query("INSERT INTO elka (text,login,time,type,year) VALUES ('" . $text . "','" . $login . "','" . $next_time . "','" . $text_type . "','" . $year . "')"); mysql_query("UNLOCK TABLES"); $msg = " Ваше пожелание успешно добавлено..."; } else { $msg = "Ещё: " . convert_time($my_time); } } //--------------------------------------------------- //type=1 Ad gunu //type=2 New Year //--------------------------------------------------- ?> <body style="background-image: url(img/index/elka.jpg);background-repeat:no-repeat;background-position:top right"> <h3><?php echo $h3; if ($veteran) { echo " (Вы ветеран)"; } ?> </h3>
echo $item['title']; ?> </a> <br /> <?php echo $data['category'][$item['cate_id']]; ?> </td> <td> <?php echo nl2br($item['short_text']); ?> </td> <td> <?php echo convert_time($item['created']); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <?php if (!empty($data['listItem'])) { echo '<div class="dataTables_paginate paging_bootstrap">';
$zbm_id = $_GET['zbm_id']; $round = $_GET['round']; $r = mysql_query("select * from fails_zbm where id = " . $zbm_id . " order by id"); while ($m = mysql_fetch_array($r)) { $metode = $m['metode']; // izdzēšam ierakstu kas jau tur varētu būt mysql_query("delete from pavadzime where import_type = 'zbm' and import_id = " . $m['id']); mysql_query("delete from batch_fails where import_type = 'zbm' and import_id = " . $m['id']); // insertējam jaunu ierakstu bačos mysql_query("insert into batch_fails (nosaukums, datums, import_type, import_id) values ('" . $m['pas_nos'] . ' ' . $m['pavaddok'] . "', '" . date('Y-m-d') . "', 'zbm', " . $m['id'] . ") "); //dabonam pēdējo baču $rid = mysql_query("select max(id) as x from batch_fails"); $mid = mysql_fetch_array($rid); $new_id = $mid['x']; // insertējam jaunu ierakstu pavadzīmēs mysql_query("insert into pavadzime (piegadataju_kods,batch_fails,piegad_grupa, kad_piegad, iecirknis, cirsmas_kods, fsc, pavadzime, transp_darba_uzd, piegad_kods, iecirknis_pieg, attalums, auto, soferis, cenu_matrica, kravas_id, import_type, import_id) select pasutitajs, {$new_id},'', '" . sqltime(convert_time($m['started'])) . "', '', '', '', pavaddok, transp_darba_uzd, '', '', 0, autonr, sofer, '', '', 'zbm', id from fails_zbm where id = " . $m['id']); // dabonam jauno id $rid = mysql_query("select max(id) as x from pavadzime"); $mid = mysql_fetch_array($rid); $new_id = $mid['x']; // updeitojam ierakstu ar jauno id mysql_query("update fails_zbm set export_id = " . $new_id . " where id = " . $m['id']); } // jaunie ieraksti no fails_zbm_ui $r = mysql_query("select * from fails_zbm_ui where fails_zbm_id = {$zbm_id} and anuled = 0 order by id"); while ($m = mysql_fetch_array($r)) { // izdzēšam ierakstu kas jau tur varētu būt mysql_query("delete from balkis where import_id = " . $m['id']); // atrodam pārnestās pavadzīmes id $rpav = mysql_query("select * from fails_zbm where id = " . $m['fails_zbm_id']); $mpav = mysql_fetch_array($rpav);
<input type=button value='Вернуться' class=newbut onclick="document.location='main.php?act=go&level=remesl'"> <input type=button value='Обновить' class=newbut onClick="location.href='?act=none'"> </td> </tr> </table> <div id=hint3></div> <?php echo "<center><font color=red><b>" . $msg . "</b></font></center><br>"; //Подача заявки echo "\n<table width='100%'>\n\t<tr><td align=center><b>Подача заявки на проверку</b></td></tr>"; $me = mysql_fetch_array(mysql_query("SELECT * FROM proverka where login='******'")); if ($db["metka"] + 5 * 24 * 60 * 60 > time()) { echo "<td align=center><I>Вы уже прошли проверку на чистоту. Будет ещё длится: <b>" . convert_time($db["metka"] + 5 * 24 * 60 * 60) . "</I></td>"; } else { if ($db["metka"] + 20 * 24 * 60 * 60 > time()) { echo "<td align=center><I>До следующий проверки: <b>" . convert_time($db["metka"] + 20 * 24 * 60 * 60) . "</I></td>"; } else { if ($me["zstatus"] == 1 || $me["zstatus"] == 3) { echo "<td align=center><I>Ваша заявка находится на рассмотрении.</I></td>"; } else { if ($me["zstatus"] == 2) { echo "<td align=center><font color=red><b>Состояния проверки:</b> " . $me["prichina"] . "</font></td>"; } else { echo "<td>Для подачи заявки вам нужно иметь:<br>\n\t- Иметь при себе <b>" . $z_money[$db["level"]] . "</b> Зл.<br>\n\t- Ваш уровень должен быть равен или более <b>8-го</b><br>\n\t<input type='button' value='Подать заявку на проверку' class=input onclick='document.location.href=\"?podat=1\"'></td>"; } } } } echo "</tr>\n</table>"; //---------------------------------------- echo "\n\t<TABLE width=100% cellspacing=1 cellpadding=5 class='l3' align=center>\n\t<TR style='font-weight:bold'>\n\t\t<TD width=10% align=center>№</TD><TD width=10% align=center>Действия</TD><TD align=center>Логин</TD><TD align=center>Состояние</TD><TD align=center>Время</TD><TD align=center>Модератор</TD>\n\t</TR>";
echo "<img src='http://www.meydan.az/img/index/travma.gif' border='0' /> "; echo "У персонажа <b>" . $travm . ".</b> "; echo "Ослабленна характеристика <b style='color:#ff0000'>{$kstat}-{$stats}</b> "; echo "(Еще " . convert_time($db['travm']) . ")<br/><br/>"; } if ($db["oslab"] > time()) { echo "<img src='http://www.meydan.az/img/index/travma.gif' border='0' /> "; echo "Персонаж ослаблен из-за смерти в бою, еще " . convert_time($db['oslab']) . "<br/><br/>"; } if ($db["shut"] > time()) { echo "<img src='http://www.meydan.az/img/index/molch.gif' border='0' /> "; echo "Молчит еще " . convert_time($db['shut']) . "<br/><br/>"; } if ($db["travm_protect"] > time()) { echo "<img src='http://www.meydan.az/img/index/travm_protect.gif' border='0' />"; echo "<b>Магические способности:</b> Защита от травм, еще " . convert_time($db['travm_protect']) . "<br/><br/>"; } echo "</div>"; } ############################################################################################################ if ($_GET["view"] == 2) { ?> <div class="aheader"> <b>Защита</b><br/> </div> <div> • Броня головы: <b><?php echo ceil($db["bron_head"]); ?> </b><br/> • Броня корпуса: <b><?php
} mysql_Query("DELETE FROM labirint WHERE user_id='" . $login . "'"); mysql_query("INSERT INTO labirint(user_id, location, vector, visit_time) VALUES('" . $login . "', '" . $loc . "', '0', '" . time() . "')"); $msg = "Заявка на бой подана"; } else { $msg = "Вы не можете идти на поединок против своих..."; } } else { $msg = "Максимальное колличество бойцов в группе - 20 чел."; } } else { $msg = "Вы уже и так в группе"; } } ####################################################### echo "\n\t\t\t\t\t<font color='#ff0000'>{$msg}</font><br>\n\t\t\t\t\t<table cellspacing=1 cellpadding=3 align=center width=600>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan=2 align=center><b>До войны еще: " . convert_time($have_Zayavka['start_time']) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='newbut' align=center>\n\t\t\t\t\t\t\t<td width=50%><b>Свет</td><td><b>Тьма</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td valign=top>"; $sql_team1 = mysql_query("SELECT users.login, users.level, users.id, users.orden, users.admin_level, users.clan, users.clan_short, users.dealer FROM war_team LEFT JOIN users ON users.login=war_team.player WHERE group_id=" . $have_Zayavka['id'] . " and war_team.team=1"); while ($team1 = mysql_fetch_Array($sql_team1)) { echo "<script>drwfl('" . $team1['login'] . "','" . $team1['id'] . "','" . $team1['level'] . "','" . $team1['dealer'] . "','" . $team1['orden'] . "','" . $team1['admin_level'] . "','" . $team1['clan_short'] . "','" . $team1['clan'] . "');</script><br>"; } echo "</td>\n\t\t\t\t\t\t\t<td valign=top>"; $sql_team2 = mysql_query("SELECT users.login, users.level, users.id, users.orden, users.admin_level, users.clan, users.clan_short, users.dealer FROM war_team LEFT JOIN users ON users.login=war_team.player WHERE group_id=" . $have_Zayavka['id'] . " and war_team.team=2"); while ($team2 = mysql_fetch_Array($sql_team2)) { echo "<script>drwfl('" . $team2['login'] . "','" . $team2['id'] . "','" . $team2['level'] . "','" . $team2['dealer'] . "','" . $team2['orden'] . "','" . $team2['admin_level'] . "','" . $team2['clan_short'] . "','" . $team2['clan'] . "');</script><br>"; } echo "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr align=center>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input class='newbut' type='button' onclick=\"document.location.href='?team=1'\" value=\"Я за Свет!\">\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input class='newbut' type='button' onclick=\"document.location.href='?team=2'\" value=\"Я за Тьма!\">\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>"; } } ?> </td> </tr>
/** * Отображает строки таблицы * возвращает строку содержащую разметку содержимого таблицы */ function display_rows() { //Получаем записи зарегистрированные в методе prepare_items $records = $this->items; //Получаем колонки зарегистрированные в методах get_columns и get_sortable_columns list($columns, $hidden) = $this->get_column_info(); //Запускаем цикл по всем записям if (!empty($records)) { foreach ($records as $rec) { //Открываем строку echo '<tr id="record_' . $rec->id . '">'; // Цикл по колонкам foreach ($columns as $column_name => $column_display_name) { //Применяем стили к каждой колонке $class = "class='{$column_name} column-{$column_name}'"; $style = ""; if (in_array($column_name, $hidden)) { $style = 'style="display:none;"'; } $attributes = $class . $style; //ссылка для редактирования //$editlink = '/wp-admin/link.php?action=edit&link_id='.(int)$rec->link_id; //Отображаем ячейку switch ($column_name) { case "col_order_id": echo '<td ' . $attributes . '>' . stripslashes($rec->id) . '</td>'; break; case "col_order_user_login": echo '<td ' . $attributes . '>' . stripslashes($rec->user_login) . '</td>'; break; case "col_order_number": echo '<td ' . $attributes . '>' . stripslashes($rec->number) . '</td>'; break; case "col_order_dt_create": echo '<td ' . $attributes . '>' . convert_time($rec->dt_create) . '</td>'; break; //case "col_order_tbl_type": echo '<td '.$attributes.'>'.stripslashes($rec->tbl_type).'</td>'; break; //case "col_order_tbl_id": echo '<td '.$attributes.'>'.stripslashes($rec->tbl_id).'</td>'; break; //case "col_order_tbl_type": echo '<td '.$attributes.'>'.stripslashes($rec->tbl_type).'</td>'; break; //case "col_order_tbl_id": echo '<td '.$attributes.'>'.stripslashes($rec->tbl_id).'</td>'; break; case "col_order_dt_pay": echo '<td ' . $attributes . '>' . ($rec->dt_pay ? convert_time($rec->dt_pay) : '') . '</td>'; break; case "col_order_cost": echo '<td ' . $attributes . '>' . stripslashes($rec->cost) . ' ' . $GLOBALS['tzs_curr'][$rec->currency] . '</td>'; break; case "col_order_pay": echo '<td ' . $attributes . '>' . ($rec->status == 0 ? '<a href="JavaScript:promptOrderPay(' . $rec->id . ', \'' . $rec->number . '\')">Оплатить</a>' : ($rec->pay_method == 4 ? '<a href="javascript:promptOrderUnPay(' . $rec->id . ', \'' . $rec->number . '\')">Отменить</a>' : '')) . '</td>'; break; } } //Закрываем строку echo '</tr>'; } } }
//begin to retrieve data. Default:recent 7 days $seven_days_ago = date('Y-m-d', strtotime('-7 days')); ////$current_YVR_date_object->modify('first day of this month')->format('Y-m-d'); //echo $first_this_month; $data_array = get_data($seven_days_ago, $current_YVR_date); $today_visits = get_visits($current_YVR_date); $today_visitor = "<h2>今日访问次数: " . $today_visits . "</h2>"; $today_unique_visits = get_unique_visits($current_YVR_date); $today_visitor .= "<h2>今日访问量: " . $today_unique_visits . "</h2>"; $today_visitor .= "<h2>人均访问次数: " . number_format($today_visits / $today_unique_visits, 3) . "</h2>"; $total_time = get_time($current_YVR_date); $total_time_string = convert_time($total_time); $average_time = ceil($total_time / $today_visits); $average_time_string = convert_time($average_time); $average_time_per_visit = ceil($total_time / $today_unique_visits); $average_time_per_visit_string = convert_time($average_time_per_visit); $today_visitor .= "<h2>访问总时长: " . $total_time_string . "</h2>"; $today_visitor .= "<h2>每次访问时长: " . $average_time_string . "</h2>"; $today_visitor .= "<h2>当日人均累计访问时长: " . $average_time_per_visit_string . "</h2>"; $today_visits_array = array(); $today_unique_visits_array = array(); $today_avg_time_array = array(); $today_visits_array[$current_YVR_date] = $today_visits; $today_unique_visits_array[$current_YVR_date] = $today_unique_visits; $today_avg_time_array[$current_YVR_date] = $average_time; $today_report_array = array("visits" => $today_visits_array, "unique_visits" => $today_unique_visits_array, "avg_time" => $today_avg_time_array); $data_array['visits'][$current_YVR_date] = $today_visits; $data_array['unique_visitors'][$current_YVR_date] = $today_unique_visits; //$data_array['avg_time'][$current_YVR_date]=$average_time; function get_data($start_date, $end_date) {
if ($location_request->{'login_time'} != "" && $location_request->{'logout_time'} == "") { $start_date_time = $date . " " . $location_request->{'login_time'}; $end_date_time = $date . " " . "23:59:59"; } } } } } } } } if ($location_request->{'timezone'} != "") { $timezone = $location_request->{'timezone'}; } $start_time = convert_time($start_date_time, $timezone, "Asia/Calcutta"); $end_time = convert_time($end_date_time, $timezone, "Asia/Calcutta"); if (differnt_dates($start_time, $location_response) == 1 && differnt_dates($location_response, $end_time) == 1) { $flag = true; } else { $flag = false; continue; } } /* * compare ui fields with bakend fields || end */ } //case 5: device if (isset($request->{'device'})) { /* * compare ui fields with bakend fields || start
function parseactions($actionblock, $data_length) { $block_length = 0; $action = 0; while ($data_length) { if ($block_length) { $actionblock = substr($actionblock, $block_length); } $temp = unpack('Cplayer_id/vlength', $actionblock); $player_id = $temp['player_id']; $block_length = $temp['length'] + 3; $data_length -= $block_length; $was_deselect = false; $was_subupdate = false; $was_subgroup = false; $n = 3; while ($n < $block_length) { $prev = $action; $action = ord($actionblock[$n]); switch ($action) { // Unit/building ability (no additional parameters) // here we detect the races, heroes, units, items, buildings, // upgrades case 0x10: $this->players[$player_id]['actions'][] = $this->time; if ($this->header['major_v'] >= 13) { $n++; // ability flag is one byte longer } $itemid = strrev(substr($actionblock, $n + 2, 4)); $value = convert_itemid($itemid); if (!$value) { $this->players[$player_id]['actions_details'][convert_action('ability')]++; // handling Destroyers if (ord($actionblock[$n + 2]) == 0x33 && ord($actionblock[$n + 3]) == 0x2) { $name = substr(convert_itemid('ubsp'), 2); $this->players[$player_id]['units']['order'][$this->time] = $this->players[$player_id]['units_multiplier'] . ' ' . $name; $this->players[$player_id]['units'][$name]++; $name = substr(convert_itemid('uobs'), 2); $this->players[$player_id]['units'][$name]--; } } else { $this->players[$player_id]['actions_details'][convert_action('buildtrain')]++; if (!$this->players[$player_id]['race_detected']) { if ($race_detected = convert_race($itemid)) { $this->players[$player_id]['race_detected'] = $race_detected; } } $name = substr($value, 2); switch ($value[0]) { case 'u': // preventing duplicated units if ($this->time - $this->players[$player_id]['units_time'] > ACTION_DELAY || $itemid != $this->players[$player_id]['last_itemid'] || ($itemid == 'hpea' || $itemid == 'ewsp' || $itemid == 'opeo' || $itemid == 'uaco') && $this->time - $this->players[$player_id]['units_time'] > 0) { $this->players[$player_id]['units_time'] = $this->time; $this->players[$player_id]['units']['order'][$this->time] = $this->players[$player_id]['units_multiplier'] . ' ' . $name; $this->players[$player_id]['units'][$name] += $this->players[$player_id]['units_multiplier']; } break; case 'b': $this->players[$player_id]['buildings']['order'][$this->time] = $name; $this->players[$player_id]['buildings'][$name]++; break; case 'h': $this->players[$player_id]['heroes']['order'][$this->time] = $name; $this->players[$player_id]['heroes'][$name]['revivals']++; break; case 'a': list($hero, $ability) = explode(':', $name); $retraining_time = $this->players[$player_id]['retraining_time']; if (!$this->players[$player_id]['heroes'][$hero]['retraining_time']) { $this->players[$player_id]['heroes'][$hero]['retraining_time'] = 0; } // preventing too high levels (avoiding duplicated actions) // the second condition is mainly for games with random heroes // the third is for handling Tome of Retraining usage if (($this->time - $this->players[$player_id]['heroes'][$hero]['ability_time'] > ACTION_DELAY || !$this->players[$player_id]['heroes'][$hero]['ability_time'] || $this->time - $retraining_time < RETRAINING_TIME) && $this->players[$player_id]['heroes'][$hero]['abilities'][$retraining_time][$ability] < 3) { if ($this->time - $retraining_time > RETRAINING_TIME) { $this->players[$player_id]['heroes'][$hero]['ability_time'] = $this->time; $this->players[$player_id]['heroes'][$hero]['level']++; $this->players[$player_id]['heroes'][$hero]['abilities'][$this->players[$player_id]['heroes'][$hero]['retraining_time']][$ability]++; } else { $this->players[$player_id]['heroes'][$hero]['retraining_time'] = $retraining_time; $this->players[$player_id]['heroes'][$hero]['abilities']['order'][$retraining_time] = 'Retraining'; $this->players[$player_id]['heroes'][$hero]['abilities'][$retraining_time][$ability]++; } $this->players[$player_id]['heroes'][$hero]['abilities']['order'][$this->time] = $ability; } break; case 'i': $this->players[$player_id]['items']['order'][$this->time] = $name; $this->players[$player_id]['items'][$name]++; if ($itemid == 'tret') { $this->players[$player_id]['retraining_time'] = $this->time; } break; case 'p': // preventing duplicated upgrades if ($this->time - $this->players[$player_id]['upgrades_time'] > ACTION_DELAY || $itemid != $this->players[$player_id]['last_itemid']) { $this->players[$player_id]['upgrades_time'] = $this->time; $this->players[$player_id]['upgrades']['order'][$this->time] = $name; $this->players[$player_id]['upgrades'][$name]++; } break; default: $this->errors[$this->time] = 'Unknown ItemID at ' . convert_time($this->time) . ': ' . $value; break; } $this->players[$player_id]['last_itemid'] = $itemid; } if ($this->header['major_v'] >= 7) { $n += 14; } else { $n += 6; } break; // Unit/building ability (with target position) // Unit/building ability (with target position) case 0x11: $this->players[$player_id]['actions'][] = $this->time; if ($this->header['major_v'] >= 13) { $n++; // ability flag } if (ord($actionblock[$n + 2]) <= 0x19 && ord($actionblock[$n + 3]) == 0x0) { // basic commands $this->players[$player_id]['actions_details'][convert_action('basic')]++; } else { $this->players[$player_id]['actions_details'][convert_action('ability')]++; } $value = strrev(substr($actionblock, $n + 2, 4)); if ($value = convert_buildingid($value)) { $this->players[$player_id]['buildings']['order'][$this->time] = $value; $this->players[$player_id]['buildings'][$value]++; } if ($this->header['major_v'] >= 7) { $n += 22; } else { $n += 14; } break; // Unit/building ability (with target position and target object ID) // Unit/building ability (with target position and target object ID) case 0x12: $this->players[$player_id]['actions'][] = $this->time; if ($this->header['major_v'] >= 13) { $n++; // ability flag } if (ord($actionblock[$n + 2]) == 0x3 && ord($actionblock[$n + 3]) == 0x0) { // rightclick $this->players[$player_id]['actions_details'][convert_action('rightclick')]++; } elseif (ord($actionblock[$n + 2]) <= 0x19 && ord($actionblock[$n + 3]) == 0x0) { // basic commands $this->players[$player_id]['actions_details'][convert_action('basic')]++; } else { $this->players[$player_id]['actions_details'][convert_action('ability')]++; } if ($this->header['major_v'] >= 7) { $n += 30; } else { $n += 22; } break; // Give item to Unit / Drop item on ground // Give item to Unit / Drop item on ground case 0x13: $this->players[$player_id]['actions'][] = $this->time; if ($this->header['major_v'] >= 13) { $n++; // ability flag } $this->players[$player_id]['actions_details'][convert_action('item')]++; if ($this->header['major_v'] >= 7) { $n += 38; } else { $n += 30; } break; // Unit/building ability (with two target positions and two item IDs) // Unit/building ability (with two target positions and two item IDs) case 0x14: $this->players[$player_id]['actions'][] = $this->time; if ($this->header['major_v'] >= 13) { $n++; // ability flag } if (ord($actionblock[$n + 2]) == 0x3 && ord($actionblock[$n + 3]) == 0x0) { // rightclick $this->players[$player_id]['actions_details'][convert_action('rightclick')]++; } elseif (ord($actionblock[$n + 2]) <= 0x19 && ord($actionblock[$n + 3]) == 0x0) { // basic commands $this->players[$player_id]['actions_details'][convert_action('basic')]++; } else { $this->players[$player_id]['actions_details'][convert_action('ability')]++; } if ($this->header['major_v'] >= 7) { $n += 43; } else { $n += 35; } break; // Change Selection (Unit, Building, Area) // Change Selection (Unit, Building, Area) case 0x16: $temp = unpack('Cmode/vnum', substr($actionblock, $n + 1, 3)); if ($temp['mode'] == 0x2 || !$was_deselect) { $this->players[$player_id]['actions'][] = $this->time; $this->players[$player_id]['actions_details'][convert_action('select')]++; } $was_deselect = $temp['mode'] == 0x2; $this->players[$player_id]['units_multiplier'] = $temp['num']; $n += 4 + $temp['num'] * 8; break; // Assign Group Hotkey // Assign Group Hotkey case 0x17: $this->players[$player_id]['actions'][] = $this->time; $this->players[$player_id]['actions_details'][convert_action('assignhotkey')]++; $temp = unpack('Cgroup/vnum', substr($actionblock, $n + 1, 3)); $this->players[$player_id]['hotkeys'][$temp['group']]['assigned']++; $this->players[$player_id]['hotkeys'][$temp['group']]['last_totalitems'] = $temp['num']; $n += 4 + $temp['num'] * 8; break; // Select Group Hotkey // Select Group Hotkey case 0x18: $this->players[$player_id]['actions'][] = $this->time; // Won't show up in APM stats, if we comment this line $this->players[$player_id]['actions_details'][convert_action('selecthotkey')]++; $this->players[$player_id]['hotkeys'][ord($actionblock[$n + 1])]['used']++; $this->players[$player_id]['units_multiplier'] = $this->players[$player_id]['hotkeys'][ord($actionblock[$n + 1])]['last_totalitems']; $n += 3; break; // Select Subgroup // Select Subgroup case 0x19: // OR is for torunament reps which don't have build_v if ($this->header['build_v'] >= 6040 || $this->header['major_v'] > 14) { if ($was_subgroup) { // can't think of anything better (check action 0x1A) $this->players[$player_id]['actions'][] = $this->time; $this->players[$player_id]['actions_details'][convert_action('subgroup')]++; // I don't have any better idea what to do when somebody binds buildings // of more than one type to a single key and uses them to train units // TODO: this is rarely executed, maybe it should go after if ($was_subgroup) {}? $this->players[$player_id]['units_multiplier'] = 1; } $n += 13; } else { if (ord($actionblock[$n + 1]) != 0 && ord($actionblock[$n + 1]) != 0xff && !$was_subupdate) { $this->players[$player_id]['actions'][] = $this->time; $this->players[$player_id]['actions_details'][convert_action('subgroup')]++; } $was_subupdate = ord($actionblock[$n + 1]) == 0xff; $n += 2; } break; // some subaction holder? // version < 14b: Only in scenarios, maybe a trigger-related command // some subaction holder? // version < 14b: Only in scenarios, maybe a trigger-related command case 0x1a: // OR is for torunament reps which don't have build_v if ($this->header['build_v'] >= 6040 || $this->header['major_v'] > 14) { $n += 1; $was_subgroup = $prev == 0x19 || $prev == 0; //0 is for new blocks which start with 0x19 } else { $n += 10; } break; // Only in scenarios, maybe a trigger-related command // version < 14b: Select Ground Item // Only in scenarios, maybe a trigger-related command // version < 14b: Select Ground Item case 0x1b: // OR is for torunament reps which don't have build_v if ($this->header['build_v'] >= 6040 || $this->header['major_v'] > 14) { $n += 10; } else { $this->players[$player_id]['actions'][] = $this->time; $n += 10; } break; // Select Ground Item // version < 14b: Cancel hero revival (new in 1.13) // Select Ground Item // version < 14b: Cancel hero revival (new in 1.13) case 0x1c: // OR is for torunament reps which don't have build_v if ($this->header['build_v'] >= 6040 || $this->header['major_v'] > 14) { $this->players[$player_id]['actions'][] = $this->time; $n += 10; } else { $this->players[$player_id]['actions'][] = $this->time; $n += 9; } break; // Cancel hero revival // Remove unit from building queue // Cancel hero revival // Remove unit from building queue case 0x1d: case 0x1e: // OR is for torunament reps which don't have build_v if (($this->header['build_v'] >= 6040 || $this->header['major_v'] > 14) && $action != 0x1e) { $this->players[$player_id]['actions'][] = $this->time; $n += 9; } else { $this->players[$player_id]['actions'][] = $this->time; $this->players[$player_id]['actions_details'][convert_action('removeunit')]++; $value = convert_itemid(strrev(substr($actionblock, $n + 2, 4))); $name = substr($value, 2); switch ($value[0]) { case 'u': // preventing duplicated units cancellations if ($this->time - $this->players[$player_id]['runits_time'] > ACTION_DELAY || $value != $this->players[$player_id]['runits_value']) { $this->players[$player_id]['runits_time'] = $this->time; $this->players[$player_id]['runits_value'] = $value; $this->players[$player_id]['units']['order'][$this->time] = '-1 ' . $name; $this->players[$player_id]['units'][$name]--; } break; case 'b': $this->players[$player_id]['buildings'][$name]--; break; case 'h': $this->players[$player_id]['heroes'][$name]['revivals']--; break; case 'p': // preventing duplicated upgrades cancellations if ($this->time - $this->players[$player_id]['rupgrades_time'] > ACTION_DELAY || $value != $this->players[$player_id]['rupgrades_value']) { $this->players[$player_id]['rupgrades_time'] = $this->time; $this->players[$player_id]['rupgrades_value'] = $value; $this->players[$player_id]['upgrades'][$name]--; } break; } $n += 6; } break; // Found in replays with patch version 1.04 and 1.05. // Found in replays with patch version 1.04 and 1.05. case 0x21: $n += 9; break; // Change ally options // Change ally options case 0x50: $n += 6; break; // Transfer resources // Transfer resources case 0x51: $n += 10; break; // Map trigger chat command (?) // Map trigger chat command (?) case 0x60: $n += 9; while ($actionblock[$n] != "") { $n++; } ++$n; break; // ESC pressed // ESC pressed case 0x61: $this->players[$player_id]['actions'][] = $this->time; $this->players[$player_id]['actions_details'][convert_action('esc')]++; ++$n; break; // Scenario Trigger // Scenario Trigger case 0x62: if ($this->header['major_v'] >= 7) { $n += 13; } else { $n += 9; } break; // Enter select hero skill submenu for WarCraft III patch version <= 1.06 // Enter select hero skill submenu for WarCraft III patch version <= 1.06 case 0x65: $this->players[$player_id]['actions'][] = $this->time; $this->players[$player_id]['actions_details'][convert_action('heromenu')]++; ++$n; break; // Enter select hero skill submenu // Enter select building submenu for WarCraft III patch version <= 1.06 // Enter select hero skill submenu // Enter select building submenu for WarCraft III patch version <= 1.06 case 0x66: $this->players[$player_id]['actions'][] = $this->time; if ($this->header['major_v'] >= 7) { $this->players[$player_id]['actions_details'][convert_action('heromenu')]++; } else { $this->players[$player_id]['actions_details'][convert_action('buildmenu')]++; } $n += 1; break; // Enter select building submenu // Minimap signal (ping) for WarCraft III patch version <= 1.06 // Enter select building submenu // Minimap signal (ping) for WarCraft III patch version <= 1.06 case 0x67: if ($this->header['major_v'] >= 7) { $this->players[$player_id]['actions'][] = $this->time; $this->players[$player_id]['actions_details'][convert_action('buildmenu')]++; $n += 1; } else { $n += 13; } break; // Minimap signal (ping) // Continue Game (BlockB) for WarCraft III patch version <= 1.06 // Minimap signal (ping) // Continue Game (BlockB) for WarCraft III patch version <= 1.06 case 0x68: if ($this->header['major_v'] >= 7) { $n += 13; } else { $n += 17; } break; // Continue Game (BlockB) // Continue Game (BlockA) for WarCraft III patch version <= 1.06 // Continue Game (BlockB) // Continue Game (BlockA) for WarCraft III patch version <= 1.06 case 0x69: // Continue Game (BlockA) // Continue Game (BlockA) case 0x6a: $this->continue_game = 1; $n += 17; break; // Pause game // Pause game case 0x1: $this->pause = true; $temp = ''; $temp['time'] = $this->time; $temp['text'] = convert_chat_mode(0xfe, $this->players[$player_id]['name']); $this->chat[] = $temp; $n += 1; break; // Resume game // Resume game case 0x2: $temp = ''; $this->pause = false; $temp['time'] = $this->time; $temp['text'] = convert_chat_mode(0xff, $this->players[$player_id]['name']); $this->chat[] = $temp; $n += 1; break; // Increase game speed in single player game (Num+) // Increase game speed in single player game (Num+) case 0x4: // Decrease game speed in single player game (Num-) // Decrease game speed in single player game (Num-) case 0x5: $n += 1; break; // Set game speed in single player game (options menu) // Set game speed in single player game (options menu) case 0x3: $n += 2; break; // Save game // Save game case 0x6: $i = 1; while ($actionblock[$n] != "") { $n++; } $n += 1; break; // Save game finished // Save game finished case 0x7: $n += 5; break; // Only in scenarios, maybe a trigger-related command // Only in scenarios, maybe a trigger-related command case 0x75: $n += 2; break; default: $temp = ''; for ($i = 3; $i < $n; $i++) { // first 3 bytes are player ID and length $temp .= sprintf('%02X', ord($actionblock[$i])) . ' '; } $temp .= '[' . sprintf('%02X', ord($actionblock[$n])) . '] '; for ($i = 1; $n + $i < strlen($actionblock); $i++) { $temp .= sprintf('%02X', ord($actionblock[$n + $i])) . ' '; } $this->errors[] = 'Unknown action at ' . convert_time($this->time) . ': 0x' . sprintf('%02X', $action) . ', prev: 0x' . sprintf('%02X', $prev) . ', dump: ' . $temp; // skip to the next CommandBlock // continue 3, not 2 because of http://php.net/manual/en/control-structures.continue.php#68193 // ('Current functionality treats switch structures as looping in regards to continue.') continue 3; } } $was_deselect = $action == 0x16; $was_subupdate = $action == 0x19; } }
function load() { $now = time(); $max_age = 130; // 2+ mins. $this->servers = array(); // Array for expired servers, to be inserted into the historical table. $expired_servers = array(); // Make a query for all the current servers. $res = $this->query('SELECT * FROM ' . PREFIX . 'servers'); // Iterate through the servers. while ($info = mysql_fetch_assoc($res)) { //print_r($info); $age = $now - convert_time($info['time']); // Put the information of expired servers into another array. if ($age < $max_age) { //print "CURRENT(".$age.")\n"; // Remove some fields from the info. unset($info['id']); unset($info['firstseentime']); $this->servers[make_ident($info)] = $info; } else { //print "HISTORICAL(".strftime("%a, %d %b %Y %H:%M:%S %z",$now).",". // strftime("%a, %d %b %Y %H:%M:%S %z", convert_time($info['time'])).",".$age.")\n"; $expired_servers[make_ident($info)] = $info; } } if (count($expired_servers) > 0) { // Insert them as new items into the historical array. $q = 'INSERT INTO ' . PREFIX . 'historical_servers ' . '(archtime, firstseentime, ver, game, mode, setup, iwad, pwads, wcrc, maxp) VALUES '; $the_first = TRUE; $delq = 'DELETE FROM ' . PREFIX . 'servers WHERE '; while (list($ident, $info) = each($expired_servers)) { if (!$the_first) { $q .= ', '; $delq .= ' OR '; } $the_first = FALSE; $q .= '(NULL, ' . quote_smart($info['firstseentime']) . ', ' . quote_smart($info['ver']) . ', ' . quote_smart($info['game']) . ', ' . quote_smart($info['mode']) . ', ' . quote_smart($info['setup']) . ', ' . quote_smart($info['iwad']) . ', ' . quote_smart($info['pwads']) . ', ' . quote_smart($info['wcrc']) . ', ' . quote_smart($info['maxp']) . ') '; $delq .= 'id=' . quote_smart(make_ident($info)); } $this->query($q); $this->query($delq); } }
function tzs_front_end_view_auctionsd_handler($atts) { ob_start(); global $wpdb; $user_id = get_current_user_id(); $sh_id = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : 0; if ($sh_id <= 0) { print_error('Тендер не найден'); } else { $sql = "SELECT * FROM " . TZS_AUCTIONS_TABLE . " WHERE id={$sh_id};"; $row = $wpdb->get_row($sql); if (count($row) == 0 && $wpdb->last_error != null) { print_error('Не удалось отобразить информацию о тендер. Свяжитесь, пожалуйста, с администрацией сайта.'); } else { if ($row == null) { print_error('Тендер не найден'); } else { if (isset($_GET['spis'])) { echo "<a id='edit_search' href='/account/my-auctions/'>Назад к списку</a> <div style='clear: both'></div>"; } else { echo "<button id='edit_search' onclick='history.back()'>Назад к списку</button> <div style='clear: both'></div>"; } ?> <div style='clear: both'> <br /> <div class="container-fluid"> <div class="row-fluid" > <div class="span4" id="img_kart"> <?php if (strlen($row->image_id_lists) > 0) { //$img_names = explode(';', $row->pictures); $img_names = explode(';', $row->image_id_lists); $main_image_id = $row->main_image_id; if (count($img_names) > 0) { ?> <?php // Вначале выведем главное изображение $attachment_info = wp_get_attachment_image_src($main_image_id, 'full'); if ($attachment_info !== false) { ?> <ul class="thumbnails" style="max-height: 470px;"> <li class="span12"> <a href="#" class="thumbnail" id="general-img"> <img id="general" src=<?php echo $attachment_info[0]; ?> alt=""> </a> </li> </ul> <?php } ?> <ul class="thumbnails"> <li class="span3"> <a href="#" class="thumbnail" > <img src=<?php echo $attachment_info[0]; ?> alt="" onclick="clickSmallImage(this);"> </a> </li> <?php // Затем выведем все остальные изображения for ($i = 0; $i < count($img_names); $i++) { if ($img_names[$i] !== $main_image_id) { $attachment_info = wp_get_attachment_image_src($img_names[$i], 'full'); //if (file_exists(ABSPATH . $img_names[$i])) { if ($attachment_info !== false) { ?> <li class="span3"> <a href="#" class="thumbnail" > <img src=<?php echo $attachment_info[0]; ?> alt="" onclick="clickSmallImage(this);"> </a> </li> <?php } } } ?> </ul> <?php } } else { ?> <ul class="thumbnails" style="max-height: 470px;"> <li class="span12"> <a href="#" class="thumbnail" id="general-img"> <img id="general" src="/wp-content/themes/twentytwelve/image/360x270.png" alt=""> </a> </li> </ul> <?php } ?> </div> <div class="span7"> <div class="well well-large"> <div id="bet"> <form name="bet_form" id="bet_form" > <fieldset> <div id="bet_error" style="color: red;"><?php echo $user_id === 0 ? '<p>Для участия в тендере необходимо <a href="/account/login/">войти</a> или <a href="/account/registration/">зарегистрироваться</a></p>' : ''; ?> </div> <?php if ($user_id == $row->user_id) { ?> <div class="pull-left label-txt"> <label><strong>Актуальная цена:</strong></label> <!-- <strong><div id="tek_price">515 <?php /*echo $GLOBALS['tzs_pr_curr'][$row->currency]; */ ?> </div></strong> --> <strong><div id="tek_price"></div></strong> </div> <div class="pull-left label-txt" style="min-width: 60px;"> <label><strong>Ставок:</strong></label> <!-- <strong><div id="tek_price">515 <?php /*echo $GLOBALS['tzs_pr_curr'][$row->currency]; */ ?> </div></strong> --> <strong><div id="tek_stavki"></div></strong> </div> <?php } else { ?> <div class="pull-left label-txt"> <label><strong>Актуальная цена:</strong></label> </div> <div class="pull-left label-txt" style="min-width: 60px;"> <label><strong>Ставок:</strong></label> </div> <?php } ?> <?php if ($user_id != $row->user_id && $user_id != 0) { ?> <div class="pull-left" style="padding-left: 10px;"> <strong>Ваша ставка:</strong> </div> <div class="clearfix"></div> <?php } ?> <?php if ($user_id == $row->user_id) { ?> <div class="pull-left"> <button id="view_del" style="margin: 0 20px 0 0;" onClick="javascript: promptDelete(<?php echo $row->id . ', ' . $row->active; ?> );">Удалить</button> <a id="view_edit" style="margin: 0 20px 0 0;" onClick="javascript: window.location.href = '/account/edit-auction/?id=<?php echo $row->id; ?> ';">Изменить</a> </div> <?php } ?> <?php if ($user_id != $row->user_id) { ?> <?php if (!$user_id) { echo "<div class='clearfix'></div>"; } ?> <div class="pull-left label-txt"> <!-- <center><strong><div id="tek_price">515 <?php /* echo $GLOBALS['tzs_pr_curr'][$row->currency]; */ ?> </div></strong></center> --> <center><strong><div id="tek_price"></div></strong></center> </div> <div class="pull-left label-txt" style="min-width: 60px;"> <!-- <center><strong><div id="tek_price">515 <?php /* echo $GLOBALS['tzs_pr_curr'][$row->currency]; */ ?> </div></strong></center> --> <center><strong><div id="tek_stavki"></div></strong></center> </div> <?php } ?> <?php if ($user_id != $row->user_id && $user_id != 0) { ?> <div class="pull-left" style="width: 30%; padding-left: 10px;"> <input id="bet_user" type="number" style="width: 45%;" <?php echo $user_id === 0 ? 'disabled="disabled"' : ''; ?> /> </div> <div class="pull-left"> <button id="bet_button" type="button" onclick="bet_click();" <?php echo $user_id === 0 ? 'disabled="disabled"' : ''; ?> >Сделать ставку</button> </div> <div class="clearfix"></div> <strong>Комментарий к ставке</strong> <textarea id="text_bet" class="bet-area" rows="1" cols="75" name="text-bet" placeholder="Текст ставки"></textarea> <input id="user_id" style="display: none;" value=<?php echo $user_id; ?> /> <input id="user_name" style="display: none;" value=<?php $meta = get_user_meta($row->user_id, 'fio'); echo $meta[0]; ?> /> <input id="auction_id" style="display: none;" value=<?php echo $sh_id; ?> /> <input id="created" style="display: none;" value=<?php echo date("Y-m-d H:i:s"); ?> /> <?php } ?> <input id="currency" style="display: none;" value="<?php echo $GLOBALS['tzs_pr_curr'][$row->currency]; ?> " /> <div class="clearfix"></div> </fieldset> </form> </div> <div id="labeltxt"> <div class="pull-left label-txt"> <label><strong>Активно:</strong></label> </div> <div class="pull-left"> <?php echo $row->active == 1 ? 'Да' : 'Нет'; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Категория:</strong></label> </div> <div class="pull-left"> <?php echo get_the_title($row->type_id); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Дата размещения:</strong></label> </div> <div class="pull-left"> <?php echo convert_date($row->created); ?> <?php echo convert_time_only($row->time); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Дата окончания:</strong></label> </div> <div class="pull-left"> <?php echo convert_date($row->expiration); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Краткое описание:</strong></label> </div> <div class="pull-left"> <?php echo htmlspecialchars($row->title); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Количество:</strong></label> </div> <div class="pull-left"> <?php echo $row->copies; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Начальная стоимость:</strong></label> </div> <div class="pull-left" id="bet_label"> <?php echo $row->price . " " . $GLOBALS['tzs_pr_curr'][$row->currency]; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Форма оплаты:</strong></label> </div> <div class="pull-left"> <?php echo $GLOBALS['tzs_pr_payment'][$row->payment]; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Место нахождение:</strong></label> </div> <div class="pull-left"> <?php echo tzs_city_to_str($row->from_cid, $row->from_rid, $row->from_sid, $row->city_from); ?> </div> <div class="clearfix"></div> </div> </div> </div> </div> <div class="row-fluid"> <div class="span11"> <ul id="myTab" class="nav nav-tabs"> <li class="active"><a href="#description" data-toggle="tab">Описание</a></li> <li><a href="#contact" data-toggle="tab">Контактная информация</a></li> <?php if ($user_id == $row->user_id) { ?> <li><a href="#dopolnenie" data-toggle="tab">История ставок</a></li> <?php } ?> </ul> <div id="myTabContent" class="tab-content"> <div class="tab-pane fade in active" id="description"> <?php echo $row->description; //echo htmlspecialchars($row->description); ?> </div> <div class="tab-pane fade" id="contact"> <?php if ($user_id == 0 && $GLOBALS['tzs_au_contact_view_all'] == false) { ?> <div>Для просмотра контактов необходимо <a href="/account/login/">войти</a> или <a href="/account/registration/">зарегистрироваться</a></div> <?php } else { if ($user_id != $row->user_id) { ?> <br/> <!-- <div class="span6"> --!> <div id="labeltxt"> <?php echo tzs_print_user_table_ed($row->user_id); ?> </div> <!-- </div> --!> <script src="/wp-content/plugins/tzs/assets/js/feedback.js"></script> <button id="view_feedback" onClick="<?php echo tzs_feedback_build_url($row->user_id); ?> ">Отзывы <span>|</span> Рейтинг пользователя</button> <?php } } ?> </div> <div class="tab-pane fade" id="dopolnenie"> <div class="well well-large"> <div id="wrapper_bet"> <?php $active = " AND active=1"; // Отбор ставок по тендеру - active=1 AND $sql = "SELECT MAX(rate) FROM " . TZS_AUCTION_RATES_TABLE . " WHERE auction_id={$sh_id} {$active}"; /*$max = $wpdb->get_results($sql); */ $max = $wpdb->get_var($sql); if (max > 0) { echo "<input id='act_rate' style='display: none;' value=" . round($max, 2) . " />"; } else { echo "<input id='act_rate' style='display: none;' value=" . $row->price . " " . $GLOBALS['tzs_pr_curr'][$row->currency] . " />"; } $sql = "SELECT COUNT(*) FROM " . TZS_AUCTION_RATES_TABLE . " WHERE auction_id={$sh_id} {$active}"; /*$max = $wpdb->get_results($sql); */ $cnt_rate = $wpdb->get_var($sql); if ($cnt_rate > 0) { echo "<input id='cnt_rate' style='display: none;' value=" . $cnt_rate . " />"; } else { echo "<input id='cnt_rate' style='display: none;' value='0' />"; } $sql = "SELECT * FROM " . TZS_AUCTION_RATES_TABLE . " WHERE auction_id={$sh_id} ORDER BY active DESC,created DESC;"; $res = $wpdb->get_results($sql); if (count($res) == 0 && $wpdb->last_error != null) { print_error('Не удалось отобразить информацию о ставках. Свяжитесь, пожалуйста, с администрацией сайта.'); } else { if (count($res) == 0) { print_error('Ставки не найдены'); } else { ?> <table border="0" id="tbl_products" style="float: none !important;"> <tr> <th>Статус</th> <th id="tbl_products_dtc">Размещена <br /> Отозвана</th> <!-- <th id="tbl_products_dtc">Дата и время отзыва</th> --> <th id="price">Предложенная стоимость</th> <th id="price">Комментарий</th> <!-- <th id="price">Автор</th> --> <?php if ($user_id !== 0 || $GLOBALS['tzs_au_contact_view_all'] !== false) { ?> <th id="price">Автор <br /> Контактные данные</th> <?php } ?> </tr> <?php $i = 0; foreach ($res as $row) { $user_info = get_userdata($row->user_id); if ($row->reviewed == null) { $reviewed = " "; } else { $reviewed = convert_time($row->reviewed); } ?> <tr id="<?php echo $row->active == 1 ? 'tbl_auction_rate_active' : 'tbl_auction_rate_reviewed'; ?> "> <td><?php echo $row->active == 1 ? 'Активна' : 'Отозвана'; ?> </td> <td><?php echo ' ' . convert_time($row->created) . "<br />" . $reviewed; ?> </td> <!-- <td><?php /*echo $row->reviewed == null ? ' ' : convert_time($row->reviewed); */ ?> </td> --> <td><?php echo $row->rate . " " . $GLOBALS['tzs_pr_curr'][$row->currency]; ?> </td> <td><?php echo $row->description; ?> </td> <!-- <td><?php /* $meta = get_user_meta($row->user_id, 'fio'); echo $meta[0]; */ ?> </td> --> <?php if ($user_id !== 0 || $GLOBALS['tzs_au_contact_view_all'] !== false) { ?> <td> <?php $meta = get_user_meta($row->user_id, 'fio'); echo $meta[0] . '<br />'; ?> <?php $meta = get_user_meta($row->user_id, 'telephone'); echo $meta[0] == null ? '' : 'Номера телефонов: ' . htmlspecialchars($meta[0]) . '<br/>'; ?> <?php echo $user_info->user_email == null ? '' : 'E-mail: ' . htmlspecialchars($user_info->user_email) . '<br/>'; ?> <?php $meta = get_user_meta($row->user_id, 'skype'); echo $meta[0] == null ? '' : 'Skype: ' . htmlspecialchars($meta[0]) . '<br/>'; ?> </td> <?php } ?> </tr> <?php } ?> </table> <?php } } ?> </div> </div> </div> </div> </div> </div> </div> <script> jQuery('#myTab a').click(function (e) { e.preventDefault(); jQuery(this).tab('show'); }) </script> <script> jQuery(document).ready(function() { document.getElementById('tek_price').innerHTML=document.getElementById('act_rate').value+' '+document.getElementById('currency').value; document.getElementById('tek_stavki').innerHTML=document.getElementById('cnt_rate').value; now = new Date(); month=now.getUTCMonth()+1; now_str=now.getFullYear()+'-'+month+'-'+now.getUTCDate()+' '+now.getHours()+':'+now.getMinutes()+':'+now.getSeconds(); }); function clickSmallImage(element) { document.getElementById("general").src=element.src; } function bet_click() { flag_subs=0; document.getElementById('bet_error').innerHTML=""; paramstr=document.getElementById('text_bet').id+"=" + encodeURIComponent(document.getElementById('text_bet').value) + "&"+document.getElementById('user_id').id+"="+document.getElementById('user_id').value+"&"+document.getElementById('user_name').id+"="+document.getElementById('user_name').value+"&"+document.getElementById('auction_id').id+"="+document.getElementById('auction_id').value+"&"+document.getElementById('bet_user').id+"=" + document.getElementById('bet_user').value + "&"+document.getElementById('currency').id+"=" + document.getElementById('currency').value + "&"+document.getElementById('created').id+"=" + now_str + "&"; if ((document.getElementById('bet_user').value != "") ) { flag_subs=flag_subs+1; } else { document.getElementById('bet_error').innerHTML="Ставка не может быть пустой!"; return false; } if (parseFloat(document.getElementById('bet_user').value, 10) > parseFloat(document.getElementById('tek_price').innerHTML, 10) ) { flag_subs=flag_subs+1; } else { document.getElementById('bet_error').innerHTML="Ставка не может быть меньше актуальной цены!"; return false; } if(flag_subs>=1) { jQuery.ajax({ url: "/wp-admin/admin-ajax.php?action=add_bet", // url: "/wp-content/plugins/tzs/functions/tzs.functions.php?action=add_bet", type: "POST", data: paramstr, success: function(data){ //document.forms["bet_form"].submit(); bet_rate=document.getElementById('bet_user').value; document.getElementById('tek_price').innerHTML=bet_rate+' '+document.getElementById('currency').value+'.'; document.getElementById('bet_error').innerHTML="Ваша ставка принята!"; document.getElementById('bet_user').value=""; document.getElementById('text_bet').value=""; //jQuery("#wrapper_bet").load("/wp-content/plugins/tzs/front-end/tzs.view.auctions#wrapper_bet"); document.getElementById('wrapper_bet').innerHTML=data; //alert(data); }, error: function(data){ //document.forms["bet_form"].submit(); alert(data); } }); } } </script> <br/> <script> function promptDelete(id, active) { if (active === 1) { var s_text = '<div><h2>Удалить запись '+id+' или перенести в архив ?</h2><hr/><p>Запись из архива можно в любой момент снова опубликовать.</p><p>При удалении записи будут так же удалены все прикрепленные изображения.</p></div>'; buttons1 = new Object({ 'В архив': function () { jQuery(this).dialog("close"); doDelete(id, 0); }, 'Удалить': function () { jQuery(this).dialog("close"); doDelete(id, 1); }, 'Отменить': function () { jQuery(this).dialog("close"); } }); } else { var s_text = '<div><h2>Удалить запись '+id+' из архива ?</h2><hr/><p>Запись из архива можно в любой момент снова опубликовать.</p><p>При удалении записи будут так же удалены все прикрепленные изображения.</p></div>'; buttons1 = new Object({ 'Удалить': function () { jQuery(this).dialog("close"); doDelete(id, 1); }, 'Отменить': function () { jQuery(this).dialog("close"); } }); } jQuery('<div></div>').appendTo('body') .html(s_text) .dialog({ modal: true, title: 'Удаление', zIndex: 10000, autoOpen: true, width: 'auto', resizable: false, buttons: buttons1, close: function (event, ui) { jQuery(this).remove(); } }); } function doDelete(id, is_delete) { p_data = "id=" + id + "&is_delete=" + is_delete; jQuery.ajax({ url: "/wp-admin/admin-ajax.php?action=tzs_delete_auction", type: "POST", data: p_data, success: function(response){ //window.open('/account/my-auctions/', '_self'); window.open('/account/my-auctions/', ''); }, error: function(response){ alert('Не удалось удалить: '+response); } }); /*var data = { 'action': 'tzs_delete_auction', 'id': id, 'is_delete': is_delete }; jQuery.post(ajax_url, data, function(response) { if (response == '1') { window.open('/account/my-auctions/', '_self'); } else { alert('Не удалось удалить: '+response); } });*/ } </script> <?php } } } $output = ob_get_contents(); ob_end_clean(); return $output; }
echo '<a href="http://classic.battle.net/war3/ladder/' . $replay->header['ident'] . '-player-profile.aspx?Gateway=' . $gateway . '&PlayerName=' . $player['name'] . '">' . $player['name'] . '</a>'; } echo '<br /><br />'; } echo '</div>'; if ($replay->chat) { echo '<h2>Chat log</h2> <p>'; $prev_time = 0; foreach ($replay->chat as $content) { if ($content['time'] - $prev_time > 45000) { echo '<br />'; // we can easily see when players stopped chatting } $prev_time = $content['time']; echo '(' . convert_time($content['time']); if (isset($content['mode'])) { if (is_int($content['mode'])) { echo ' / ' . '<span class="' . $colors[$content['mode']] . '">' . $names[$content['mode']] . '</span>'; } else { echo ' / ' . $content['mode']; } } echo ') '; if (isset($content['player_id'])) { // no color for observers if (isset($colors[$content['player_id']])) { echo '<span class="' . $colors[$content['player_id']] . '">' . $content['player_name'] . '</span>: '; } else { echo '<span class="observer">' . $content['player_name'] . '</span>: '; }
echo user_link($__comment->getUser()->getName()); ?> "><?php echo $__comment->getUser()->getAliases(); ?> </a></strong> <span class="comment-name"><?php echo $__comment->getUser()->getName(); ?> </span> </p> <p> <small class="comment-post-at">评论于:</small> <span class="comment-time"><?php echo convert_time($__comment->getCommentTime()); ?> </span></p> </div> </div> <div class="comment-content"> <?php echo get_markdown($__comment->getCommentContent()); ?> </div> <div class="comment-like"> <?php if (!$__comment->userLikeComment()) { ?> <a class="comment-action-like" href="#Comment-id-<?php echo $__comment->getCommentId();
<p><span class="glyphicon glyphicon-user"></span>To:<a title="查看主页" rel="external" href="<?php echo user_link($v['user_name']); ?> "><?php echo $v['user_aliases']; ?> </a> <a class="glyphicon glyphicon-share-alt" href="<?php echo get_url("Message"); ?> ?s_to=<?php echo urlencode($v['user_name']); ?> " title="再次发送信息"></a> , <span class="glyphicon glyphicon-time"></span>Time:<span class="text-info"><?php echo convert_time($v['msg_datetime']); ?> </span>, <a class="text-danger" href="#" onclick="return message_delete(<?php echo $v['msg_id']; ?> )"><span class="glyphicon glyphicon-remove-sign"></span>删除</a></p> </td> </tr> <?php } ?> </table> <?php } ?>
function add_bet() { global $wpdb; $ID = $_POST['user_id']; $name_user = $_POST['user_nemr']; $text_bet = $_POST['text_bet']; $auction_id = $_POST['auction_id']; $rate = $_POST['bet_user']; $create = $_POST['created']; $currency = $_POST['currency']; $fl = $wpdb->insert('wp_tzs_product_rates', array('product_id' => $auction_id, 'user_id' => $ID, 'created' => $create, 'rate' => $rate, 'currency' => $currency, 'active' => '1', 'description' => $text_bet)); if ($fl) { $sql = "SELECT * FROM " . TZS_PRODUCT_RATES_TABLE . " WHERE product_id={$auction_id} ORDER BY active DESC,created DESC;"; $res = $wpdb->get_results($sql); if (count($res) == 0 && $wpdb->last_error != null) { echo $sql; print_error('Не удалось отобразить информацию о ставках. Свяжитесь, пожалуйста, с администрацией сайта.'); } else { if (count($res) == 0) { print_error('Ставки не найдены'); } else { $str_table = '<table border="0" id="tbl_products" style="float: none !important;"> <tr> <th>Статус</th> <th id="tbl_products_dtc">Размещена <br /> Отозвана</th> <!-- <th id="tbl_products_dtc">Дата и время отзыва</th> --> <th id="price">Предложенная стоимость</th> <th id="price">Комментарий</th>'; if ($user_id !== 0 || $GLOBALS['tzs_au_contact_view_all'] !== false) { $str_table .= '<th id="price">Автор <br /> Контактные данные</th></tr>'; } $i = 0; foreach ($res as $row) { $user_info = get_userdata($row->user_id); if ($row->reviewed == null) { $reviewed = " "; } else { $reviewed = convert_time($row->reviewed); } if ($row->active == 1) { $active_bet = 'Активна'; } else { $active_bet = 'Отозвана'; } $str_table .= '<tr id="' . $active_bet . '"> <td>' . $active_bet . '</td> <td>' . convert_time($row->created) . '<br />' . $reviewed . '</td> <td>' . $row->rate . ' ' . $GLOBALS["tzs_pr_curr"][$row->currency] . '</td> <td>' . $row->description . '</td>'; if ($user_id !== 0 || $GLOBALS['tzs_au_contact_view_all'] !== false) { $str_table .= '<td>'; $meta = get_user_meta($row->user_id, 'fio'); $str_table .= $meta[0] . '<br />'; $meta = get_user_meta($row->user_id, 'telephone'); if ($meta[0] == null) { $str_table .= ''; } else { $str_table .= 'Номера телефонов: ' . htmlspecialchars($meta[0]) . '<br/>'; } if ($user_info->user_email == null) { $str_table .= ''; } else { $str_table .= 'E-mail: ' . htmlspecialchars($user_info->user_email) . '<br/>'; } $meta = get_user_meta($row->user_id, 'skype'); if ($meta[0] == null) { $str_table .= ''; } else { $str_table .= 'Skype: ' . htmlspecialchars($meta[0]) . '<br/>'; } $str_table .= '</td>'; } $str_table .= '</tr>'; if ($i == 0) { $str_table .= '<input id="act_rate" style="display: none;" value="' . round($max, 2) . '" />'; } $i++; } $str_table .= '</table>'; } } echo $str_table; } else { echo "All the bad"; } wp_die(); }
if ($auth->check_auth(AUTH_DEL, $listdata['liste_id'])) { $output->assign_block_vars('delete_option', array('L_DELETE' => $lang['Button']['del_logs'])); $display_checkbox = true; } for ($i = 0; $i < $num_logs; $i++) { if (!empty($files_count[$logrow[$i]['log_id']])) { if ($files_count[$logrow[$i]['log_id']] > 1) { $s_title_clip = sprintf($lang['Joined_files'], $files_count[$logrow[$i]['log_id']]); } else { $s_title_clip = $lang['Joined_file']; } $s_clip = '<img src="../templates/images/icon_clip.png" width="10" height="13" alt="@" title="' . $s_title_clip . '" />'; } else { $s_clip = '  '; } $output->assign_block_vars('logrow', array('TD_CLASS' => !($i % 2) ? 'row1' : 'row2', 'ITEM_CLIP' => $s_clip, 'LOG_SUBJECT' => htmlspecialchars(cut_str($logrow[$i]['log_subject'], 60), ENT_NOQUOTES), 'LOG_DATE' => convert_time($nl_config['date_format'], $logrow[$i]['log_date']), 'U_VIEW' => sessid('./view.php?mode=log&action=view&id=' . $logrow[$i]['log_id'] . $get_string))); if ($display_checkbox) { $output->assign_block_vars('logrow.delete', array('LOG_ID' => $logrow[$i]['log_id'])); } } if ($action == 'view' && is_array($logdata)) { $format = !empty($_POST['format']) ? intval($_POST['format']) : 0; $output->set_filenames(array('iframe_body' => 'iframe_body.tpl')); $output->assign_vars(array('L_SUBJECT' => $lang['Log_subject'], 'L_NUMDEST' => $lang['Log_numdest'], 'L_EXPORT_T' => $lang['Export_nl'], 'L_EXPORT' => $lang['Export'], 'SUBJECT' => htmlspecialchars($logdata['log_subject'], ENT_NOQUOTES), 'S_NUMDEST' => $logdata['log_numdest'], 'S_CODEBASE' => $nl_config['urlsite'] . $nl_config['path'] . 'admin/', 'U_FRAME' => sessid('./view.php?mode=iframe&id=' . $log_id . '&format=' . $format), 'U_EXPORT' => sessid('./view.php?mode=export&id=' . $log_id))); if ($listdata['liste_format'] == FORMAT_MULTIPLE) { require WA_ROOTDIR . '/includes/functions.box.php'; $output->assign_block_vars('format_box', array('L_FORMAT' => $lang['Format'], 'L_GO_BUTTON' => $lang['Button']['go'], 'FORMAT_BOX' => format_box('format', $format, true))); } $output->files_list($logdata, $format); $output->assign_var_from_handle('IFRAME', 'iframe_body'); }
function tzs_front_end_view_shipment_handler($atts) { ob_start(); global $wpdb; $user_id = get_current_user_id(); $sh_id = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : 0; if ($sh_id <= 0) { print_error('Груз не найден'); } else { $sql = "SELECT * FROM " . TZS_SHIPMENT_TABLE . " WHERE id={$sh_id};"; $row = $wpdb->get_row($sql); if (count($row) == 0 && $wpdb->last_error != null) { print_error('Не удалось отобразить информацию о грузе. Свяжитесь, пожалуйста, с администрацией сайта'); } else { if ($row == null) { print_error('Груз не найден'); } else { $type = isset($GLOBALS['tzs_tr_types'][$row->trans_type]) ? $GLOBALS['tzs_tr_types'][$row->trans_type] : ""; $sh_type = isset($GLOBALS['tzs_sh_types'][$row->sh_type]) ? $GLOBALS['tzs_sh_types'][$row->sh_type] : ""; $path_segment_cities = explode(";", $row->path_segment_cities); $loading_types = tzs_loading_types_to_str($row); ?> <script src="/wp-content/plugins/tzs/assets/js/distance.js"></script> <div id="contact-block-right" style="left: 82%;"> <div class="span2" style="width: 80%;"> <?php echo "<img src='" . get_user_meta($row->user_id, 'company_logo', true) . "' width='145px'/>"; $form_type = 'shipments'; echo tzs_print_user_contacts($row, $form_type); ?> <?php if (isset($_GET['spis'])) { echo "<a id='edit_search' href='/account/my-shipments/'>Назад к списку</a> <div style='clear: both'></div>"; } elseif (isset($_GET['link'])) { echo "<a id='edit_search' href='/" . $_GET['link'] . (isset($_GET['active']) ? "/?active=" . $_GET['active'] : "/") . "'>Назад к списку</a> <div style='clear: both'></div>"; } else { echo "<button id='edit_search' onclick='history.back()'>Назад к списку</button> <div style='clear: both'></div>"; } ?> <?php if ($user_id == $row->user_id) { ?> <div style="margin-top: 15px;"> <a id="view_edit" onClick="javascript: window.location.href = '/account/edit-shipment/?id=<?php echo $row->id; ?> ';">Изменить</a> </div> <?php } ?> </div> </div> <div class="container" id="product-container"> <div class="row-fluid" > <div class="span4" id="img_kart"> <div class="well well-large"> <div class="pull-left label-txt"> <label><strong>Номер груза:</strong></label> </div> <div class="pull-left"> <?php echo $row->id; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Активно:</strong></label> </div> <div class="pull-left"> <?php echo $row->active == 1 ? 'Да' : 'Нет'; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Дата размещения:</strong></label> </div> <div class="pull-left"> <?php echo convert_time($row->time); ?> </div> <div class="clearfix"></div> <?php if ($row->last_edited != null) { ?> <div class="pull-left label-txt"> <label><strong>Дата <!--последнего -->изменения:</strong></label> </div> <div class="pull-left"> <?php echo convert_time($row->last_edited); ?> </div> <div class="clearfix"></div> <?php } ?> </div> </div> <div class="span6" id="descript"> <div class="well well-large"> <div class="pull-left label-txt"> <label><strong>Дата погрузки:</strong></label> </div> <div class="pull-left"> <?php echo convert_date($row->sh_date_from); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Дата выгрузки:</strong></label> </div> <div class="pull-left"> <?php echo convert_date($row->sh_date_to); ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Пункт погрузки:</strong></label> </div> <div class="pull-left" id="bet_label"> <?php echo tzs_city_to_str($row->from_cid, $row->from_rid, $row->from_sid, $row->sh_city_from); ?> </div> <div class="clearfix"></div> <?php if (count($path_segment_cities) > 2) { ?> <div class="pull-left label-txt"> <label><strong>Промежуточные<br>пункты:</strong></label> </div> <div class="pull-left"> <?php for ($i = 1; $i < count($path_segment_cities) - 1; $i++) { echo $path_segment_cities[$i] . "<br>"; } ?> </div> <div class="clearfix"></div> <?php } ?> <div class="pull-left label-txt"> <label><strong>Пункт выгрузки:</strong></label> </div> <div class="pull-left"> <?php echo tzs_city_to_str($row->to_cid, $row->to_rid, $row->to_sid, $row->sh_city_to); ?> </div> <div class="clearfix"></div> <?php if ($row->distance > 0) { ?> <div class="pull-left label-txt"> <label><strong>Расстояние:</strong></label> </div> <div class="pull-left"> <?php echo tzs_make_distance_link($row->distance, false, $path_segment_cities); ?> </div> <div class="clearfix"></div> <?php } ?> <?php if (strlen($sh_type) > 0) { ?> <div class="pull-left label-txt"> <label><strong>Тип груза:</strong></label> </div> <div class="pull-left"> <?php echo $sh_type; ?> </div> <div class="clearfix"></div> <?php } ?> <div class="pull-left label-txt"> <label><strong>Описание груза:</strong></label> </div> <div class="pull-left"> <?php echo htmlspecialchars($row->sh_descr); ?> </div> <div class="clearfix"></div> <?php if ($row->sh_weight > 0) { ?> <div class="pull-left label-txt"> <label><strong>Вес:</strong></label> </div> <div class="pull-left"> <?php echo $row->sh_weight; ?> т </div> <div class="clearfix"></div> <?php } ?> <?php if ($row->sh_volume > 0) { ?> <div class="pull-left label-txt"> <label><strong>Объем:</strong></label> </div> <div class="pull-left"> <?php echo $row->sh_volume; ?> м³ </div> <div class="clearfix"></div> <?php } ?> <div class="pull-left label-txt"> <label><strong>Количество машин:</strong></label> </div> <div class="pull-left"> <?php echo $row->trans_count; ?> </div> <div class="clearfix"></div> <?php if (strlen($type) > 0) { ?> <div class="pull-left label-txt"> <label><strong>Тип транспорта:</strong></label> </div> <div class="pull-left"> <?php echo $type; ?> </div> <div class="clearfix"></div> <?php } ?> <?php if ($row->sh_length > 0 || $row->sh_height > 0 || $row->sh_width > 0) { ?> <div class="pull-left label-txt"> <label><strong>Габариты:</strong></label> </div> <div class="pull-left" style="width: 60%"> Длина = <?php echo $row->sh_length; ?> м<br>Ширина = <?php echo $row->sh_width; ?> м<br>Высота = <?php echo $row->sh_height; ?> м </div> <div class="clearfix"></div> <?php } ?> <?php if (strlen($loading_types) > 0) { ?> <div class="pull-left label-txt"> <label><strong>Загрузка:</strong></label> </div> <div class="pull-left" style="width: 60%"> <?php echo str_replace(', ', ',<br>', $loading_types); ?> </div> <div class="clearfix"></div> <?php } ?> <?php //$cost = tzs_cost_to_str($row->cost); $cost = tzs_price_query_to_str($row); if (count($cost) > 0) { ?> <div class="pull-left label-txt"> <label><strong>Цена:</strong></label> </div> <div class="pull-left" style="width: 60%"> <?php echo $cost[0]; ?> <?php echo $cost[1] ? ' (' . $cost[1] . ')' : ''; ?> </div> <div class="clearfix"></div> <div class="pull-left label-txt"> <label><strong>Форма оплаты:</strong></label> </div> <div class="pull-left" style="width: 60%"> <?php echo str_replace(', ', ',<br>', $cost[2]); ?> </div> <div class="clearfix"></div> <?php } ?> </div> </div> </div> </div> <script> function promptDelete(id) { jQuery('<div></div>').appendTo('body') .html('<div><h6>Удалить запись '+id+'?</h6></div>') .dialog({ modal: true, title: 'Удаление', zIndex: 10000, autoOpen: true, width: 'auto', resizable: false, buttons: { 'Да': function () { jQuery(this).dialog("close"); doDelete(id); }, 'Нет': function () { jQuery(this).dialog("close"); } }, close: function (event, ui) { jQuery(this).remove(); } }); } function doDelete(id) { var data = { 'action': 'tzs_delete_shipment', 'id': id }; jQuery.post(ajax_url, data, function(response) { if (response == '1') { window.open('/account/my-shipments/', '_self'); } else { alert('Не удалось удалить: '+response); } }); } </script> <?php } } } $output = ob_get_contents(); ob_end_clean(); return $output; }
function tzs_front_end_my_shipments_handler($atts) { ob_start(); global $wpdb; $user_id = get_current_user_id(); $url = current_page_url(); $page = current_page_number(); $pp = TZS_RECORDS_PER_PAGE; $active = isset($_GET['active']) ? trim($_GET['active']) : '1'; if ($user_id == 0) { ?> <div>Для просмотра необходимо <a href="/account/login/">войти</a> или <a href="/account/registration/">зарегистрироваться</a></div> <?php } else { $sql = "SELECT COUNT(*) as cnt FROM " . TZS_SHIPMENT_TABLE . " WHERE user_id={$user_id} AND active={$active};"; $res = $wpdb->get_row($sql); if (count($res) == 0 && $wpdb->last_error != null) { print_error('Не удалось отобразить список грузов. Свяжитесь, пожалуйста, с администрацией сайта'); } else { $records = $res->cnt; $pages = ceil($records / $pp); if ($pages == 0) { $pages = 1; } if ($page > $pages) { $page = $pages; } $from = ($page - 1) * $pp; // Добавим отбор счетов и сортировку по ним для активных записей if ($active == 0) { $sql = "SELECT * FROM " . TZS_SHIPMENT_TABLE . " WHERE user_id={$user_id} AND active={$active} ORDER BY time DESC LIMIT {$from},{$pp};"; } else { $sql = "SELECT a.*,"; $sql .= " b.id AS order_id,"; $sql .= " b.number AS order_number,"; $sql .= " b.status AS order_status,"; $sql .= " b.dt_pay AS order_dt_pay,"; $sql .= " b.dt_expired AS order_dt_expired,"; $sql .= " IFNULL(b.dt_pay, a.time) AS dt_sort"; $sql .= " FROM " . TZS_SHIPMENT_TABLE . " a"; $sql .= " LEFT OUTER JOIN wp_tzs_orders b ON (b.tbl_type = 'SH' AND a.id = b.tbl_id AND ((b.status=1 AND b.dt_expired > NOW()) OR b.status=0) )"; $sql .= " WHERE a.user_id={$user_id} AND a.active={$active}"; $sql .= " ORDER BY order_status DESC, dt_sort DESC"; $sql .= " LIMIT {$from},{$pp};"; } $res = $wpdb->get_results($sql); if (count($res) == 0 && $wpdb->last_error != null) { print_error('Не удалось отобразить список транспорта. Свяжитесь, пожалуйста, с администрацией сайта'); } else { ?> <script src="/wp-content/plugins/tzs/assets/js/distance.js"></script> <div id="my_products_wrapper"> <div id="my_products_table"> <table id="tbl_products"> <thead> <tr id="tbl_thead_records_per_page"> <th colspan="4"> <div class="div_td_left"> <h3>Список <?php echo $active === '1' ? 'публикуемых' : 'архивных'; ?> грузов</h3> </div> </th> <th colspan="6"> <div id="my_products_button"> <?php if ($active === '1') { ?> <button id="view_del" onClick="javascript: window.open('/account/my-shipments/?active=0', '_self');">Показать архивные</button> <?php } else { ?> <button id="view_edit" onClick="javascript: window.open('/account/my-shipments/?active=1', '_self');">Показать публикуемые</button> <?php } ?> <button id="view_add" onClick="javascript: window.open('/account/add-shipment/', '_self');">Добавить груз</button> </div> </th> </tr> <tr> <th id="tbl_trucks_id">№, дата и время заявки</th> <th id="tbl_trucks_path" nonclickable="true">Пункты погрузки /<br>выгрузки</th> <th id="tbl_trucks_dtc">Дата погрузки /<br>выгрузки</th> <th id="tbl_trucks_ttr">Тип груза</th> <th id="tbl_trucks_wv">Вес,<br>объем</th> <th id="tbl_trucks_comm">Описание груза</th> <th id="tbl_trucks_cost">Стоимость,<br/>цена 1 км</th> <th id="tbl_trucks_payment">Форма оплаты</th> <th id="comm">Комментарии</th> <th id="actions" nonclickable="true">Действия</th> </tr> </thead> <tbody> <?php foreach ($res as $row) { $type = trans_types_to_str($row->trans_type, $row->tr_type); $cost = tzs_cost_to_str($row->cost, true); ?> <tr rid="<?php echo $row->id; ?> " <?php echo $row->order_status == 1 ? ' class="top_record"' : ($row->order_status !== null && $row->order_status == 0 ? ' class="pre_top_record"' : ''); ?> > <td> <?php echo $row->id; ?> <br> <?php echo convert_time($row->time); ?> </td> <td> <?php echo tzs_city_to_str($row->from_cid, $row->from_rid, $row->from_sid, $row->sh_city_from); ?> <br/><?php echo tzs_city_to_str($row->to_cid, $row->to_rid, $row->to_sid, $row->sh_city_to); ?> <?php if ($row->distance > 0) { ?> <br/> <?php echo tzs_make_distance_link($row->distance, false, array($row->sh_city_from, $row->sh_city_to)); ?> <?php } ?> </td> <td><?php echo convert_date($row->sh_date_from); ?> <br/><?php echo convert_date($row->sh_date_to); ?> </td> <td><?php echo $GLOBALS['tzs_sh_types'][$row->sh_type]; ?> </td> <td> <?php if ($row->sh_weight > 0) { echo remove_decimal_part($row->sh_weight) . ' т<br>'; } if ($row->sh_volume > 0) { echo remove_decimal_part($row->sh_volume) . ' м³'; } ?> </td> <td><?php echo htmlspecialchars($row->sh_descr); ?> </td> <td> <?php if ($row->price > 0) { echo $row->price . ' ' . $GLOBALS['tzs_curr'][$row->price_val] . '<br><br>'; echo round($row->price / $row->distance, 2) . ' ' . $GLOBALS['tzs_curr'][$row->price_val] . '/км'; } ?> </td> <td><?php echo $cost[1]; ?> </td> <td><?php echo htmlspecialchars($row->comment); ?> </td> <td> <a href="javascript:doDisplay(<?php echo $row->id; ?> );" at="<?php echo $row->id; ?> " id="icon_set">Действия</a> <div id="menu_set" id2="menu" for="<?php echo $row->id; ?> " style="display:none;"> <ul> <a href="/account/view-shipment/?id=<?php echo $row->id; ?> &link=my-shipments&active=<?php echo $active; ?> ">Смотреть</a> <a href="/account/edit-shipment/?id=<?php echo $row->id; ?> ">Изменить</a> <?php if ($row->active && $row->order_status === null) { ?> <a href="javascript:promptPickUp(<?php echo $row->id; ?> , 'SH');">В ТОП</a> <?php } ?> <?php if ($row->active && $row->order_status !== null && $row->order_status == 0) { ?> <a href="/account/view-order/?id=<?php echo $row->order_id; ?> ">Счет ТОП</a> <?php } ?> <a href="javascript: promptDelete(<?php echo $row->id . ', ' . $row->active; ?> );" id="red">Удалить</a> </ul> </div> </td> </tr> <?php } ?> </tbody> </table> </div> </div> <?php include_once WP_PLUGIN_DIR . '/tzs/front-end/tzs.my.new_order.php'; ?> <script src="/wp-content/plugins/tzs/assets/js/jquery.stickytableheaders.min.js"></script> <script> jQuery(document).ready(function(){ jQuery('table').on('click', 'td', function(e) { var nonclickable = 'true' == e.delegateTarget.rows[1].cells[this.cellIndex].getAttribute('nonclickable'); var id = this.parentNode.getAttribute("rid"); if (!nonclickable) document.location = "/account/view-shipment/?id="+id+"&link=my-shipments&active=<?php echo $active; ?> "; }); jQuery("#tbl_products").stickyTableHeaders(); }); function doDisplay(id) { var el = jQuery('div[for='+id+']'); if (el.attr('style') == null) { el.attr('style', 'display:none;'); jQuery('a[at='+id+']').attr('id', 'icon_set'); } else { el.removeAttr('style'); jQuery('a[at='+id+']').attr('id', 'icon_set_cur'); } jQuery("div[id2=menu]").each(function(i) { var id2 = this.getAttribute('for'); if (id2 != ''+id) { this.setAttribute('style', 'display:none;'); jQuery('a[at='+id2+']').attr('id', 'icon_set'); } }); } function promptDelete(id, active) { if (active === 1) { var s_text = '<div><h2>Удалить запись '+id+' или перенести в архив ?</h2><hr/><p>Запись из архива можно в любой момент снова опубликовать.</p></div>'; buttons1 = new Object({ 'В архив': function () { jQuery(this).dialog("close"); doDelete(id, 0); }, 'Удалить': function () { jQuery(this).dialog("close"); doDelete(id, 1); }, 'Отменить': function () { jQuery(this).dialog("close"); } }); } else { var s_text = '<div><h2>Удалить запись '+id+' из архива ?</h2><hr/><p>Запись из архива можно в любой момент снова опубликовать.</p></div>'; buttons1 = new Object({ 'Удалить': function () { jQuery(this).dialog("close"); doDelete(id, 1); }, 'Отменить': function () { jQuery(this).dialog("close"); } }); } jQuery('<div></div>').appendTo('body') .html(s_text) .dialog({ modal: true, title: 'Удаление', zIndex: 10000, autoOpen: true, width: 'auto', resizable: false, buttons: buttons1, close: function (event, ui) { jQuery(this).remove(); } }); } function doDelete(id, is_delete) { var data = { 'action': 'tzs_delete_shipment', 'id': id, 'is_delete': is_delete }; jQuery.post(ajax_url, data, function(response) { if (response == '1') { location.reload(); } else { alert('Не удалось удалить: '+response); } }); } </script> <?php build_pages_footer($page, $pages); } } } $output = ob_get_contents(); ob_end_clean(); return $output; }
<?php $url = $__user->getUrl(); if (!empty($url)) { ?> <p class="well-sm well" style="overflow: hidden">个人主页:<br><a href="<?php echo $url; ?> "><?php echo $url; ?> </a></p> <?php } ?> <p class="well-sm well">注册时间:<span class="text-info"><?php echo convert_time($__user->getRegisteredTime()); ?> </span></p> <p class="well-sm well"> <a href="<?php echo user_gallery_list_link($__user->getName()); ?> "> 图集数量:<span class="text-info"><?php echo isset($__count['gallery_count']) ? $__count['gallery_count'] . " 个" : "无"; ?> </span></a><br> 上传图片:<span class="text-info"><?php echo isset($__count['picture_count']) ? $__count['picture_count'] . " 张" : "无"; ?>