return $value;
}
- private function saveAddress($pid, $adrid, array &$address)
+ private function saveAddress($pid, $addrid, array &$address, $type)
{
require_once "geocoding.inc.php";
subAdministrativeAreaId, administrativeAreaId,
countryId, latitude, longitude, updateTime, pub, comment,
north, south, east, west)
- VALUES ({?}, 'home', {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?},
+ VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?},
{?}, {?}, FROM_UNIXTIME({?}), {?}, {?}, {?}, {?}, {?}, {?})",
- $pid, $addrid, $flags, $address['accuracy'],
+ $pid, $type, $addrid, $flags, $address['accuracy'],
$address['text'], $address['postalText'], $address['postalCode'], $address['localityId'],
$address['subAdministrativeAreaId'], $address['administrativeAreaId'],
$address['countryId'], $address['latitude'], $address['longitude'],
WHERE uid = {?} AND link_type = 'address'",
$page->pid());
foreach ($value as $addrid => &$address) {
- $this->saveAddress($page->pid(), $addrid, $address);
+ $this->saveAddress($page->pid(), $addrid, $address, 'home');
$profiletel = new ProfilePhones('address', $addrid);
$profiletel->saveTels($page->pid(), 'tel', $address['tel']);
}
protected function _fetchData()
{
- $res = XDB::query("SELECT type, id, accuracy, text, postalText,
+ $res = XDB::query("SELECT id, accuracy, text, postalText,
postalCode, localityId, subAdministrativeAreaId, administrativeAreaId,
- countryId, latitude, longitude, pub, comment, updateTime,
+ countryId, latitude, longitude, pub, comment, UNIX_TIMESTAMP(updateTime) AS updateTime,
north, south, east, west,
FIND_IN_SET('current', flags) AS current,
FIND_IN_SET('temporary', flags) AS temporary,
$i = 0;
$adrNb = count($this->values['addresses']);
while ($tel = $res->next()) {
- $adrid = $tel['addrid'];
+ $addrid = $tel['addrid'];
unset($tel['addrid']);
- while ($i < $adrNb && $this->values['addresses'][$i]['id'] < $adrid) {
+ while ($i < $adrNb && $this->values['addresses'][$i]['id'] < $addrid) {
$i++;
}
if ($i >= $adrNb) {
if (!isset($address['tel'])) {
$address['tel'] = array();
}
- if ($address['id'] == $adrid) {
+ if ($address['id'] == $addrid) {
$address['tel'][] = $tel;
}
}
foreach ($this->values['addresses'] as $id => &$address) {
if (!isset($address['tel'])) {
- $address['tel'] = array();
+ $address['tel'] = array(
+ 0 => array(
+ 'type' => 'fixed',
+ 'tel' => '',
+ 'pub' => 'private',
+ 'comment' => '',
+ )
+ );
}
unset($address['id']);
+ $address['changed'] = 0;
+ $address['removed'] = 0;
}
}
}