Example #1
0
     $userid = $_REQUEST['userid'];
     $actual_user_id = $_REQUEST['actual_user_id'];
     $totalfollowers = 0;
     $rows['totalfollowers'] = fngetTotalFollowers($userid);
     $totaltiles = 0;
     $rows['totaltiles'] = fngetTotalTiles_counts($userid, $actual_user_id);
     $totaltiles = 0;
     $sqlTilesCount = "SELECT user_tileid FROM `fn_user_finao_tile` ft JOIN fn_user_finao fu ON fu.`user_finao_id` = ft.`finao_id` WHERE ft.userid ='" . $userid . "' AND Iscompleted =0 AND finao_activestatus !=2  GROUP BY tile_id";
     //
     $sqlTilesCountRes = mysql_query($sqlTilesCount);
     $rows['totaltiles'] = mysql_num_rows($sqlTilesCountRes);
     $rows['totaltiles'] = fngetTotalTiles_counts($userid, $actual_user_id);
     $totalfinaos = 0;
     $rows['totalfinaos'] = fngetTotalFinaos($userid, $actual_user_id);
     $totalfollowings = 0;
     $rows['totalfollowings'] = fngetTotalFollowings($userid);
     $json = array();
     $json['res'] = $rows;
     echo json_encode($json);
 } else {
     if ($_REQUEST['json'] == 'homepage_user') {
         $userid = $_REQUEST['userid'];
         $data = getHomePageDetailsByUser($userid);
         echo $data;
     } else {
         if ($_REQUEST['json'] == 'finao_list') {
             $myid = $_REQUEST['userid'];
             $type = $_REQUEST['type'];
             $otherid = 0;
             if ($type == 1) {
                 $otherid = $_REQUEST['otherid'];
Example #2
0
function homepage_user($userid)
{
    if (!empty($userid)) {
        include 'phpviddler.php';
        $v = new Viddler_V2('145i86zgnzi1h1xln0ly');
        $auth = $v->viddler_users_auth(array('user' => ' finaonation', 'password' => 'Finao123'));
        $session_id = isset($auth['auth']['sessionid']) ? $auth['auth']['sessionid'] : NULL;
        $data = array();
        $query = "SELECT notification.trackingnotification_id,\n\t\tnotification.tile_id,\n\t\tnotification.finao_id,\n\t\tnotification.notification_action,\n\t\tnotification.updateby,\n\t\tfinao.updateddate,\n\t\tfinao.finao_msg,\n\t\tfinao.finao_status,\n\t\tlookup.lookup_name,\n\t\tprofile.profile_image,\n\t\tprofile.mystory,\n\t\tusr.fname,\n\t\tusr.lname,\n\t\tupload.uploaddetail_id,\n\t\tupload.uploadtype,\n\t\tupload.upload_text,\n\t\tupload.updateddate\n\t\tFROM `fn_trackingnotifications` AS notification\n\t\tINNER JOIN fn_user_finao AS finao ON finao.user_finao_id=notification.finao_id\n\t\tINNER JOIN fn_lookups AS lookup ON lookup.lookup_id= notification.notification_action\n\t\tINNER JOIN fn_user_profile AS profile\n\t\tINNER JOIN fn_users AS usr ON usr.userid= profile.user_id AND usr.userid= notification.updateby\n\t\tINNER JOIN fn_uploaddetails AS upload ON upload.upload_sourceid= notification.finao_id\n\t\tLEFT OUTER JOIN inappropriatepost inapp ON inapp.userpostid = upload.uploaddetail_id\n\t\tWHERE notification.tracker_userid = '{$userid}' AND\n\t\tnotification.notification_action IN ('51','52','53','54','55','56') AND\n\t\tinapp.userpostid IS NULL\n\t\tGROUP BY notification.finao_id\n\t\tORDER BY notification.updateddate DESC  LIMIT 0 , 30";
        $exe = mysql_query($query);
        if (mysql_num_rows($exe) > 0) {
            while ($obj = mysql_fetch_object($exe)) {
                $videoimg = "";
                $videourl = "";
                $videoid = 0;
                if ($obj->uploadtype == '34' || $obj->uploadtype == '62') {
                    if ($obj->uploadtype == '34') {
                        $videoid = 1;
                    }
                    $query1 = mysql_query("select uploadfile_name, uploadfile_path, caption, updateddate from fn_uploaddetails where uploaddetail_id='{$obj->uploaddetail_id}'");
                    $sno = 0;
                    if (mysql_num_rows($query1) > 0) {
                        while ($obj1 = mysql_fetch_object($query1)) {
                            $imgarr[$sno]['image_url'] = $obj1->uploadfile_name;
                            if (!empty($obj1->caption)) {
                                $imgarr[$sno]['image_caption'] = $obj1->caption;
                            } else {
                                $imgarr[$sno]['image_caption'] = "";
                            }
                            $sno++;
                        }
                    } else {
                        $imgarr = array();
                    }
                } else {
                    if ($obj->uploadtype == '35' || $obj->uploadtype == '62') {
                        if ($obj->uploadtype == '35') {
                            $videoid = 2;
                        }
                        $query1 = mysql_query("select videoid, caption, video_img, video_embedurl from fn_uploaddetails where uploaddetail_id='{$obj->uploaddetail_id}'");
                        $obj1 = mysql_fetch_object($query1);
                        if (empty($obj1->videoid) && empty($obj1->video_embedurl)) {
                            $videoid = 0;
                            $videourl = "";
                            $videoimg = "";
                            if (!empty($obj1->caption)) {
                                $caption = $obj1->caption;
                            }
                        }
                        $videoimg = "";
                        if (!empty($obj1->videoid)) {
                            $results = $v->viddler_videos_getDetails(array('sessionid' => $session_id, 'video_id' => $obj1->videoid));
                            $videourl = $results['video']['files'][1]['html5_video_source'];
                            if (!empty($obj1->video_img)) {
                                $videoimg = $obj1->video_img;
                            }
                            $caption = $obj1->caption;
                        } else {
                            if (!empty($obj1->video_embedurl)) {
                                $videocode = str_replace("/default.jpg", "", $obj1->video_img);
                                $videocode = str_replace("http://img.youtube.com/vi/", "", $videocode);
                                $videourl = "http://www.youtube.com/embed/" . $videocode;
                                if (!empty($obj1->video_img)) {
                                    $videoimg = $obj1->video_img;
                                }
                                $caption = $obj1->caption;
                            }
                        }
                    }
                }
                $data['tile_id'] = $obj->tile_id;
                $data['finao_id'] = $obj->finao_id;
                $data['notification_status'] = $obj->lookup_name;
                $data['updateby'] = $obj->updateby;
                $data['finao_msg'] = $obj->finao_msg;
                $data['finao_status'] = $obj->finao_status;
                $data['profile_image'] = $obj->profile_image;
                $data['profilename'] = $obj->fname . " " . $obj->lname;
                $data['story'] = $obj->mystory;
                $data['uploaddetail_id'] = $obj->uploaddetail_id;
                $data['type'] = $videoid;
                $data['videoimg'] = $videoimg;
                $data['videourl'] = $videourl;
                if ($caption != NULL) {
                    $data['caption'] = $caption;
                } else {
                    $data['caption'] = "";
                }
                $data['image_urls'] = $imgarr;
                if (!empty($obj->upload_text)) {
                    $data['upload_text'] = $obj->upload_text;
                } else {
                    $data['upload_text'] = "";
                }
                $data['updateddate'] = date("d M y", strtotime($obj->uploadeddate));
                // getting count for a user
                $totalfollowers = 0;
                $totalfollowers = fngetTotalFollowers($obj->updateby);
                $totaltiles = 0;
                $sqlTilesCount = "SELECT user_tileid FROM `fn_user_finao_tile` ft JOIN fn_user_finao fu ON fu.`user_finao_id` = ft.`finao_id` WHERE ft.userid =" . $obj->updateby . " AND finao_activestatus !=2 ";
                $sqlTilesCount .= " and `finao_status_Ispublic`=1";
                $sqlTilesCount .= " GROUP BY tile_id ";
                $sqlTilesCountRes = mysql_query($sqlTilesCount);
                $totaltiles = mysql_num_rows($sqlTilesCountRes);
                $totalfinaos = 0;
                $sqlFianosCount = "SELECT user_tileid FROM  fn_user_finao_tile ft JOIN fn_user_finao f WHERE ft.finao_id = f.user_finao_id AND ft.userid =  '" . $obj->updateby . "' AND f.finao_activestatus =1 AND finao_status_Ispublic =1";
                $sqlSelectFinaoCountRes = mysql_query($sqlFianosCount);
                $totalfinaos = mysql_num_rows($sqlSelectFinaoCountRes);
                $totalfollowings = 0;
                $totalfollowings = fngetTotalFollowings($obj->updateby);
                if ($totaltiles == "") {
                    $totaltiles = 0;
                }
                if ($totalfinaos == "") {
                    $totalfinaos = 0;
                }
                if ($totalfollowers == "") {
                    $totalfollowers = 0;
                }
                if ($totalfollowings == "") {
                    $totalfollowings = 0;
                }
                $data['totalfinaos'] = $totalfinaos;
                $data['totaltiles'] = $totaltiles;
                $data['totalfollowers'] = $totalfollowers;
                $data['totalfollowings'] = $totalfollowings;
                $rows[] = $data;
            }
            $response = generateResponse(TRUE, NULL, $rows);
        } else {
            $response = generateResponse(TRUE, NULL, 'Currently there are no posts');
        }
        echo json_encode($response);
    } else {
        getStatusCode(401);
        $response = generateResponse(FALSE, UNUTHORISED_USER);
        echo json_encode($response);
    }
}