Esempio n. 1
0
 $mapper = new FooMapper($db);
 $files = $mapper->selectToken($foo);
 if (empty($files)) {
     $app->notFound();
 }
 foreach ($files as $value) {
     $file_id = $value['id'];
     //$userFile_id = $value['user_id'];
 }
 $commentObj = new Comment();
 $commentObj->file_id = $file_id;
 $commentMapper = new CommentMapper($db);
 $comments = $commentMapper->select($commentObj);
 ini_set('display_errors', 'Off');
 $checkrights = new Checkrights();
 $checkrights->Render($files, $app, $comments);
 if (!empty($_POST['comment'])) {
     $logged = new Logged();
     $cookie = $app->getCookie('username');
     $user_id = $logged->getLogged($db, $cookie);
     $postcomment = new postComment($file_id, $user_id, $db);
     $regExp = new RegExp();
     $comment = $regExp->match(trim($_POST['comment']));
     $postcomment->post($comment);
     $app->redirect("{$id}");
 }
 if (isset($_POST['public'])) {
     $regExp = new RegExp();
     $tags = $regExp->match(trim($_POST['tags']));
     $description = $regExp->match(trim($_POST['description']));
     $public = $regExp->match($_POST['public']);