exten => _8XXXXXXXXXX/111, 1, Dial(DAHDI/1/${EXTEN})
exten => _8XXXXXXXXXX/_2XX, 1, Dial(DAHDI/2/${EXTEN})
<?php
$rowblock = -2;
$rows = array();
foreach ($profile as $i => $user) {
if ($i%4 == 0) {
$rows[] = '<tr>';
$rows[] = '<tr>';
$rowblock += 2;
}
$rows[$rowblock] .= "<td><img src='/profile/user/{$user['pro_img']}'>";
$rows[$rowblock+1] .= "<td><p>{$user['pro_fam']} {$user['pro_im']} {$user['pro_otch']}<p>{$user['dol_name']}";
}
for ($i = $i%4; $i < 3; $i++) {
$rows[$rowblock] .= "<td>";
$rows[$rowblock+1] .= "<td>";
}
echo "<table>",implode('', $rows),"</table>";
?>
var query = event.latLng.toUrlValue(15);
function monthDays(year, month) {
return (month == 2 ?
((year % 4 != 0 ||
(year % 100 == 0 && year % 400 != 0)) ? 28 : 29) :
(((month < 8 && (month & 1) == 0) ||
(month > 7 && (month & 1) == 1)) ? 31 : 30));
}
function dateDiff(date1, date2) {
var years, months, days, hours, minutes, seconds;
var y1, m1, d1, d2, dd;
years = date2.getUTCFullYear()-(y1 = date1.getUTCFullYear());
months = date2.getUTCMonth()-(m1 = date1.getUTCMonth());
days = (d2 = date2.getUTCDate())-(d1 = date1.getUTCDate());
hours = date2.getUTCHours()-date1.getUTCHours();
minutes = date2.getUTCMinutes()-date1.getUTCMinutes();
seconds = date2.getUTCSeconds()-date1.getUTCSeconds();
dd = 0;
if (seconds < 0) {
seconds += 60;
minutes--;
}
if (minutes < 0) {
minutes += 60;
hours--;
}
if (hours < 0) {
hours += 24;
days--;
dd = 1;
}
if (days < 0) {
days = monthDays(y1, m1)-d1+d2-dd;
months--;
}
if (months < 0) {
months += 12;
years--;
}
return {years: years, months: months, days: days,
hours: hours, minutes: minutes, seconds: seconds};
}
var d1 = new Date("10/7/1917");
var d2 = new Date('3/28/2014');
var diff = dateDiff(d1, d2);
console.log(diff.years+' лет, '+
diff.months+' месяцев, '+
diff.days+' дней, '+
diff.hours+' часов, '+
diff.minutes+' минут, '+
diff.seconds+' секунд');
INSERT IGNORE INTO `table` (`field1`, `field2`, `field3`)
VALUES (`valA1`, `valA2`, `valA3`), (`valB1`, `valB2`, `valB3`)
INSERT INTO `table` (`field1`, `field2`, `field3`)
VALUES (`valA1`, `valA2`, `valA3`), (`valB1`, `valB2`, `valB3`)
ON DUPLICATE KEY UPDATE `field2` = VALUES(`field2`), `field3` = VALUES(`field3`)
DELETE FROM `table` WHERE `field1` IN (`valA1`, `valB1`)
var points = [{x: 0, y: 0}, {x: 0, y: 50}, {x: 10, y: 50}, {x: 10, y: 0}];
var segLen = [];
var totalLen = 0;
for (var i = 0; i < points.length-1; i++) {
var l = Math.sqrt((points[i+1].x-points[i].x)*(points[i+1].x-points[i].x)+
(points[i+1].y-points[i].y)*(points[i+1].y-points[i].y));
segLen.push(l);
totalLen += l;
}
var percent = 55;
var needLen = totalLen*percent/100;
for (var i = 0; i < points.length-1 && needLen > 0; i++)
if (needLen >= segLen[i]) {
// пройти путь points[i] - points[i+1]
needLen -= segLen[i];
} else {
x = points[i].x+(points[i+1].x-points[i].x)*needLen/segLen[i];
y = points[i].y+(points[i+1].y-points[i].y)*needLen/segLen[i];
// пройти путь points[i] - {x, y}
needLen = 0;
}