public function run() { $newfinao = new UserFinao(); $newtile = new UserFinaoTile(); $upload = new Uploaddetails(); $userid = Yii::app()->session['login']['id']; //$userinfo = UserProfile::model()->findByAttributes(array('user_id'=>$userid)); //$tiles = Lookups::model()->findAll(array('condition'=>'lookup_type = "tiles" AND lookup_status = 1 ')); /*$sql = "select lookup_id,lookup_name, concat(lower(lookup_name),'.png') as tileimg from fn_lookups where lookup_type = 'tiles' and lookup_status = 1 union select tile_id,tile_name, tile_profileimagurl from fn_user_finao_tile t join fn_user_finao t1 on t.finao_id = t1.user_finao_id where t.userid = ".$userid." and t.status = 1 and t1.finao_activestatus != 2 group by tile_id,tile_name"; $connection=Yii::app()->db; $command=$connection->createCommand($sql); $tiles = $command->queryAll();*/ $tiles = FinaoController::gettileSqlquery($userid); $this->render('_finao', array('model' => $newfinao, 'userid' => $userid, 'tiles' => $tiles, 'newtile' => $newtile, 'upload' => $upload, 'type' => $this->type, 'isgroup' => $this->isgroup, 'Isprofile' => $this->Isprofile)); }
$Isvideo = 0; $getimagesrc = $this->cdnurl . "/images/uploads/finaoimages/" . $allimages['uploadfile_name']; if (isset($getimagesdetails) && count($getimagesdetails) >= 1) { foreach ($getimagesdetails as $imgvalues) { if ($imgvalues["uploadfile_id"] == $allimages["uploaddetail_id"]) { $resizeWidth = $imgvalues["resizeWidth"]; $resizeHeight = $imgvalues["resizeHeight"]; } } } } else { $getimagesrc = ""; if ($allimages["videoid"] != "") { $Isvideo = 1; //532, 305 $videocode = FinaoController::getviddlembedCode($allimages["videoid"], 560, 360); } elseif ($allimages["video_embedurl"] != "") { $Isvideo = 1; $videocode = $allimages["video_embedurl"]; } } //} } } if ($resizeWidth != 0 && $resizeHeight != 0) { $style = 'width="' . $resizeWidth . '" height="' . $resizeHeight . '"'; } else { $style = ""; } ?>
/** * Lists all models. */ public function actionDashboard() { if (isset(Yii::app()->session['login']['id'])) { $userid = Yii::app()->session['login']['id']; if (isset($_REQUEST['frndid'])) { $frndid = $_REQUEST['frndid']; if ($frndid != $userid) { $userid = $frndid; } } } else { if (isset($_REQUEST['frndid'])) { $frndid = $_REQUEST['frndid']; /*This code is added for making specific profiles public*/ $profiles = array(64, 124, 16, 101, 100, 99, 279, 280, 255, 115, 265, 449, 270, 371, 248, 241, 63, 246, 239, 106, 68, 193, 289, 67, 107, 597, 362, 303, 256, 333); if (in_array($frndid, $profiles)) { $userid = $frndid; } else { $this->redirect(array('/home')); } } else { $this->redirect(array('/home')); } } if (isset($_REQUEST['share'])) { $share = "share"; } else { $share = "no"; } if ($_REQUEST['groupid']) { $isgroup = $_REQUEST['groupid']; } else { $isgroup = ''; $this->redirect(array('/home')); } if (isset($_REQUEST['getusertileid']) || isset($_REQUEST['tileerrormesg'])) { if (isset($_REQUEST['tileerrormesg'])) { $getusertileid = $_REQUEST['tileerrormesg']; } else { if ($_REQUEST['getusertileid']) { $getusertileid = $_REQUEST['getusertileid']; } } $tileid = $getusertileid; } else { $tileid = ""; $getusertileid = ""; } if ($_REQUEST['upload']) { $upload = 1; } if ($_REQUEST['errormsg']) { $errormsg = $_REQUEST['errormsg']; } $groupinfo = Group::model()->findByPK($isgroup); $isuploadprocess = array(); if (isset($_REQUEST["finaoid"])) { $sourcetype = $_REQUEST["sourcetype"]; $finid = 0; $journalid = 0; if ($sourcetype == 'journal') { $finaojournal = UserFinaoJournal::model()->findByPK($_REQUEST["finaoid"]); if (isset($finaojournal) && !empty($finaojournal)) { $finid = $finaojournal->finao_id; } $journalid = $_REQUEST["finaoid"]; } else { $finid = $_REQUEST["finaoid"]; } $finao = UserFinaoTile::model()->find(array('condition' => 'finao_id = ' . $finid)); $tileid = ""; if (isset($finao) && count($finao) >= 1) { $tileid = $finao->tile_id; } $isuploadprocess = array('finao' => $finid, 'tile' => $tileid, 'share' => $share, 'journalid' => $journalid, 'upload' => $_REQUEST['upload'], 'menuselected' => isset($_REQUEST['menuselected']) ? $_REQUEST['menuselected'] : ""); } //$tilesslider = $this->refreshtilewidget($userid,$share,0,0,1); $Criteria = new CDbCriteria(); $Criteria->condition = "`group_id` = " . $isgroup . " and `finao_activestatus` = 1 and `updatedby` = " . $userid . " and Iscompleted = 0"; if ($userid != Yii::app()->session['login']['id'] || $share == "share") { $Criteria->addCondition("finao_status_Ispublic = 1", 'AND'); } $Criteria->order = "updateddate DESC"; $groupfinaos = UserFinao::model()->findAll($Criteria); foreach ($groupfinaos as $finodet) { $finaoids .= $finodet->user_finao_id . ","; } if ($finaoids != "") { $finaoids = substr($finaoids, 0, strlen($finaoids) - 1); $finaouploaddetails = $this->getlatestuploaddetails($finaoids, 61); } $tilesslider = $this->refreshtilewidget($userid, $isgroup, $share, 0, 0, 1); $members = $this->getmembersdetails($userid, $isgroup, 0, 0); $memcount = count($members, 0); $trackingyoudet = TrackingController::displayYourGroupTracking($userid, $share, "trackingyou", "", $isgroup); $result = GroupTracking::model()->findByAttributes(array('tracker_userid' => Yii::app()->session['login']['id'], 'tracked_groupid' => $isgroup, 'tracked_userid' => $userid)); if (count($result) == '0') { $results = 'Join Group'; $isgroupmem = 0; //Not a member } else { $results = 'Leave Group'; $isgroupmem = 1; // Member } //archived finaos $archivefinao = $this->getfinaoinfo($userid, $isgroup, "completed", $share, -1, 1, 0); // tile info $userprofarray = $this->getUserProfile($userid, $share, $isgroup); $activityppl = $this->getmyheroesdata1($userid, $share); //print_r($groupfinaos);exit; //echo $groupfinaos['user_finao_id']; $result_tile_id = UserFinaoTile::model()->findByAttributes(array('finao_id' => $groupfinaos[0]['user_finao_id'])); /*$announcements = Announcement::model()->findByAttributes(array('uploadsourcetype'=>61, 'uploadsourceid'=>$isgroup )); */ $Criteria = new CDbCriteria(); $Criteria->condition = "uploadsourcetype = 61 and createdby = " . $userid . " and uploadsourceid = " . $isgroup . " "; $Criteria->order = "createddate DESC"; $announcements = Announcement::model()->findAll($Criteria); $othergroups = FinaoController::getGroupinfo($userid, $share); $this->render('index', array('userid' => $userid, 'imgcount' => $this->GetTotalCount(0, $isgroup, $userid, 'Image', 0, $share), 'videocount' => $this->GetTotalCount(0, $isgroup, $userid, 'Video', 0, $share), 'finaocount' => $this->getfinaoinfo($userid, $isgroup, "", 'yes', -1, 1, 1), 'titlecount' => $tilesslider['totaltilecount'], 'followcount' => $this->getfollowersdetails($userid, -1, 0, 1), 'isgroup' => $isgroup, 'groupinfo' => $groupinfo, 'groupfinaos' => $groupfinaos, 'share' => $share, 'upload' => $upload, 'memcount' => $memcount, 'results' => $results, 'share' => $share, 'isuploadprocess' => $isuploadprocess, 'finaouploaddetails' => $finaouploaddetails, 'getusertileid' => $getusertileid, 'tileid' => $tileid, 'trackingyoudet' => $trackingyoudet, 'isgroupmem' => $isgroupmem, 'tilesinfo' => $userprofarray['tilesinfo'], 'archivefinao' => $archivefinao, 'activityppl' => $activityppl, 'errormsg' => $errormsg, 'result_tile_id' => $result_tile_id->tile_id, 'announcements' => $announcements, 'share_value' => $_REQUEST['share_value'], 'othergroups' => $othergroups['groupinfo'])); }
public function actionBrowseVideoImage() { $uploadtype = isset($_REQUEST['imgvid']) ? $_REQUEST['imgvid'] : ""; if ($uploadtype != "") { $page = isset($_REQUEST['pageid']) ? $_REQUEST['pageid'] : 1; $targetdiv = $_REQUEST['targetdiv']; $limit = 1; $uptypeid = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadtype', 'lookup_name' => $uploadtype)); $criteria = new CDbCriteria(); $criteria->condition = " explore_finao = 1 and uploadtype = " . $uptypeid->lookup_id; $criteria->order = "updateddate desc"; $uploadImages = Uploaddetails::model()->findAll($criteria); $upPageNav = FinaoController::getpagedetails($uploadImages, 1, $page, 1); //$criteria->limit = $upPageNav["limittxt"]; //$lim = FinaoController::getpagecount(count($uploadImages),$limit,$page); //print_r($upPageNav);exit; $criteria->limit = $upPageNav['limittxt']; $criteria->offset = $upPageNav['offset']; $uploadImages = Uploaddetails::model()->findAll($criteria); $videoembedurl = ""; $caption = ""; $userimg = ""; if (isset($uploadImages) && $uploadImages != "" && count($uploadImages) >= 1) { foreach ($uploadImages as $vidup) { if ($uploadtype == 'Video') { if ($vidup->videoid != "" && $vidup->videostatus == 'ready') { $videoembedurl = FinaoController::getviddlembedCode($vidup->videoid); } elseif ($vidup->video_embedurl != "") { $videoembedurl = $vidup->video_embedurl; } } elseif ($uploadtype == 'Image') { $filename = $vidup->uploadfile_path . "/" . $vidup->uploadfile_name; if (file_exists(Yii::app()->basePath . "/../" . $filename)) { $videoembedurl = Yii::app()->baseUrl . $filename; } } $caption = $vidup->caption; $userimg = User::model()->findByPk($vidup->uploadedby); } } $this->renderPartial('_browserImagVideo', array('videoembedurl' => $videoembedurl, 'uploadtype' => $uploadtype, 'upPageNav' => $upPageNav, 'caption' => $caption, 'targetdiv' => $targetdiv, 'userinfo' => $userimg)); } }
<?php if ($uploadtype == Image) { $resizeWidth = ""; $resizeHeight = ""; $targetWidth = 380; $targetHeight = 430; list($sourceWidth, $sourceHeight) = getimagesize(Yii::app()->basePath . "/.." . $videoembedurl); if ($sourceWidth <= $targetWidth && $sourceHeight <= $targetHeight) { $resizeWidth = $sourceWidth; $resizeHeight = $sourceHeight; } else { if ($sourceWidth > $sourceHeight) { $targetWidth = 450; $targetHeight = 430; } $resizevalue = FinaoController::getImgWidthHeight(Yii::app()->basePath . "/.." . $videoembedurl, $targetWidth, $targetHeight, $sourceWidth, $sourceHeight); $resizeWidth = $resizevalue['resizeWidth']; $resizeHeight = $resizevalue['resizeHeight']; } ?> <?php if ($videoembedurl != "") { ?> <!-- --> <img src="<?php echo $videoembedurl; ?> " style="width:<?php echo $resizeWidth; ?> px;height:<?php
public static function actionfinaopreupload() { /************************************************************** * This script is brought to you by Vasplus Programming Blog * Website: www.vasplus.info * Email: info@vasplus.info ****************************************************************/ $upload_location = Yii::app()->basePath . '/../images/uploads/finaoimages/'; if (isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['vasPhoto_uploads']['name']; $size = $_FILES['vasPhoto_uploads']['size']; //if(isset(Yii::app()->session['login']['filename'])) //unset(Yii::app()->session['login']['filename']); $allowedExtensions = array("jpg", "jpeg", "gif", "png"); //Allowed file types foreach ($_FILES as $file) { if ($file['tmp_name'] > '' && strlen($name)) { if (!in_array(end(explode(".", strtolower($file['name']))), $allowedExtensions)) { echo '<div class="info" style="width:370px;">Sorry, you attempted to upload an invalid file format. <br>Only jpg, jpeg, gif and png image files are allowed. Thanks.</div>'; } else { // if($size<(1024*1024)) // { $actual_image_name = Yii::app()->session['login']['id'] . '-' . rand(125678, 00) . '-' . $name; if (isset(Yii::app()->session['filename'])) { unset(Yii::app()->session['filename']); } Yii::app()->session['filename'] = $actual_image_name; // This could be a random name such as rand(125678,098754).'.gif'; /*$filename = substr(strrchr(Yii::app()->session['login']['id'].'-'.rand(125678,098754).'-'.$name,'/'),1); */ if (move_uploaded_file($_FILES['vasPhoto_uploads']['tmp_name'], $upload_location . $actual_image_name)) { if (file_exists(Yii::getPathOfAlias('webroot') . '/images/uploads/finaoimages' . '/' . $actual_image_name)) { $source = Yii::getPathOfAlias('webroot') . '/images/uploads/finaoimages' . '/' . $actual_image_name; $destination = Yii::getPathOfAlias('webroot') . '/images/uploads/finaoimages/thumbs' . '/' . $actual_image_name; $destination1 = Yii::getPathOfAlias('webroot') . '/images/uploads/finaoimages/medium' . '/' . $actual_image_name; $ext = substr(strrchr(Yii::getPathOfAlias('webroot') . '/images/uploads/finaoimages' . '/' . $actual_image_name, '.'), 1); FinaoController::generatethumb($source, $destination, 90, 90); FinaoController::generatethumb($source, $destination1, 240, 240); } //Run your SQL Query here to insert the new image file named $actual_image_name if you deem it necessary echo '<div style="width:370px; padding:10px 20px; height:245px; text-align:center; border:5px solid #E2E2E2; -moz-box-shadow: 0 0 5px #888; -webkit-box-shadow: 0 0 5px#888;box-shadow: 0 0 5px #888;"><span class="uploadeFileWrapper"><img id="filename" src="http://' . $_SERVER['HTTP_HOST'] . '/images/uploads/finaoimages/' . $actual_image_name . '" width="360" height="235"></span> </div> '; } else { echo "<div class='info' style='width:370px;'>Sorry, Your Image File could not be uploaded at the moment. <br>Please try again or contact the site admin if this problem persist. Thanks.</div>"; } // } // else // { // echo "<div class='info' style='width:345px;'>File exceeded 1MB max allowed file size. <br>Please upload a file at 1MB in size to proceed. Thanks.</div><br clear='all' />"; // } } } else { echo '<span class="uploadeFileWrapper"><img id="filename" src="http://' . $_SERVER['HTTP_HOST'] . '/images/uploads/finaoimages/' . Yii::app()->session[filename] . '" width="360" height="235"></span><br clear="all" />'; // echo "<div class='info' style='width:345px;'>You have just canceled your file upload process. Thanks.</div><br clear='all' />"; } } } }