예제 #1
0
 public static function save($news_)
 {
     Logger::debug('main', 'Starting Abstract_News::save for \'' . $news_->id . '\'');
     $SQL = SQL::getInstance();
     $id = $news_->id;
     if (!Abstract_News::load($id)) {
         Logger::debug('main', "Abstract_News::save({$news_}) unable to load news, we must create it");
         $id = Abstract_News::create($news_);
         if (!$id) {
             Logger::error('main', "Abstract_News::save({$news_}) Abstract_News::create failed");
             return false;
         }
     }
     $SQL->DoQuery('UPDATE @1 SET @2=%3,@4=%5,@6=%7 WHERE @8 = %9 LIMIT 1', $SQL->prefix . 'news', 'title', $news_->title, 'content', $news_->content, 'timestamp', $news_->timestamp, 'id', $id);
     return true;
 }