Example #1
0
 public function editComment()
 {
     $manageCommentsModel = new ManageCommentsModel();
     if (!isset($_GET['id']) && !isset($_GET['meme_id'])) {
         $id = intval($_POST['id']);
         $meme_id = intval($_POST['meme_id']);
         $model['id'] = $id;
         $model['content'] = isset($_POST['content']) ? $_POST['content'] : '';
         $manageCommentsModel->UpdateItem($model);
         header('location: ManageComments.php?action=listComments&meme_id=' . $meme_id);
     }
     $id = intval($_GET['id']);
     $meme_id = intval($_GET['meme_id']);
     $model = $manageCommentsModel->GetItemById($id);
     $view = new view('manage_comments/editComment');
     $view->assign('model', $model);
     $template = new View('common/administration');
     $include = str_replace('<!--[[content]]-->', $view->output(), $template->output());
     echo $include;
 }
Example #2
0
 public function editUser()
 {
     $manageUsersModel = new ManageUsersModel();
     $id = intval($_GET['id']);
     if ($id > 0) {
         $user = $manageUsersModel->GetItemById($id);
         $model['id'] = $id;
         $model['username'] = $user['username'];
         $model['password'] = $user['password'];
         $model['firstname'] = $user['firstname'];
         $model['lastname'] = $user['lastname'];
         $model['email'] = $user['email'];
     } else {
         $model = array('id' => $id, 'username' => '', 'firstname' => '', 'lastname' => '', 'email' => '');
     }
     $view = new view('manage_users/edit_user');
     $view->assign('model', $model);
     $template = new View('common/site');
     $include = str_replace('<!--[[content]]-->', $view->output(), $template->output());
     echo $include;
 }
if (file_exists(BASEDIR . $uri) and strpos(array_pop($uri_array), ".") !== FALSE) {
    include BASEDIR . $uri;
    exit;
}
//open link to database server and select right database
$link_identifier = mysql_connect(SERVER, USER, PASS) or die("Keine Verbindung zur Datenbank!!!!");
mysql_select_db(DATABASE, $link_identifier);
//check, what's the request for...
switch ($uri_array[0]) {
    case "suche":
        require_once "search/search.php";
        if (isset($_GET)) {
            $module = new search($link_identifier);
            $module->perform_search();
        }
        break;
    default:
        require_once "articles/view.php";
        $module = new view($uri_array, $link_identifier);
        $module->generate();
        break;
}
//parse the navigational contents
include_once "parser/templ_parser.php";
$parser = new templ_parser("nav.html");
$nav = $parser->parse();
//main parse, include of content
$parser = new templ_parser("main.html");
$output = $parser->parse(array("navigation" => $nav, "content" => $module->output()));
//print to page
print $output;
Example #4
0
 public function showMeme()
 {
     $manageMemesModel = new ManageMemesModel();
     $id = intval($_GET['id']);
     $model['meme'] = $manageMemesModel->GetMeme($id);
     $model['comments'] = $manageMemesModel->GetMemeComments($id);
     $model['likes'] = $manageMemesModel->GetMemeLikes($id);
     $view = new view('manage_memes/show_meme');
     $view->assign('model', $model);
     $template = new View('common/site');
     $include = str_replace('<!--[[content]]-->', $view->output(), $template->output());
     echo $include;
 }
Example #5
0
 public function login()
 {
     $manageUsersModel = new ManageUsersModel();
     $model['username'] = isset($_POST['username']) ? $_POST['username'] : '';
     $model['password'] = isset($_POST['password']) ? $_POST['password'] : '';
     if ($manageUsersModel->AuthenticateUser($model['username'], $model['password'])) {
         $_SESSION['logged_user'] = $model['username'];
         $_SESSION['author_id'] = $manageUsersModel->getUserId($model['username'], $model['password']);
         if (isset($_POST['isadmin'])) {
             $_SESSION['isadmin'] = true;
         }
         header('location: home.php?action=index');
     }
     if (!isset($_POST['username']) && !isset($_POST['password'])) {
         $view = new view('manage_users/singin');
         $template = new View('common/site');
         $include = str_replace('<!--[[content]]-->', $view->output(), $template->output());
         echo $include;
     } else {
         $model_errors['authentication_failed'] = 'Unknown username and password!';
         $view = new view('manage_users/singin');
         $view->assign('model_errors', $model_errors);
         $template = new View('common/site');
         $include = str_replace('<!--[[content]]-->', $view->output(), $template->output());
         echo $include;
     }
 }