Example #1
0
 public function invokeHandler(Smarty $viewModel, Header $header, User $user, $page)
 {
     $header->title('PayPic');
     $viewModel->assign("pname", "@RTPic");
     if ($user->isValid()) {
         $header->import('jqgeeks/bootstrap_css', 'upload');
         global $RDb;
         $images = $RDb->fetchAll("select * from files where uid=%d AND albumid=0", $user->getToken());
         $viewModel->assign("images", $images);
         return "upload";
     } else {
         $header->import('jqgeeks/bootstrap_css', 'google_login');
         return "login";
     }
 }
Example #2
0
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     return self::showLatest($viewModel);
 }
Example #3
0
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page, $aid)
 {
     $header->title('PayPic');
     $header->import('picbootstrap', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     $album = new Album($aid);
     $viewModel->assign("images", $album->getImges());
     return "images";
 }
Example #4
0
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page, $pid)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     global $RDb;
     $image = $RDb->fetch("select * from files where id=%d", $pid);
     $viewModel->assign("image", $image);
     return "image";
 }
Example #5
0
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     global $RDb;
     $imageAccess = $RDb->fetchAll("select * from file_access fa,files f,user u" . " where fa.pid=f.id and u.uid=fa.uid");
     $viewModel->assign("images", $imageAccess);
     return "imageAccess";
 }
Example #6
0
 public function invokeHandler(Smarty $viewModel, Header $header, User $user, $uname, $upass)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'google_login');
     $viewModel->assign("pname", "@RTPic");
     if ($user->auth($uname, $upass)) {
         include_once HANDLER_PATH . "/Images.php";
         return Images::showlatest($viewModel);
     } else {
         return "login";
     }
 }
Example #7
0
 /**
  * @param Smarty $viewModel
  * @param Header $header
  * @param DataModel $dataModel
  * @param User $user
  * @param string $view
  * @param string $module
  * @return string
  */
 public function invokeHandler(Smarty $viewModel, Header $header, DataModel $dataModel, User $user, $view = "empty", $module = "index_page")
 {
     $header->title("ThEroticStories");
     $header->import($module);
     return $view;
 }
Example #8
0
 public function invokeHandler(Smarty $viewModel, Header $header, DataModel $dataModel, AbstractUser $user, $view = "empty")
 {
     $header->title(DEFAULT_TITLE);
     $header->import(DEFAULT_BUNDLE);
     return $view;
 }
Example #9
0
 public function invokeHandler(Smarty $viewModel, Header $header, $pid, $imageAction = "view", User $user)
 {
     $header->title('PayPic');
     $header->import('picbootstrap', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     global $RDb;
     $picture = new Picture($pid, $user->getToken());
     //$image = Picture::getPicInfoById($pid);
     Browser::log($picture, $user->getToken(), $picture->image->uid, $user->getToken() == $picture->image->uid);
     $hasBaught = false;
     $hasSaved = false;
     $canBuy = false;
     if ($user->isValid()) {
         if ($picture->isMyPic()) {
             Browser::log('isMyPic');
             $user->set('canAccess_' . $pid, $picture->image->file_path);
         } else {
             $imageAccess = Picture::getPicAccess($pid, $user->getToken());
             $hasFileAccessIndexed = !empty($imageAccess);
             if ($hasFileAccessIndexed) {
                 $hasBaught = $imageAccess->baught == 1;
                 $hasSaved = $imageAccess->saved == 1;
             }
             $canBuy = $user->getCoins() >= $picture->image->price;
             if (strcmp("buyImage", $imageAction) == 0) {
                 if ($picture->isPaid() && !$hasBaught && $canBuy) {
                     if ($hasFileAccessIndexed) {
                         $RDb->update("update file_access set baught=1 where uid=%d AND pid=%d", $user->uid, $pid);
                     } else {
                         $RDb->update("INSERT INTO file_access (uid,pid,baught,saved) values(%d,%d,1,1)", $user->uid, $pid);
                         $hasFileAccessIndexed = true;
                     }
                     $user->setCoins($user->get('coins') - $picture->image->price);
                     $hasBaught = true;
                 }
             } else {
                 if (strcmp("saveImage", $imageAction) == 0) {
                     if ($hasFileAccessIndexed) {
                         $RDb->update("update file_access set saved=1 where uid=%d AND pid=%d", $user->uid, $pid);
                     } else {
                         $RDb->update("INSERT INTO file_access (uid,pid,baught,saved) values(%d,%d,0,1)", $user->uid, $pid);
                         $hasFileAccessIndexed = true;
                     }
                     $hasSaved = true;
                 } else {
                     if (strcmp("unsaveImage", $imageAction) == 0) {
                         if ($hasFileAccessIndexed) {
                             $RDb->update("update file_access set saved=0 where uid=%d AND pid=%d", $user->uid, $pid);
                         }
                         $hasFileAccessIndexed = true;
                         $hasSaved = false;
                     } else {
                         if (strcmp("likeImage", $imageAction) == 0) {
                             if ($hasFileAccessIndexed) {
                                 $like = $imageAccess->liked == 0 ? 1 : 0;
                                 $RDb->update("update file_access set liked=%d where uid=%d AND pid=%d", $like, $user->uid, $pid);
                             } else {
                                 $RDb->update("INSERT INTO file_access (uid,pid,liked,baught,saved) values(%d,%d,1,0,0)", $user->uid, $pid);
                             }
                             $picture->image->likes = $picture->image->likes + $like * 2 - 1;
                             $RDb->update("update files set likes=%d where id=%d", ${$picture}->image->likes, $pid);
                             $hasFileAccessIndexed = true;
                         }
                     }
                 }
             }
             if (!$picture->isPaid() || $hasBaught) {
                 $user->set('canAccess_' . $pid, $picture->image->file_path);
             }
         }
     }
     $viewModel->assign("isMyPic", $picture->isMyPic());
     $viewModel->assign("canBuy", $canBuy);
     $viewModel->assign("hasBaught", $hasBaught);
     $viewModel->assign("isPaid", $picture->isPaid());
     $viewModel->assign("hasSaved", $hasSaved);
     $viewModel->assign("image", $picture->image);
     return "image";
 }