<?php
if(!user_access('toponimo admin')){
drupal_access_denied();
exit;
}
if(isset($_GET['ekin'])){
$result = db_query("SELECT nid, lid FROM topo_lekuko");
while($row = db_fetch_object($result)){
$lids[$row->lid][] = $row->nid;
}
foreach($lids as $k => $v){
$nid_links = array();
foreach($v as $nid){
$nid_links[] = l($nid, "node/$nid");
}
db_queryd('UPDATE topo_ahozko SET nid = "%s" WHERE id = %d', join($nid_links, ', '), $k);
}
$output .= '<p>Lekukotzen taula eguneratu da.</p>';
} else {
print '<p>Lekukotzen taulan lekukotzari dagokion toponimoaren IDa erantsi, lotura eginez: '.l('ekin', $_GET['q'], array(), 'ekin=1').'</p>';
}
?>