public function actionNewTile() { $userid = isset($_POST['userid']) ? $_POST['userid'] : Yii::app()->session['login']['id']; $pagetype = isset($_POST['pagetype']) && $_POST['pagetype'] != '' ? $_POST['pagetype'] : ""; if (isset($_POST['UserFinaoTile'])) { $finaoid = 0; if ($_POST['UserFinaoTile']['finao_id'] == 0) { $finamsg = $_POST['UserFinaoTile']['finaomessage']; $finaostatu = Lookups::model()->findByAttributes(array('lookup_type' => 'finaostatus', 'lookup_status' => 1, 'lookup_name' => 'On Track')); $newfinao = new UserFinao(); $newfinao->userid = $userid; $newfinao->createddate = new CDbExpression('NOW()'); $newfinao->updatedby = $userid; $newfinao->updateddate = new CDbExpression('NOW()'); $newfinao->finao_status = $finaostatu->lookup_id; $newfinao->finao_msg = $finamsg; //print_r($_POST); exit; $newfinao->finao_status_Ispublic = $_POST['ispublic']; if ($newfinao->save(false)) { $finaoid = $newfinao->user_finao_id; } if ($finaoid != '') { //$filename = $_POST['filename']; $filename = Yii::app()->session['filename']; if ($filename != '') { $uploaddetails = new Uploaddetails(); $uploaddetails->uploadfile_path = "/images/uploads/finaoimages"; $uploaddetails->uploadtype = 34; $uploaddetails->uploadfile_name = $filename; $uploaddetails->upload_sourcetype = 37; $uploaddetails->upload_sourceid = $finaoid; $uploaddetails->uploadedby = $userid; $uploaddetails->uploadeddate = new CDbExpression('NOW()'); $uploaddetails->status = 1; $uploaddetails->updatedby = $userid; $uploaddetails->updateddate = new CDbExpression('NOW()'); $uploaddetails->caption = $_POST['caption']; $uploaddetails->updatedby = $userid; if ($uploaddetails->save(false)) { unset(Yii::app()->session['filename']); } } } } else { $finaoid = $_POST['UserFinaoTile']['finao_id']; } $sql = "SELECT max(tile_id) FROM fn_tilesinfo"; $connection = Yii::app()->db; $command = $connection->createCommand($sql); $tileids = $command->queryAll(); foreach ($tileids as $newtile) { $tileid = $newtile["max(tile_id)"]; } if ($tileid == 0) { $sql = "SELECT max(lookup_id) FROM fn_lookups WHERE lookup_type = 'tiles' "; $connection = Yii::app()->db; $command = $connection->createCommand($sql); $tileids = $command->queryAll(); foreach ($tileids as $newtile) { $tileid = $newtile["max(lookup_id)"] + 1; } } else { $tileid = $newtile["max(tile_id)"] + 1; } $edittile = UserFinaoTile::model()->findByAttributes(array('finao_id' => $finaoid, 'userid' => $userid)); if (!(isset($edittile) && !empty($edittile))) { $edittile = new UserFinaoTile(); $edittile->userid = $userid; $edittile->createdby = $userid; $edittile->createddate = new CDbExpression('NOW()'); $edittile->finao_id = $finaoid; } $edittile->tile_name = $_POST['UserFinaoTile']['tile_name']; $edittile->tile_id = $tileid; $images = CUploadedFile::getInstancesByName('tileimage'); if (isset($images) && count($images) > 0) { foreach ($images as $pic) { $fileext = $pic->extensionName; $fileext = strtolower($fileext); $edittile->status = 1; $edittile->updateddate = new CDbExpression('NOW()'); $edittile->updatedby = $userid; //$edittile->tile_profileImagurl = $userid."-".strtolower($edittile->tile_name).".".$fileext; $edittile->tile_profileImagurl = $userid . "-" . str_replace(" ", "", strtolower($edittile->tile_name)) . "." . $fileext; //print_r($edittile->attributes);exit; if ($edittile->save(false)) { // Added on 27-06-13 to populate data in tilesinfo table $numb = rand(); $tileinfo = new TilesInfo(); $tileinfo->tile_id = $edittile->tile_id; $tileinfo->tilename = $_POST['UserFinaoTile']['tile_name']; $tileinfo->temp_tile_imageurl = "temptile-" . $userid . "-" . $numb . "-" . str_replace(" ", "", strtolower($_POST['UserFinaoTile']['tile_name'])) . "." . $fileext; $tileinfo->Is_customtile = 1; $tileinfo->status = 1; $tileinfo->createdby = $userid; $tileinfo->createddate = new CDbExpression('NOW()'); $tileinfo->updateddate = new CDbExpression('NOW()'); $tileinfo->updatedby = $userid; $tileinfo->save(false); //$pic->saveAs(Yii::getPathOfAlias('webroot').'/images/uploads/tilesimages'.'/'.strtolower($edittile->tile_name).".jpg"); $pic->saveAs(Yii::getPathOfAlias('webroot') . '/images/tiles' . '/' . "temptile-" . $userid . "-" . $numb . "-" . str_replace(" ", "", strtolower($tileinfo->tilename)) . "." . $fileext); if ($edittile->save()) { $path = Yii::app()->basePath . "/../images/tiles/" . "temptile-" . $userid . "-" . $numb . "-" . str_replace(" ", "", strtolower($tileinfo->tilename)) . "." . $fileext; if (file_exists($path)) { $t_width = 80; $t_height = 60; $font_size = 16; list($sourceWidth, $sourceHeight) = getimagesize($path); if ($sourceWidth >= 440 && $sourceHeight >= 320) { if ($sourceWidth == 440 && $sourceHeight == 320) { if ($tileinfo->tile_imageurl != "") { if (file_exists(Yii::app()->basePath . "/../images/tiles/" . $tileinfo->tile_imageurl)) { unlink(Yii::app()->basePath . "/../images/tiles/" . $tileinfo->tile_imageurl); } } $tileinfo->tile_imageurl = $filename; if ($tileinfo->save(false)) { if (file_exists(Yii::app()->basePath . "/../images/tiles/" . $tileinfo->temp_tile_imageurl)) { unlink(Yii::app()->basePath . "/../images/tiles/" . $tileinfo->temp_tile_imageurl); } $this->redirect(Yii::app()->createUrl('finao/motivationmesg')); } } else { if ($sourceWidth > 440) { $ext = substr(strrchr($tileinfo->temp_tile_imageurl, '.'), 1); $ext = strtolower($ext); $this->createImagetofixbodysize(Yii::app()->basePath . "/../images/tiles/" . $tileinfo->temp_tile_imageurl, 600, $ext); $this->addTrackingNotifications($userid, $tileid, 'Moved tile', $finaoid, 0); } $this->redirect(Yii::app()->createUrl('finao/motivationmesg', array('tileimageupload' => $tileinfo->tile_id))); } } else { $this->redirect(Yii::app()->createUrl('finao/motivationmesg', array('tileerrormesg' => $tileinfo->tile_id, 'newtile' => 1))); } /* list($w,$h) = getimagesize($path); $ratio = ($t_width/$w); $nw = ceil($w * $ratio); $nh = ceil($h * $ratio); $nimg = imagecreatetruecolor($nw,$nh); switch($fileext) { case 'jpeg': case 'jpg': $im_src = imagecreatefromjpeg($path); break; case 'png': $im_src = imagecreatefrompng($path); break; } imagecopyresampled($nimg,$im_src,0,0,0,0,$nw,$nh,$w,$h); $color = imagecolorallocate($nimg, 255,255,255); $black = imagecolorallocate($im_src, 0,0,0); //ImageTTFText($im_src, $font_size, 0, 21, 26, $black, Yii::app()->basePath."/../Fonts/Gladifilthefte/gladifilthefte.ttf",$edittile->tile_name); //ImageTTFText($nimg, $font_size, 0, 20, 25, $color, Yii::app()->basePath."/../Fonts/Gladifilthefte/gladifilthefte.ttf",$edittile->tile_name); imagejpeg($nimg,$path,90);*/ } //echo $model->uploadedby."-".$finaoid."-".$model->uploadSourcetype->lookup_name; //$this->addTrackingNotifications($userid,$tileid,'Moved tile',$finaoid,0); $this->redirect(Yii::app()->createUrl('finao/motivationMesg', array('finaoid' => $finaoid))); } } } } else { $this->redirect(array('finao/motivationMesg')); } } else { $finaoid = isset($_POST['finaoid']) && $_POST['finaoid'] > 0 ? $_POST['finaoid'] : 0; if ($pagetype != "newtilepage") { $edittile = UserFinaoTile::model()->findByAttributes(array('finao_id' => $finaoid, 'userid' => $userid)); } else { $edittile = new UserFinaoTile(); } //print_r($edittile); //exit; $this->renderPartial('_tileform', array('newtile' => $edittile, 'userid' => $userid, 'finaoid' => $finaoid, 'pagetype' => $pagetype)); } }
public function actionEasylogin() { // print_r($_POST);exit; $type = $_POST['type']; $finaomesg = $_POST['finaomsg']; $fname = $_POST['name']; $email = $_POST['email']; $phonenumber = $_POST['mobile']; $pwd = md5($_POST['password']); if ($type == 'video') { $user = User::model()->findByAttributes(array('email' => $email)); $model = new User(); if ($user['email'] != '' && $user['password'] != $pwd) { echo "0"; } else { $user = User::model()->findByAttributes(array('email' => $email, 'password' => $pwd, 'status' => 1)); if ($user['email'] != '') { $login = array(); $login["id"] = $user['userid']; $login["username"] = $user['fname']; $login["socialnetworkid"] = $user['socialnetworkid']; $login["trackid"] = $user['trackid']; $userprofile = UserProfile::model()->findByAttributes(array('user_id' => $user['userid'])); $login["profImage"] = isset($userprofile->profile_image) ? $userprofile->profile_image : ""; $login["bgImage"] = isset($userprofile->profile_bg_image) ? $userprofile->profile_bg_image : ""; Yii::app()->session['login'] = $login; echo 'video-false-' . $_POST['utype']; if (isset($_POST['sourceid']) != '') { // $vote = $this->registervote($_POST['voteduser'], $_POST['sourceid']); echo $vote; } } else { //echo 'video-true'; $model = new User(); $model->fname = $fname; $model->email = $email; $model->password = $pwd; $model->usertypeid = 1; $model->createtime = date('Y-m-d G:i:s'); $model->socialnetworkid = 0; $model->status = 1; $model->trackid = 66; /* $mageid = $this->processshopreg($firstname,'',$email,$_POST['pwd']); if(!empty($mageid)) { $model->mageid = $mageid; }*/ if ($model->save(false)) { $userid = $model->userid; //echo $userid; $newuserprofile = new UserProfile(); $newuserprofile->user_id = $userid; $newuserprofile->createdby = $userid; $newuserprofile->createddate = date('Y-m-d G:i:s'); $newuserprofile->updatedby = $userid; $newuserprofile->updateddate = date('Y-m-d G:i:s'); $newuserprofile->IsCompleted = ""; if ($newuserprofile->save(false)) { $email = $email; $usercheck = User::model()->findByAttributes(array('email' => $email, 'status' => 1)); $password = md5($usercheck->password); if ($usercheck) { $activkey = md5(uniqid(rand(), true)); $forgoturl = $this->createAbsoluteUrl('/site/changepswdpopup', array("activkey" => $activkey, "email" => $usercheck->email)); $subj = "Reset Password"; $mesg = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Registration Confirmation</title> </head> <body> <div style="width:670px; margin:0px auto; padding:0px; background:#FFF; border-left:solid 20px #dddddd; border-right:solid 20px #dddddd;"> <div><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/Email_Header.png" style="padding:0; margin:0; border:0;" /></div> <div style="width:650px; padding:10px; margin:0px; font-family:Geneva, Arial, Helvetica, sans-serif;"><br /> <div style="color:rgb(244, 123, 32); font-weight:bold; font-size:16px; padding-bottom:5px;">Hi ' . ucfirst($usercheck->fname) . ' ,</div> <div style="color:rgb(77,77,77); font-size:12px; line-height:18px; padding-bottom:15px;"> Thank you for Joining FINAO Nation.<br /> <br /> Please set your password and validate your account within next 24 hours by clicking on the link given below to login to the site in future. <br />' . $forgoturl . '<br /> <br /> If the link doesn\'t work, please copy and paste the URL into your browser instead.<br /> <br /> </div> <div style="color:rgb(77,77,77); font-size:12px; line-height:18px; padding-bottom:15px;"> </div> <div><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/Signature.png" style="border:0; padding:0; margin:0;" /></div> </div> <div style="width:650px; margin:0px auto; text-align:right"> <ul style="list-style:none; margin:0px; padding:0px;"> <a target="_blank" href="https://www.facebook.com/FINAONation"><li style="background:url(http://finaonation.com/images/soc-icons.png) 0 -38px; width:13px; height:29px; display:inline-block; list-style:none; margin:0 4px;"></li></a> <a target="_blank" href="http://pinterest.com/finaonation/"><li style="background:url(http://finaonation.com/images/soc-icons.png) -80px -38px; width:24px; height:30px; display:inline-block; list-style:none; margin:0 4px;"></li></a> <a target="_blank" href="http://www.linkedin.com/company/2253999"><li style="background:url(http://finaonation.com/images/soc-icons.png) -21px -38px; width:26px; height:27px; display:inline-block; list-style:none; margin:0 4px;"></li></a> <a target="_blank" href="https://twitter.com/FINAONation"><li style="background:url(http://finaonation.com/images/soc-icons.png) -53px -38px; width:20px; height:26px; display:inline-block; list-style:none; margin:0 4px;"></li></a> </ul> </div> <div style="background:#000; width:670px; font-size:11px; color:rgb(153, 153, 153); text-align:center; padding:10px 0; font-family:Geneva, Arial, Helvetica, sans-serif;"> <div style="padding-bottom:5px;">This message was mailed to <span style="color:rgb(244, 123, 32)!important;">' . $email . '</span> by FINAO Nation.</div> <div style="padding-bottom:5px;"> <a href="http://' . $_SERVER['HTTP_HOST'] . '" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">FINAO</a> | <a href="http://' . $_SERVER['HTTP_HOST'] . '/profile/contactus" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">Contact Us</a> | <a href="http://' . $_SERVER['HTTP_HOST'] . '/profile/aboutus" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">About FINAO</a> | <a href="mailto:unsubscribe@finaonation.com?Subject=Hello%20again" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">Unsubscribe</a> </div> <div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">To unsubscribe, click the link above, or send an email to: <a href="#" style="color:rgb(153, 153, 153)!important; text-decoration:none; cursor:default;">unsubscribe@finaonation.com</a>. Do not reply to this email address.</div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">It is a notification only address and is not monitored for incoming email. </div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">Use of the FINAO Nation website and mobile app constitutes acceptance of our Terms of Use and Privacy Policy.</div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">© ' . date("Y") . ' FINAO Nation, 13024 Beverly Park Rd, Mukilteo, WA 98275, U.S.A.</div> </div> </div> </div> </body> </html>'; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: do-not-reply@finaonation.com"; mail($usercheck->email, $subj, $mesg, $headers); $usercheck->activkey = $activkey; $usercheck->save(FALSE); } $login = array(); $login["id"] = $userid; $login["username"] = $model->fname; $login["socialnetworkid"] = $model->socialnetworkid; $login["trackid"] = $user['trackid']; $userprofile = UserProfile::model()->findByAttributes(array('user_id' => $userid)); $login["profImage"] = isset($userprofile->profile_image) ? $userprofile->profile_image : ""; $login["bgImage"] = isset($userprofile->profile_bg_image) ? $userprofile->profile_bg_image : ""; Yii::app()->session['login'] = $login; echo 'video-true-' . $_POST['utype']; } } } } } else { if ($type == 'easy') { $user = User::model()->findByAttributes(array('email' => $email)); $model = new User(); if ($user['email'] != '' && $user['password'] != $pwd) { echo "0"; } else { //echo 1; $user = User::model()->findByAttributes(array('email' => $email, 'password' => $pwd, 'status' => 1)); if ($user['email'] != '') { $login = array(); $login["id"] = $user['userid']; $login["username"] = $user['fname']; $login["socialnetworkid"] = $user['socialnetworkid']; $login["trackid"] = $user['trackid']; $userprofile = UserProfile::model()->findByAttributes(array('user_id' => $user['userid'])); $login["profImage"] = isset($userprofile->profile_image) ? $userprofile->profile_image : ""; $login["bgImage"] = isset($userprofile->profile_bg_image) ? $userprofile->profile_bg_image : ""; Yii::app()->session['login'] = $login; echo 'easy-false'; if (isset($_POST['sourceid']) != '') { // $vote = $this->registervote($_POST['voteduser'], $_POST['sourceid']); echo $vote; } } else { if (empty($fname)) { echo '22'; } else { //echo 'video-true'; $model = new User(); $model->fname = $fname; $model->email = $email; $model->password = $pwd; $model->usertypeid = 1; $model->createtime = date('Y-m-d G:i:s'); $model->socialnetworkid = 0; $model->status = 1; $model->trackid = 66; /* $mageid = $this->processshopreg($firstname,'',$email,$_POST['pwd']); if(!empty($mageid)) { $model->mageid = $mageid; }*/ if ($model->save(false)) { $userid = $model->userid; //echo $userid; $newuserprofile = new UserProfile(); $newuserprofile->user_id = $userid; $newuserprofile->createdby = $userid; $newuserprofile->createddate = date('Y-m-d G:i:s'); $newuserprofile->updatedby = $userid; $newuserprofile->updateddate = date('Y-m-d G:i:s'); $newuserprofile->IsCompleted = ""; if ($newuserprofile->save(false)) { $email = $email; $usercheck = User::model()->findByAttributes(array('email' => $email, 'status' => 1)); $password = md5($usercheck->password); if ($usercheck) { $activkey = md5(uniqid(rand(), true)); $forgoturl = $this->createAbsoluteUrl('/site/changepswdpopup', array("activkey" => $activkey, "email" => $usercheck->email)); $subj = "Reset Password"; $mesg = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Registration Confirmation</title> </head> <body> <div style="width:670px; margin:0px auto; padding:0px; background:#FFF; border-left:solid 20px #dddddd; border-right:solid 20px #dddddd;"> <div><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/Email_Header.png" style="padding:0; margin:0; border:0;" /></div> <div style="width:650px; padding:10px; margin:0px; font-family:Geneva, Arial, Helvetica, sans-serif;"><br /> <div style="color:rgb(244, 123, 32); font-weight:bold; font-size:16px; padding-bottom:5px;">Hi ' . ucfirst($usercheck->fname) . ' ,</div> <div style="color:rgb(77,77,77); font-size:12px; line-height:18px; padding-bottom:15px;"> Thank you for Joining FINAO Nation.<br /> <br /> Please set your password and validate your account within next 24 hours by clicking on the link given below to login to the site in future. <br />' . $forgoturl . '<br /> <br /> If the link doesn\'t work, please copy and paste the URL into your browser instead.<br /> <br /> </div> <div style="color:rgb(77,77,77); font-size:12px; line-height:18px; padding-bottom:15px;"> </div> <div><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/Signature.png" style="border:0; padding:0; margin:0;" /></div> </div> <div style="width:650px; margin:0px auto; text-align:right"> <ul style="list-style:none; margin:0px; padding:0px;"> <a target="_blank" href="https://www.facebook.com/FINAONation"><li style="background:url(http://finaonation.com/images/soc-icons.png) 0 -38px; width:13px; height:29px; display:inline-block; list-style:none; margin:0 4px;"></li></a> <a target="_blank" href="http://pinterest.com/finaonation/"><li style="background:url(http://finaonation.com/images/soc-icons.png) -80px -38px; width:24px; height:30px; display:inline-block; list-style:none; margin:0 4px;"></li></a> <a target="_blank" href="http://www.linkedin.com/company/2253999"><li style="background:url(http://finaonation.com/images/soc-icons.png) -21px -38px; width:26px; height:27px; display:inline-block; list-style:none; margin:0 4px;"></li></a> <a target="_blank" href="https://twitter.com/FINAONation"><li style="background:url(http://finaonation.com/images/soc-icons.png) -53px -38px; width:20px; height:26px; display:inline-block; list-style:none; margin:0 4px;"></li></a> </ul> </div> <div style="background:#000; width:670px; font-size:11px; color:rgb(153, 153, 153); text-align:center; padding:10px 0; font-family:Geneva, Arial, Helvetica, sans-serif;"> <div style="padding-bottom:5px;">This message was mailed to <span style="color:rgb(244, 123, 32)!important;">' . $email . '</span> by FINAO Nation.</div> <div style="padding-bottom:5px;"> <a href="http://' . $_SERVER['HTTP_HOST'] . '" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">FINAO</a> | <a href="http://' . $_SERVER['HTTP_HOST'] . '/profile/contactus" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">Contact Us</a> | <a href="http://' . $_SERVER['HTTP_HOST'] . '/profile/aboutus" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">About FINAO</a> | <a href="mailto:unsubscribe@finaonation.com?Subject=Hello%20again" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">Unsubscribe</a> </div> <div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">To unsubscribe, click the link above, or send an email to: <a href="#" style="color:rgb(153, 153, 153)!important; text-decoration:none; cursor:default;">unsubscribe@finaonation.com</a>. Do not reply to this email address.</div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">It is a notification only address and is not monitored for incoming email. </div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">Use of the FINAO Nation website and mobile app constitutes acceptance of our Terms of Use and Privacy Policy.</div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">© ' . date("Y") . ' FINAO Nation, 13024 Beverly Park Rd, Mukilteo, WA 98275, U.S.A.</div> </div> </div> </div> </body> </html>'; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: do-not-reply@finaonation.com"; mail($usercheck->email, $subj, $mesg, $headers); $usercheck->activkey = $activkey; $usercheck->save(FALSE); } $login = array(); $login["id"] = $userid; $login["username"] = $model->fname; $login["socialnetworkid"] = $model->socialnetworkid; $login["trackid"] = $user['trackid']; $userprofile = UserProfile::model()->findByAttributes(array('user_id' => $userid)); $login["profImage"] = isset($userprofile->profile_image) ? $userprofile->profile_image : ""; $login["bgImage"] = isset($userprofile->profile_bg_image) ? $userprofile->profile_bg_image : ""; Yii::app()->session['login'] = $login; echo 'easy-true'; } } } } } } else { //echo $type;exit; //print_r($_POST);exit; $tile = $_POST['tilename']; $pieces = explode("-", $tile); $tilename = trim(ucfirst($pieces[0]) . ' ' . $pieces[1]); // piece2 //echo $tilename; $sql = "SELECT * FROM `fn_lookups` WHERE `lookup_name` = '" . $tilename . "'"; $connection = Yii::app()->db; $command = $connection->createCommand($sql); $tileids = $command->queryAll(); foreach ($tileids as $newtile) { $tileid = $newtile["lookup_id"]; } $tileimage = strtolower($pieces[0] . $pieces[1]); // echo $tileimage; //echo $tileid; // exit; //echo $pwd;exit; $user = User::model()->findByAttributes(array('email' => $email, 'password' => $pwd, 'status' => 1)); $model = new User(); // $user['email'];exit; if ($_POST['email'] == '') { echo 0; } else { if (!empty($user)) { if ($user['email'] != '') { $userid = $user['userid']; $newfinao = new UserFinao(); // for badword $words = str_word_count($_POST['finaomsg'], 1); $lastWord = array_pop($words); $lastSpacePosition = strrpos($_POST['finaomsg'], ' '); $textWithoutLastWord = $_POST['finaomsg']; $tiles = FnProfanityWords::model()->findAll(); foreach ($tiles as $tiles) { if (strtolower($lastWord) == strtolower($tiles->badword)) { $textWithoutLastWord = substr($_POST['finaomsg'], 0, $lastSpacePosition); $textWithoutLastWord .= ' **** '; } } if (isset($_POST['finaomsg']) && $_POST['finaomsg'] != "") { $newfinao->finao_msg = $textWithoutLastWord; } $public = 1; $newfinao->finao_status_Ispublic = $public; $newfinao->userid = $userid; $newfinao->createddate = new CDbExpression('NOW()'); $newfinao->updatedby = $userid; $newfinao->updateddate = new CDbExpression('NOW()'); $newfinao->finao_status = 38; if ($newfinao->save(false)) { $finao_id = $newfinao->user_finao_id; $newtile = new UserFinaoTile(); $newtile->tile_id = $tileid; $newtile->tile_name = $tilename; $newtile->finao_id = $newfinao->user_finao_id; $tileimgurl = '' . $tileimage . '.jpg'; $newtile->tile_profileImagurl = $tileimgurl; $newtile->userid = $userid; $newtile->status = 1; $newtile->createddate = new CDbExpression('NOW()'); $newtile->createdby = $userid; $newtile->updateddate = new CDbExpression('NOW()'); $newtile->updatedby = $userid; if ($newtile->save(false)) { $tilename = $tilename; $istileinfo = TilesInfo::model()->findByAttributes(array('tilename' => $tilename, 'createdby' => $userid)); if (!isset($istileinfo) && empty($istileinfo)) { $tileinfo = new TilesInfo(); $tileinfo->tile_id = $tileid; $tileinfo->tilename = $tilename; $tileinfo->tile_imageurl = $tileimgurl; $tileinfo->status = 1; $tileinfo->createdby = $userid; $tileinfo->createddate = new CDbExpression('NOW()'); $tileinfo->updateddate = new CDbExpression('NOW()'); $tileinfo->updatedby = $userid; $tileinfo->save(false); } } $login = array(); $login["id"] = $userid; $login["username"] = $model->fname; $login["socialnetworkid"] = $model->socialnetworkid; $login["trackid"] = $user['trackid']; $userprofile = UserProfile::model()->findByAttributes(array('user_id' => $userid)); $login["profImage"] = isset($userprofile->profile_image) ? $userprofile->profile_image : ""; $login["bgImage"] = isset($userprofile->profile_bg_image) ? $userprofile->profile_bg_image : ""; Yii::app()->session['login'] = $login; echo '2-' . $tileid; } else { echo "0"; //Enter fields } } else { echo "1"; //You are already subscribed or your account may not be activated } } else { //echo 'u r in'; $model = new User(); $model->fname = $fname; $model->email = $email; $model->password = md5($email); $model->usertypeid = 1; $model->createtime = date('Y-m-d G:i:s'); $model->socialnetworkid = 0; $model->trackid = $tileid; $model->status = 1; $mageid = $this->processshopreg($fname, '', $email, $_POST['pwd']); if ($mageid != '') { $model->mageid = $mageid; } if ($model->save(false)) { $userid = $model->userid; //echo $userid; $newuserprofile = new UserProfile(); $newuserprofile->user_id = $userid; $newuserprofile->createdby = $userid; $newuserprofile->createddate = date('Y-m-d G:i:s'); $newuserprofile->updatedby = $userid; $newuserprofile->updateddate = date('Y-m-d G:i:s'); $newuserprofile->IsCompleted = ""; if ($newuserprofile->save(false)) { $email = $email; $usercheck = User::model()->findByAttributes(array('email' => $email, 'status' => 1)); $password = md5($usercheck->password); if ($usercheck) { $activkey = md5(uniqid(rand(), true)); $forgoturl = $this->createAbsoluteUrl('/site/changepswdpopup', array("activkey" => $activkey, "email" => $usercheck->email)); //$subj = "Reset Password"; $subj = $_POST['finaomsg']; $mesg = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Registration Confirmation</title> </head> <body> <div style="width:670px; margin:0px auto; padding:0px; background:#FFF; border-left:solid 20px #dddddd; border-right:solid 20px #dddddd;"> <div><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/Email_Header.png" style="padding:0; margin:0; border:0;" /></div> <div style="width:650px; padding:10px; margin:0px; font-family:Geneva, Arial, Helvetica, sans-serif;"><br /> <div style="color:rgb(244, 123, 32); font-weight:bold; font-size:16px; padding-bottom:5px;">Hi ' . ucfirst($usercheck->fname) . ' ,</div> <div style="color:rgb(77,77,77); font-size:12px; line-height:18px; padding-bottom:15px;"> <p> What a great FINAO! Thank you for sharing. You are now a part of a national movement to make it fun and cool to live a goal oriented life. Click on the link below and begin. Our mission is to support yours by helping you accomplish your dreams.</p> <p>Finao will allow you to follow others, and be exposed to content that will allow you to connect with like minded people. Victory is in the Pursuit. Let the Journey begin. .</p><br /> <br /> Please set your password and validate your account within next 24 hours by clicking on the link given below to login to the site in future. <br />' . $forgoturl . '<br /> <br /> If the link doesn\'t work, please copy and paste the URL into your browser instead.<br /> <br /> </div> <div style="color:rgb(77,77,77); font-size:12px; line-height:18px; padding-bottom:15px;"> </div> <div><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/Signature.png" style="border:0; padding:0; margin:0;" /></div> </div> <div style="width:650px; margin:0px auto; text-align:right; padding-bottom:5px;"> <ul style="list-style:none; margin:0px; padding:0px;"> <a href="https://www.facebook.com/FINAONation" target="_blank" title="facebook"><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/mail-icons/icon-facebook.png" style="border:0; padding:0; margin-right:4px!important;" /></a> <a href="http://www.linkedin.com/company/2253999" target="_blank" title="linkedin"><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/mail-icons/icon-linkedin.png" style="border:0; padding:0; margin-right:4px!important;" /></a> <a href="http://pinterest.com/finaonation/" target="_blank" title="pinterest"><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/mail-icons/icon-pinterest.png" style="border:0; padding:0; margin-right:4px!important;" /></a> <a href="https://twitter.com/FINAONation" target="_blank" title="twitter"><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/mail-icons/icon-twitter.png" style="border:0; padding:0;" /></a> </ul> </div> <div style="background:#000; width:670px; font-size:11px; color:rgb(153, 153, 153); text-align:center; padding:10px 0; font-family:Geneva, Arial, Helvetica, sans-serif;"> <div style="padding-bottom:5px;">This message was mailed to <span style="color:rgb(244, 123, 32)!important;">' . $email . '</span> by FINAO Nation.</div> <div style="padding-bottom:5px;"> <a href="http://' . $_SERVER['HTTP_HOST'] . '" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">FINAO</a> | <a href="http://' . $_SERVER['HTTP_HOST'] . '/profile/contactus" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">Contact Us</a> | <a href="http://' . $_SERVER['HTTP_HOST'] . '/profile/aboutus" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">About FINAO</a> | <a href="mailto:unsubscribe@finaonation.com?Subject=Hello%20again" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">Unsubscribe</a> </div> <div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">To unsubscribe, click the link above, or send an email to: <a href="#" style="color:rgb(153, 153, 153)!important; text-decoration:none; cursor:default;">unsubscribe@finaonation.com</a>. Do not reply to this email address.</div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">It is a notification only address and is not monitored for incoming email. </div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">Use of the FINAO Nation website and mobile app constitutes acceptance of our Terms of Use and Privacy Policy.</div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">© ' . date("Y") . ' FINAO Nation, 13024 Beverly Park Rd, Mukilteo, WA 98275, U.S.A.</div> </div> </div> </div> </body> </html>'; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: do-not-reply@finaonation.com"; mail($usercheck->email, $subj, $mesg, $headers); $usercheck->activkey = $activkey; if ($usercheck->save(FALSE)) { echo "4-"; } //Succesful email } $newuserprofile->user_profile_id; $newfinao = new UserFinao(); // for badword $words = str_word_count($_POST['finaomsg'], 1); $lastWord = array_pop($words); $lastSpacePosition = strrpos($_POST['finaomsg'], ' '); $textWithoutLastWord = $_POST['finaomsg']; $tiles = FnProfanityWords::model()->findAll(); foreach ($tiles as $tiles) { if (strtolower($lastWord) == strtolower($tiles->badword)) { $textWithoutLastWord = substr($_POST['finaomsg'], 0, $lastSpacePosition); $textWithoutLastWord .= ' **** '; } } if (isset($_POST['finaomsg']) && $_POST['finaomsg'] != "") { $newfinao->finao_msg = $textWithoutLastWord; } $public = 1; $newfinao->finao_status_Ispublic = $public; $newfinao->userid = $userid; $newfinao->createddate = new CDbExpression('NOW()'); $newfinao->updatedby = $userid; $newfinao->updateddate = new CDbExpression('NOW()'); $newfinao->finao_status = 38; if ($newfinao->save(false)) { $finao_id = $newfinao->user_finao_id; $newtile = new UserFinaoTile(); $newtile->tile_id = $tileid; $newtile->tile_name = $tilename; $newtile->finao_id = $newfinao->user_finao_id; $tileimgurl = '' . $tileimage . '.jpg'; $newtile->tile_profileImagurl = $tileimgurl; $newtile->userid = $userid; $newtile->status = 1; $newtile->createddate = new CDbExpression('NOW()'); $newtile->createdby = $userid; $newtile->updateddate = new CDbExpression('NOW()'); $newtile->updatedby = $userid; if ($newtile->save(false)) { $tilename = $tilename; $istileinfo = TilesInfo::model()->findByAttributes(array('tilename' => $tilename, 'createdby' => $userid)); if (!isset($istileinfo) && empty($istileinfo)) { $tileinfo = new TilesInfo(); $tileinfo->tile_id = $tileid; $tileinfo->tilename = $tilename; $tileinfo->tile_imageurl = $tileimgurl; $tileinfo->status = 1; $tileinfo->createdby = $userid; $tileinfo->createddate = new CDbExpression('NOW()'); $tileinfo->updateddate = new CDbExpression('NOW()'); $tileinfo->updatedby = $userid; $tileinfo->save(false); } } $login = array(); $login["id"] = $userid; $login["username"] = $model->fname; $login["socialnetworkid"] = $model->socialnetworkid; $login["trackid"] = $user['trackid']; $userprofile = UserProfile::model()->findByAttributes(array('user_id' => $userid)); $login["profImage"] = isset($userprofile->profile_image) ? $userprofile->profile_image : ""; $login["bgImage"] = isset($userprofile->profile_bg_image) ? $userprofile->profile_bg_image : ""; Yii::app()->session['login'] = $login; echo '2-' . $tileid; } else { echo "Something went wrong"; } } } } } } } }
public function actionGetVideocontestdetail() { //print_r($_REQUEST); if (isset($_REQUEST["videoid"])) { $userid = Yii::app()->session['login']['id']; $videoid = $_REQUEST["videoid"]; $vidler = Yii::app()->getComponents(false); $user = $vidler['vidler']['user']; $pass = $vidler['vidler']['pwd']; $api_key = $vidler['vidler']['appkey']; $callback_url = '/'; $v = new Viddler_V2($api_key); $auth = $v->viddler_users_auth(array('user' => $user, 'password' => $pass)); $sessionid = $auth['auth']['sessionid']; $results = $v->viddler_videos_getDetails(array('sessionid' => $sessionid, 'video_id' => $videoid)); //exit; // print_r($results);exit; if (!empty($results)) { $finaomsg = $results['video']['description']; $newfinao = new UserFinao(); // for badword $words = str_word_count($finaomsg, 1); $lastWord = array_pop($words); $lastSpacePosition = strrpos($finaomsg, ' '); $textWithoutLastWord = $finaomsg; $tiles = FnProfanityWords::model()->findAll(); foreach ($tiles as $tiles) { if (strtolower($lastWord) == strtolower($tiles->badword)) { $textWithoutLastWord = substr($finaomsg, 0, $lastSpacePosition); $textWithoutLastWord .= ' **** '; } } if (isset($finaomsg) && $finaomsg != "") { $newfinao->finao_msg = $textWithoutLastWord; } $public = 1; $newfinao->finao_status_Ispublic = $public; $newfinao->userid = $userid; $newfinao->createddate = new CDbExpression('NOW()'); $newfinao->updatedby = $userid; $newfinao->updateddate = new CDbExpression('NOW()'); $newfinao->finao_status = 38; if ($newfinao->save(false)) { $finao_id = $newfinao->user_finao_id; $tileid = 66; $newtile = new UserFinaoTile(); $newtile->tile_id = $tileid; $newtile->tile_name = 'Career Catapult'; $newtile->finao_id = $newfinao->user_finao_id; $tileimgurl = 'careercatapult.jpg'; $newtile->tile_profileImagurl = $tileimgurl; $newtile->userid = $userid; $newtile->status = 1; $newtile->createddate = new CDbExpression('NOW()'); $newtile->createdby = $userid; $newtile->updateddate = new CDbExpression('NOW()'); $newtile->updatedby = $userid; if ($newtile->save(false)) { //echo $newtile->user_tileid; $tilename = 'Career Catapult'; $istileinfo = TilesInfo::model()->findByAttributes(array('tilename' => $tilename, 'createdby' => $userid)); if (!isset($istileinfo) && empty($istileinfo)) { $tileinfo = new TilesInfo(); $tileinfo->tile_id = $tileid; $tileinfo->tilename = $tilename; $tileinfo->tile_imageurl = $tileimgurl; $tileinfo->status = 1; $tileinfo->createdby = $userid; $tileinfo->createddate = new CDbExpression('NOW()'); $tileinfo->updateddate = new CDbExpression('NOW()'); $tileinfo->updatedby = $userid; $tileinfo->save(false); } /*echo 'FInaoid-'.$finao_id.'userid-'.$userid.'Video Id-'.$videoid;exit;*/ $uploadvideo = new Uploaddetails(); $uploadvideo->upload_sourcetype = 37; $uploadvideo->uploadtype = 35; $uploadvideo->upload_sourceid = $finao_id; $uploadvideo->uploadedby = $userid; $uploadvideo->uploadeddate = new CDbExpression('NOW()'); $uploadvideo->status = 0; $uploadvideo->updatedby = $userid; $uploadvideo->updateddate = new CDbExpression('NOW()'); $uploadvideo->videoid = $videoid; $uploadvideo->videostatus = "not ready"; $uploadvideo->video_img = $results['video']['thumbnail_url']; $uploadvideo->video_caption = $results['video']['title']; if ($uploadvideo->save(false)) { $usercheck = User::model()->findByAttributes(array('userid' => Yii::app()->session['login']['id'], 'status' => 1)); $aprroveurl = 'http://' . $_SERVER['HTTP_HOST'] . '/finao/AprroveVideo/userid/' . $usercheck->userid . '/uploadid/' . $uploadvideo->uploaddetail_id; $mesg = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Registration Confirmation</title> </head> <body> <div style="width:670px; margin:0px auto; padding:0px; background:#FFF; border-left:solid 20px #dddddd; border-right:solid 20px #dddddd;"> <div><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/Email_Header.png" style="padding:0; margin:0; border:0;" /></div> <div style="width:650px; padding:10px; margin:0px; font-family:Geneva, Arial, Helvetica, sans-serif;"><br /> <div style="color:rgb(244, 123, 32); font-weight:bold; font-size:16px; padding-bottom:5px;">Dear Admin,</div> <div style="color:rgb(77,77,77); font-size:12px; line-height:18px; padding-bottom:15px;"> <p>' . ucfirst($usercheck->fname) . ' has posted a Video.</p> <p>Please review the Video by clicking on the View Video button below and click on the Approve Video button to publish this video. </p> <p>If you happen to see the message "Video not Found" or "Encoding in Progress", Please check back later. Video encoding sometimes can take up to an hour.</p> <p> <a href="http://www.viddler.com/v/' . $videoid . '" target="_new"><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/view-video.jpg"></a> <a href="' . $aprroveurl . '" target="_new" ><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/approve-video.jpg"></a><br /> <br /> </p> </div> <div style="color:rgb(77,77,77); font-size:12px; line-height:12px; padding-bottom:10px;"> </div> <div><img src="http://' . $_SERVER['HTTP_HOST'] . '/images/Signature.png" style="border:0; padding:0; margin:0;" /></div> </div> <div style="width:650px; margin:0px auto; text-align:right"> <ul style="list-style:none; margin:0px; padding:0px;"> <a target="_blank" href="https://www.facebook.com/FINAONation"><li style="background:url(http://finaonation.com/images/soc-icons.png) 0 -38px; width:13px; height:29px; display:inline-block; list-style:none; margin:0 4px;"></li></a> <a target="_blank" href="http://pinterest.com/finaonation/"><li style="background:url(http://finaonation.com/images/soc-icons.png) -80px -38px; width:24px; height:30px; display:inline-block; list-style:none; margin:0 4px;"></li></a> <a target="_blank" href="http://www.linkedin.com/company/2253999"><li style="background:url(http://finaonation.com/images/soc-icons.png) -21px -38px; width:26px; height:27px; display:inline-block; list-style:none; margin:0 4px;"></li></a> <a target="_blank" href="https://twitter.com/FINAONation"><li style="background:url(http://finaonation.com/images/soc-icons.png) -53px -38px; width:20px; height:26px; display:inline-block; list-style:none; margin:0 4px;"></li></a> </ul> </div> <div style="background:#000; width:670px; font-size:11px; color:rgb(153, 153, 153); text-align:center; padding:10px 0; font-family:Geneva, Arial, Helvetica, sans-serif;"> <div style="padding-bottom:5px;">This message was mailed to <span style="color:rgb(244, 123, 32)!important;">' . $email . '</span> by FINAO Nation.</div> <div style="padding-bottom:5px;"> <a href="http://' . $_SERVER['HTTP_HOST'] . '" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">FINAO</a> | <a href="http://' . $_SERVER['HTTP_HOST'] . '/profile/contactus" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">Contact Us</a> | <a href="http://' . $_SERVER['HTTP_HOST'] . '/profile/aboutus" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">About FINAO</a> | <a href="mailto:unsubscribe@finaonation.com?Subject=Hello%20again" style="color:rgb(244, 123, 32); padding:0 5px; text-decoration:underline;">Unsubscribe</a> </div> <div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">To unsubscribe, click the link above, or send an email to: <a href="#" style="color:rgb(153, 153, 153)!important; text-decoration:none; cursor:default;">unsubscribe@finaonation.com</a>. Do not reply to this email address.</div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">It is a notification only address and is not monitored for incoming email. </div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">Use of the FINAO Nation website and mobile app constitutes acceptance of our Terms of Use and Privacy Policy.</div> <div style="padding:0px!important; margin:0px!important; line-height:18px;">© ' . date("Y") . ' FINAO Nation, 13024 Beverly Park Rd, Mukilteo, WA 98275, U.S.A.</div> </div> </div> </div> </body> </html>'; $subj = "video Contest"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From:Finaonation <*****@*****.**>' . "\r\n"; $headers .= 'Bcc: dev@wincito.com,nagesh@wincito.com' . "\r\n"; $to = '*****@*****.**'; //$to = 'wallace@finaonation.com,georgie@finaonation.com,robert@finaonation.com'; mail($to, $subj, $mesg, $headers); $this->redirect(Yii::app()->createUrl('finao/Viewvideohdcu/video/true')); } } } } } }