예제 #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;
 }
예제 #2
0
파일: news.php 프로젝트: skdong/nfs-ovd
function show_manage($news_id_)
{
    $news = Abstract_News::load($news_id_);
    if (!is_object($news)) {
        redirect('news.php');
    }
    $can_manage_news = isAuthorized('manageNews');
    page_header();
    echo '<div id="news_div">';
    echo '<h1>' . $news->title . '</h1>';
    echo '<div>';
    echo '<h2>' . _('Modify') . '</h2>';
    echo '<table border="0" cellspacing="1" cellpadding="3">';
    if ($can_manage_news) {
        echo '<form action="news.php" method="post">';
        echo '<input type="hidden" name="action" value="rename" />';
        echo '<input type="hidden" name="id" value="' . $news->id . '" />';
        echo '<tr><td><strong>Title:</strong></td><td><input type="text" name="news_title" value="' . $news->title . '" /></td></tr>';
        echo '<tr><td><strong>Content:</strong></td><td><textarea name="news_content" cols="40" rows="4">' . $news->content . '</textarea></td></tr>';
        echo '<tr><td colspan="2"><input type="submit" value="' . _('Modify') . '" /></td></tr>';
        echo '</form>';
    }
    echo '</table>';
    echo '</div>';
    echo '</div>';
    page_footer();
}
예제 #3
0
파일: api.php 프로젝트: bloveing/openulteo
 public function news_modify($id_, $title_, $content_)
 {
     $this->check_authorized('manageNews');
     $news = Abstract_News::load($id_);
     if (!$news) {
         return false;
     }
     $news->title = $title_;
     $news->content = $content_;
     Abstract_News::save($news);
     $this->log_action('news_modify', array('id' => $id_, 'title' => $title_, 'content' => $content_));
     return true;
 }