WHERE name = {?}",
$address[$area . 'Name']);
if ($res->numRows() == 0) {
- $address[$area . 'Id'] = XDB::execute("INSERT INTO " . $databases[$area] . " (name, country)
- VALUES ({?}, {?})",
- $address[$area . 'Name'], $address['countryId']);
+ XDB::execute('INSERT INTO ' . $databases[$area] . ' (name, country)
+ VALUES ({?}, {?})',
+ $address[$area . 'Name'], $address['countryId']);
+ $address[$area . 'Id'] = XDB::insertId();
} else {
$address[$area . 'Id'] = $res->fetchOneCell();
}
$page->assign('neuneu', true);
} else {
$page->assign('email',$email);
- $x = XDB::fetchOneAssoc("SELECT e1.uid, e1.panne != 0 AS panne,
- (count(e2.uid) + IF(FIND_IN_SET('googleapps', eo.storage), 1, 0)) AS nb_mails
- FROM emails as e1
+ $x = XDB::fetchOneAssoc("SELECT e1.uid, e1.panne != 0 AS panne, a.hruid,
+ (COUNT(e2.uid) + IF(FIND_IN_SET('googleapps', eo.storage), 1, 0)) AS nb_mails
+ FROM emails AS e1
INNER JOIN email_options AS eo ON (eo.uid = e1.uid)
- LEFT JOIN emails as e2 ON(e1.uid = e2.uid
- AND FIND_IN_SET('active', e2.flags)
- AND e1.email != e2.email)
+ INNER JOIN accounts AS a ON (e1.uid = a.uid)
+ LEFT JOIN emails AS e2 ON (e1.uid = e2.uid
+ AND FIND_IN_SET('active', e2.flags)
+ AND e1.email != e2.email)
WHERE e1.email = {?}
GROUP BY e1.uid", $email);
if ($x) {
WHERE p.eid = {?} AND p2.eid IS NULL
GROUP BY p.uid', $evt['eid']);
- $ofs = Env::i('offset');
- $tot = (Env::v('initiale') ? $tot : $nb_tot);
- $nbp = ceil($tot / NB_PER_PAGE);
+ $ofs = Env::i('offset');
+ $tot = (is_null($evt['nb_tot']) ? $evt['nb'] : $evt['nb_tot']);
+ $nbp = ceil($tot / NB_PER_PAGE);
if ($nbp > 1) {
$links = array();
if ($ofs) {
for ($i = 1 ; $i <= $nbp; $i++) {
$links[(string)$i] = $i - 1;
}
- if ($ofs < $nbp) {
+ if ($ofs < $nbp - 1) {
$links['suivant'] = $ofs+1;
}
$page->assign('links', $links);