Пример #1
0
        }
        return true;
    }
    return false;
}
$res = XDB::rawIterator('SELECT  pd.pid, pd.private_name, pn.lastname_main, pn.lastname_marital, pn.lastname_ordinary,
                                 pn.firstname_main, pn.firstname_ordinary, pn.pseudonym
                           FROM  profile_display      AS pd
                     INNER JOIN  profile_public_names AS pn ON (pd.pid = pn.pid)');
$pattern = '/^([^\\(\\)]+)(?: (\\([^\\(\\)]+\\)))?(?: (\\([^\\(\\)]+\\)))?(?: (\\([^\\(\\)]+\\)))?$/';
while ($data = $res->next()) {
    preg_match($pattern, $data['private_name'], $matches);
    $has_ordinary = false;
    $count = count($matches);
    $update = array();
    $has_ordinary = update_main($data, $matches[1], $update);
    for ($i = 2; $i < $count; ++$i) {
        if (preg_match('/^\\((?:M|Mme) (.+)\\)$/', $matches[$i], $pieces)) {
            update_marital($data, $pieces[1], $update);
        } elseif (preg_match('/^\\((?:alias|autres prénoms :|autres noms :) .+\\)$/', $matches[$i], $pieces)) {
            update_private($data, $matches[$i], $data['pid'], $aliases, $perform_updates);
        } else {
            $has_ordinary = update_plain($data, $matches[$i], $update, $has_ordinary);
        }
    }
    if (count($update)) {
        $set = implode(', ', $update);
        if ($perform_updates) {
            XDB::rawExecute('UPDATE  profile_public_names
                                SET  ' . $set . '
                              WHERE  pid = ' . $data['pid']);
Пример #2
0
<?php

include_once "htmllib/lib/include.php";
include_once "htmllib/lib/updatelib.php";
exit_if_another_instance_running();
update_main();