Esempio n. 1
0
 public function postEnter($userarr = array())
 {
     $userarr[] = $_POST;
     $regExp = new RegExp();
     $login = $regExp->match(trim($_POST['login']));
     $password = $regExp->match(trim($_POST['password']));
     $postarr = array('login' => $login, 'password' => $password);
     return $postarr;
 }
Esempio n. 2
0
 /**
  * @return boolean
  * @param string $url
  */
 public function match($url)
 {
     $domain = $this->getSubDomain();
     $matches = array();
     if (1 !== preg_match($this->domainPattern, $domain, $matches)) {
         return false;
     }
     if (null === $this->location) {
         $this->matches = $matches;
         return true;
     }
     $result = parent::match($url);
     if ($result) {
         $this->matches = array_merge($matches, $this->matches);
     }
     return $result;
 }
Esempio n. 3
0
 $generateToken = new Token();
 $array = $filepost->postFile($generateToken, $_POST, $_FILES);
 //var_dump($filepost->postFile($generateToken, $_POST, $_FILES));
 //var_dump($array);
 $cookiecheck = new Cookie();
 //setting cookie
 $cookie = $cookiecheck->getCookie($app);
 $db = $app->db;
 $user = new User();
 $usermapper = new UserMapper($db);
 $userid = new UserId();
 $user_id = $userid->checkId($user, $usermapper, $cookie);
 //saving file in DB
 $foo = new Foo();
 $regExp = new RegExp();
 $token = $regExp->match($array['token']);
 $foo->public = $regExp->match($array['public']);
 $foo->terminate = $array['terminate'];
 $foo->user_id = $regExp->match($user_id);
 $foo->path = $regExp->match($array['filename']);
 // $foo->cookie = $cookie;
 $foo->token = $regExp->match($token);
 $foo->filesize = $regExp->match($array['filesize']);
 $mapper = new FooMapper($db);
 $mapper->save($foo);
 //setting unique token
 /*
                     $db = $app->db;
 $_FILES['img']['tmp_name'];
           $target_dir = "uploads/";
 				$target_file = $target_dir . basename($_FILES["img"]["name"]);
Esempio n. 4
0
 public function parseFile(array $files = array())
 {
     foreach ($files as $post => $value) {
         $regExp = new RegExp();
         $this->path = $regExp->match($value['path']);
         $this->cookie = $regExp->match($value['cookie']);
         $this->filesize = $regExp->match($value['filesize']);
         $info = new SplFileInfo($value['path']);
         $this->extension = $info->getExtension();
         $tagArr = $regExp->match($value['tags']);
         $tags = new Tags();
         $this->tags = $tags->parseTags($tagArr);
         //creating aray from the string of tags
         $this->description = $regExp->match($value['description']);
         $this->user_id = $regExp->match($value['user_id']);
         $this->token = $regExp->match($value['token']);
         $this->id = $regExp->match($value['id']);
         $this->time = $regExp->match($value['time']);
         $this->count = $regExp->match($value['count']);
         $exif = exif_read_data('uploads/' . $value['path'], 0, true);
         $this->exif = $exif;
         $this->public = $regExp->match($value['public']);
     }
 }
Esempio n. 5
0
 public function post($comment)
 {
     $regExp = new RegExp();
     $this->comment = $regExp->match($comment);
     $this->save();
 }
Esempio n. 6
0
     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']);
         $terminate = $regExp->match($_POST['terminate']);
         $foo = new Foo();
         $foo->id = $file_id;
         $foo->tags = $tags;
         $foo->public = $public;
         $foo->description = $description;
         $foo->terminate = $terminate;
         $foomapper = new FooMapper($db);
         $foomapper->save($foo);
         $app->redirect("{$id}");
     }
 })->via('GET', 'POST')->name('FileEdit');
 $app->get('/:id/:preview', function ($id, $preview) use($app) {
Esempio n. 7
0
<?php

$app->post('/search', function () use($app) {
    if (isset($_POST)) {
        $regExp = new RegExp();
        $tag1 = $regExp->match($_POST['search']);
        $checksearch = new CheckSearch();
        $tag = $checksearch->getSearch($tag1);
        $db = $app->db;
        $foo = new Foo();
        $foo->tag = '%' . $tag . '%';
        $foomapper = new FooMapper($db);
        $files = $foomapper->search($foo);
        $filesize = new Filesize();
        $app->render('Search.php', ['files' => $files, 'filesize' => $filesize]);
    }
})->name('searchpost');
$app->get('/search/:tag', function ($tag) use($app) {
    $db = $app->db;
    $foo = new Foo();
    $foo->tag = '%' . $tag . '%';
    $foomapper = new FooMapper($db);
    $files = $foomapper->search($foo);
    $filesize = new Filesize();
    $app->render('Search.php', ['files' => $files, 'filesize' => $filesize]);
})->name('search');
Esempio n. 8
0
 public function Load($files, $app)
 {
     foreach ($files as $file => $value) {
         $regExp = new RegExp();
         $log = "uploads/" . $regExp->match($value["path"]);
         $res = $app->response();
         $res['Content-Description'] = 'File Transfer';
         $res['Content-Type'] = 'application/octet-stream';
         $res['Content-Disposition'] = 'attachment; filename=' . basename($log);
         $res['Content-Transfer-Encoding'] = 'binary';
         $res['Expires'] = '0';
         $res['Cache-Control'] = 'must-revalidate';
         $res['Pragma'] = 'public';
         $res['Content-Length'] = filesize($log);
         readfile($log);
         ini_set('display_errors', 'Off');
     }
     $foo2 = new Foo();
     $foo2->token = $this->token;
     $foomapper2 = new FooMapper($this->db);
     $foomapper2->updatecount($foo2);
 }