- $res = $globals->xdb->query("SELECT * FROM newsletter WHERE bits='new'");
- }
+ $res = XDB::query("SELECT * FROM newsletter WHERE bits='new'");
+ if (!$res->numRows()) {
+ insert_new_nl();
+ }
+ $res = XDB::query("SELECT * FROM newsletter WHERE bits='new'");
+ }
while (list($cid, $title) = $res->next()) {
$this->_cats[$cid] = $title;
}
while (list($cid, $title) = $res->next()) {
$this->_cats[$cid] = $title;
}
"SELECT a.title,a.body,a.append,a.aid,a.cid,a.pos
FROM newsletter_art AS a
INNER JOIN newsletter AS n USING(id)
"SELECT a.title,a.body,a.append,a.aid,a.cid,a.pos
FROM newsletter_art AS a
INNER JOIN newsletter AS n USING(id)
- global $globals;
- $globals->xdb->execute('UPDATE newsletter SET date={?},titre={?},head={?} WHERE id={?}',
- $this->_date, $this->_title, $this->_head, $this->_id);
+ XDB::execute('UPDATE newsletter SET date={?},titre={?},head={?} WHERE id={?}',
+ $this->_date, $this->_title, $this->_head, $this->_id);
- $globals->xdb->execute('REPLACE INTO newsletter_art (id,aid,cid,pos,title,body,append)
+ XDB::execute('REPLACE INTO newsletter_art (id,aid,cid,pos,title,body,append)
VALUES ({?},{?},{?},{?},{?},{?},{?})',
$this->_id, $a->_aid, $a->_cid, $a->_pos,
$a->_title, $a->_body, $a->_append);
$this->_arts['a'.$a->_aid] = $a;
} else {
VALUES ({?},{?},{?},{?},{?},{?},{?})',
$this->_id, $a->_aid, $a->_cid, $a->_pos,
$a->_title, $a->_body, $a->_append);
$this->_arts['a'.$a->_aid] = $a;
} else {
'INSERT INTO newsletter_art
SELECT {?},MAX(aid)+1,{?},'.($a->_pos ? intval($a->_pos) : 'MAX(pos)+1').',{?},{?},{?}
FROM newsletter_art AS a
'INSERT INTO newsletter_art
SELECT {?},MAX(aid)+1,{?},'.($a->_pos ? intval($a->_pos) : 'MAX(pos)+1').',{?},{?},{?}
FROM newsletter_art AS a
- function toHtml($prenom,$nom,$sexe,$body=false)
+ function toHtml($prenom, $nom, $sexe, $body=false, $urlprefix = false)
$res = '<div class="title">'.$this->title().'</div>';
$head = $this->head();
$head = str_replace('<cher>', $sexe ? 'Chère' : 'Cher', $head);
$head = str_replace('<prenom>', $prenom, $head);
$head = str_replace('<nom>', $nom, $head);
$res = '<div class="title">'.$this->title().'</div>';
$head = $this->head();
$head = str_replace('<cher>', $sexe ? 'Chère' : 'Cher', $head);
$head = str_replace('<prenom>', $prenom, $head);
$head = str_replace('<nom>', $nom, $head);
- global $globals;
- $res = $globals->xdb->query("SELECT id,date,titre FROM newsletter WHERE bits!='new' ORDER BY date DESC");
+ $res = XDB::query("SELECT id,date,titre FROM newsletter WHERE bits!='new' ORDER BY date DESC");
- global $globals;
- $user = ($uid == -1) ? Session::getInt('uid') : $uid;
- $globals->xdb->execute('REPLACE INTO newsletter_ins (user_id,last)
- VALUES ({?}, 0)', $user);
+ $user = ($uid == -1) ? S::v('uid') : $uid;
+ XDB::execute('REPLACE INTO newsletter_ins (user_id,last)
+ VALUES ({?}, 0)', $user);