public static function download_photo($photo_url, $stalkee_id)
 {
     $stalkee_dir = self::$DOWNLOAD_FOLDER . '/' . $stalkee_id;
     if (!file_exists($stalkee_dir)) {
         mkdir($stalkee_dir, 0777, true);
     }
     $latest_image = $stalkee_dir . "/" . PhotoDownloader::get_latest_photo($stalkee_id);
     $time = time();
     $image_name = $stalkee_dir . '/' . $time . '.jpg';
     if (PhotoDownloader::check_new_file($latest_image, $photo_url)) {
         file_put_contents($image_name, file_get_contents($photo_url));
         Stalkee::insert_photo_db($stalkee_id, $time, 1);
     }
 }
Beispiel #2
0
 private static function process_notifier($stalker_stalkee)
 {
     foreach ($stalker_stalkee as $stalker => $stalkees) {
         $greeting = "Hi " . Stalker::get_stalker_name($stalker) . ",";
         $stalkee_message = "<br><br>Following stalkee(s) have uploaded new photos. Click the name to view their gallery<br><br>";
         $stalkee_list = "";
         $count = 0;
         $end_of_message = "<br>Happy Stalking!!!<br><br>VStalk4U.com";
         foreach ($stalkees as $stalkee) {
             $count++;
             $stalkee_list = $stalkee_list . Stalkee::get_stalkee_gallery($stalkee) . "<br><br>";
         }
         if ($count == 1) {
             $subject = Stalkee::get_stalkee_name($stalkee) . " uploaded a new photo!!";
         } else {
             $subject = "New Photos uploaded by your stalkees!!";
         }
         $message = $greeting . $stalkee_message . $stalkee_list . $end_of_message;
         notifier::notify_stalker($stalker, $message, $subject);
     }
     Stalkee::update_photo_status();
 }
Beispiel #3
0
<?php

/* 
 * @author Nibin Abraham Mattam
 * VStalk4U.com
 * 
 */
require '/var/www/html/photos/PhotoURL.php';
require '/var/www/html/photos/PhotoResizer.php';
require '/var/www/html/Downloader/PhotoDownloader.php';
require '/var/www/html/IdGenerator/RandomIDGenerator.php';
require '/var/www/html/DAO/Stalkee.php';
require '/var/www/html/DAO/Stalker.php';
require '/var/www/html/notifier/notifier.php';
foreach (Stalkee::get_stalkee_list() as $stalkee) {
    PhotoDownloader::download_photo(PhotoURL::get_API(Stalkee::get_stalkee_fb_id($stalkee)), $stalkee);
}
notifier::get_notifier_list();
Beispiel #4
0
 public static function get_stalkee_gallery($stalkee)
 {
     $gallery_url = self::$STALKEE_URL . base64_encode($stalkee);
     return "<a href=" . $gallery_url . ">" . Stalkee::get_stalkee_name($stalkee) . "</a>";
 }