Exemplo n.º 1
0
 public function indexAction()
 {
     $id = $this->getRequest()->getParam('id');
     $Content = Content::getById($id);
     if ($Content) {
         $this->view->Title = $Content->content_title;
         $this->view->headTitle($this->view->Title);
         $this->view->Content = $Content;
         //$this->view->headMeta ()->appendName ( 'description', $Content->content_description )->appendName ( 'keywords', $Content->content_keyword );
     }
 }
Exemplo n.º 2
0
 /**
  * Delete a Country
  */
 public function deleteAction()
 {
     $Content = Content::getById($this->getRequest()->getParam('id'));
     if ($Content) {
         if ($this->getRequest()->isPost()) {
             $Content->delete();
             $this->Member->log('Bài viết: ' . $Content->content_title . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa');
             My_Plugin_Libs::setSplash('Bài viết: <b>' . $Content->content_title . '</b> đã được xóa khỏi hệ thống.');
             $this->_redirect($this->_helper->url('index', 'content', 'admin'));
         }
         $this->view->Content = $Content;
     }
 }
Exemplo n.º 3
0
 /**
  * Delete a Country
  */
 public function deleteAction()
 {
     $Content = Content::getById($this->getRequest()->getParam('id'));
     if ($Content) {
         if ($this->getRequest()->isPost()) {
             $Content->delete();
             $this->Member->log('Delete: ' . $Content->content_title . '(' . $this->getRequest()->getParam('id') . ')', 'Content');
             My_Plugin_Libs::setSplash('Posts: <b>' . $Content->content_title . '</b> have been delete.');
             $this->_redirect($this->_helper->url('index', 'content', 'admin'));
         }
         $this->view->Content = $Content;
     }
 }
Exemplo n.º 4
0
function editContent()
{
    global $lang;
    $page_lang = scandir('inc/lang/' . $_SESSION['language']);
    foreach ($page_lang as $file) {
        if ($file != '.' && $file != '..') {
            $parts = explode(".", $file);
            $page = $parts[0];
            if ($page == 'content') {
                $page_file = $file;
            }
        }
    }
    include_once 'inc/lang/' . $_SESSION['language'] . '/' . $page_file;
    if ($_SESSION['access']->content > 1) {
        $results = array();
        if (isset($_POST['saveChanges'])) {
            $_POST['id'] = $_POST['editId'];
            unset($_POST['editId']);
            // User has posted the content edit form: save the content changes
            if (!($content = Content::getById((int) $_POST['id']))) {
                header("Location: index.php?action=listContent&categoryId=" . $_GET['categoryId'] . "&error=" . ($_POST['type'] == 0) ? "category" : "page" . "NotFound");
                return;
            }
            $_POST['botAction1'] == 'on' ? $botAction1 = 'index' : ($botAction1 = 'noindex');
            $_POST['botAction2'] == 'on' ? $botAction2 = 'follow' : ($botAction2 = 'nofollow');
            $_POST['menu'] == 'on' ? $_POST['menu'] = 1 : ($_POST['menu'] = 0);
            $botActionArray = array($botAction1, $botAction2);
            $_POST['botAction'] = implode(", ", $botActionArray);
            unset($_POST['botAction1']);
            unset($_POST['botAction2']);
            $_POST['lastModified'] = date('Y-m-d');
            $content = new Content();
            $content->storeFormValues($_POST);
            $content->update();
            header("Location: index.php?action=listContent&categoryId=" . $_GET['categoryId'] . "&success=changesSaved");
        } elseif (isset($_POST['cancel'])) {
            // User has cancelled their edits: return to the content list
            header("Location: index.php?action=listContent&categoryId=" . $_GET['categoryId']);
        } else {
            // User has not submitted the content edit form: display the form
            $results['content'] = Content::getById((int) $_GET['editId']);
            require "inc/layout/editContent.php";
        }
    } else {
        require "inc/layout/noAccess.php";
    }
}
Exemplo n.º 5
0
 public function loginforgotAction()
 {
     $this->view->Title = "For gotten password";
     $this->view->headTitle($this->view->Title);
     $error = '';
     $id = 7;
     $Content = Content::getById($id);
     if ($this->getRequest()->isPost()) {
         $Request = $this->getRequest()->getParams();
         $Member = Members::getByEmail($Request['email']);
         if ($Member) {
             $String = My_Plugin_Libs::randomStr();
             $Member->encodePassword($String);
             $Member->save();
             $message = str_replace(array('%email%', '%password%'), array($Member->email, $String), $Content['content']);
             $to = $Member->email;
             $subject = $Content->title;
             $oEmail = new My_Plugin_Email();
             $oEmail->send($subject, $to, '', $message);
             $error = 'Password has been sent to your email!';
         } else {
             $error = 'Email is not macth please try again!';
         }
     }
 }