<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
public function saveArticle(&$a)
{
+ $a->_cid = ($a->_cid == 0) ? null : $a->_cid;
if ($a->_aid >= 0) {
XDB::execute('REPLACE INTO newsletter_art (id, aid, cid, pos, title, body, append)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})',
$user = is_null($uid) ? S::v('uid') : $uid;
$res = XDB::query("SELECT 1
FROM newsletter_ins
- WHERE user_id={?}", $user);
+ WHERE uid={?}", $user);
return $res->fetchOneCell();
}
{
$user = is_null($uid) ? S::v('uid') : $uid;
XDB::execute("DELETE FROM newsletter_ins
- WHERE user_id={?}", $user);
+ WHERE uid={?}", $user);
}
static public function subscribe($uid = null)
{
$user = is_null($uid) ? S::v('uid') : $uid;
- XDB::execute("REPLACE INTO newsletter_ins (user_id,last)
- VALUES ({?}, 0)", $user);
+ XDB::execute("REPLACE INTO newsletter_ins (uid,last)
+ VALUES ({?}, NULL)", $user);
}
protected function subscriptionWhere()