Example #1
0
function updateNews()
{
    $news = new News();
    $news->id($_REQUEST['id']);
    $get_edited = array();
    foreach ($_REQUEST as $k => $v) {
        $get_edited[str_replace("edit_", "", $k)] = $v;
    }
    $news->setValues($get_edited);
    if ($news->updateNews()) {
        Common::jsonSuccess("News Update Successfully!");
    } else {
        Common::jsonError("Error");
    }
}
Example #2
0
 /** Edit a news story
  * @access public
  * @return void
  */
 public function editAction()
 {
     $form = new NewsStoryForm();
     $form->submit->setLabel('Update story');
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $this->_news->updateNews($form->getValues(), $this->getParam('id'));
             $this->_helper->solrUpdater->update('content', $this->getParam('id'), 'news');
             $this->getFlash()->addMessage('News story information updated!');
             $this->redirect(self::REDIRECT);
         } else {
             $form->populate($this->_request->getPost());
         }
     } else {
         // find id is expected in $params['id']
         $id = (int) $this->_request->getParam('id', 0);
         if ($id > 0) {
             $form->populate($this->_news->fetchRow('id=' . $id)->toArray());
         }
     }
 }
Example #3
0
<?php

require __DIR__ . "/model/Database.php";
require __DIR__ . "/model/Article.php";
if (!empty($_POST)) {
    $news = new News();
    $news->title = $_POST['title'];
    $news->content = $_POST['content'];
    $news->author = $_POST['author'];
    $news->updateNews($_GET['id']);
    header("Location:/");
    exit;
}
include __DIR__ . "/view/update.php";
Example #4
0
 $news_obj = new News();
 $id = (int) $_POST['id'];
 switch ($_POST['act']) {
     case "update":
         if (isset($_POST['title']) && isset($_POST['tomtat']) && isset($_POST['content']) && isset($_POST['cat_id']) && isset($_POST['hotnews']) && isset($_POST['featured'])) {
             $title = $_POST['title'];
             $tomtat = $_POST['tomtat'];
             $content = $_POST['content'];
             $cat_id = $_POST['cat_id'];
             $hotnews = $_POST['hotnews'];
             $featured = $_POST['featured'];
             if (!empty($_FILES['file']['name'])) {
                 $temp_name = explode(".", $_FILES["file"]["name"]);
                 $newfilename = microtime() . "." . end($temp_name);
                 if (upload_image($_FILES['file'], $newfilename)) {
                     if ($news_obj->updateNews($title, $newfilename, $tomtat, $content, $cat_id, $hotnews, $featured, $id)) {
                         header("Location: ../index.php?view=list-news&stt=success");
                     } else {
                         header("Location: ../index.php?view=list-news&stt=fail");
                     }
                 }
             } else {
                 if ($news_obj->updateNews($title, "", $tomtat, $content, $cat_id, $hotnews, $featured, $id)) {
                     header("Location: ../index.php?view=list-news&stt=success");
                 } else {
                     header("Location: ../index.php?view=list-news&stt=fail");
                 }
             }
         }
         break;
     case "xoa":
Example #5
0
} else {
    $baseDir = $bvsSiteIni['ENVIRONMENT']['DATABASE_PATH'];
}
if ($_COOKIE['userID'] == "") {
    Header("Location: /");
}
$DirNameLocal = dirname(__FILE__) . '/';
/*
	adicionando a noticia pelo postBack
*/
if (isset($_GET['remove_home_page'])) {
    $news = new News();
    $news->setUserID($_COOKIE['userID']);
    $news->setID($_GET['remove_home_page']);
    $news->setInHome('0');
    $news->updateNews();
    header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/myNews.php");
    exit;
}
if (isset($_POST['rss_url'])) {
    $news = new News();
    $news->setUserID($_COOKIE['userID']);
    $news->setRSSURL($_POST['rss_url']);
    $news->setInHome(false);
    $news->addNews();
    header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/myNews.php");
    exit;
}
if (isset($_POST['remove_news_id'])) {
    $news = new News();
    $news->setUserID($_COOKIE['userID']);
Example #6
0
<?php

include "../../../classes/Database.php";
include "../../../classes/Connection.php";
include_once "../../../includes/bootstrap.php";
include "../../../classes/News.php";
include "../../../classes/AdminAction.php";
include "../../../includes/security.funcs.inc";
include_once "../../../includes/Pagination.php";
if (isset($_POST['submit'])) {
    $_POST = sanitize($_POST);
    $news = $_POST;
    settype($news, 'object');
    News::updateNews($news);
    $success = "News Successfully Changed!";
    $updates = 'Update news and events content';
    AdminAction::addAdminAction($_SESSION['admin_name'], $updates);
}
?>
<!DOCTYPE html>  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">  
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
_admin/_assets/css/core3.css" /> 
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>