Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php	(revision 469)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php	(revision 472)
@@ -17,8 +17,15 @@
 	public function index() 
 	{	
+		$this->load->model('User_model');
 		$user_info = $this->session->userdata('userInfo');
+		$aryParams = array();
+		parse_str($user_info['user'], $aryParams);		
+		$licenseAvailable = $this->User_model->checkLicense($aryParams['id']);
+		$licenseAvailable = $licenseAvailable == TRUE ? 'OK': '!OK';
+		
 		if ($user_info){
 			$username = $user_info['username'];
-			$this->load->view ( 'lecture_editor', array('username'=>$username));
+			$flashscript = $this->load->view('flashscript',null, true);
+			$this->load->view ( 'lecture_editor', array('username'=>$username, 'licenseAvailable' => $licenseAvailable, 'flashScript' => $flashscript));
 
 		}else{
Index: pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php	(revision 469)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php	(revision 472)
@@ -14,12 +14,13 @@
 	function checkLogin ($src, $token, $username, $password) 
 	{
-		$data = $this->vservices->actionExecute('login', array('src' => $src, 'token' => $token, 'username' => $username, 'password' => $password), 'user');		
+		$data = $this->vservices->actionExecute('login', array('src' => $src, 'token' => $token, 'username' => $username, 'password' => $password), 'user');
+				
 		$arr_users = explode("&", $data);
-		$str_status = "";
-		$str_fullname = "";
-		$str_usid = "";
-		$usid = "";
-		$fullname = "";
-		for ($i=0; $i<count($arr_users); $i++)
+		$str_status = '';
+		$str_fullname = '';
+		$str_usid = '';
+		$usid = '';
+		$fullname = '';
+		for ($i=0; $i < count($arr_users); $i++)
 		{
 			if (strpos($arr_users[$i], 'status=') !== false)
@@ -39,10 +40,10 @@
 		}
 		$arr_status = explode("=", $str_status);
-		if ($str_fullname != "")
+		if ($str_fullname != '')
 		{
 			$arr_fullname = explode("=", $str_fullname);
 			$fullname = $arr_fullname[1];
 		}
-		if ($str_usid !== "")
+		if ($str_usid !== '')
 		{
 			$arr_usid = explode("=", $str_usid);
@@ -50,5 +51,6 @@
 		}
 		$status = (int)$arr_status[1];
-		if ($status == 0 || $status = 4){
+		
+		if ($status == 0 || $status == 4){
 			$us_id = (int)$usid;
 			$query = "SELECT * FROM tbluser WHERE us_id = ?";
@@ -83,5 +85,5 @@
 		$errMsg = '';
 		parse_str($data);
-		$sms = "";
+		$sms = '';
 		
 		switch((int)$status)
@@ -166,5 +168,5 @@
 		$us_id = 0;
 		$errMsg = '';
-		$sms = "";
+		$sms = '';
 		$this->db->select('*')->from('tbluser')->where('cellphone', $receiverID);
 		$query = $this->db->get();
@@ -218,8 +220,8 @@
 		$us_id = 0;
 		$errMsg = '';
-		$sms = "";
+		$sms = '';
 		$flag = false;
 		$pass = $password;
-		if (is_null($password) || $password = "")
+		if (is_null($password) || $password == '')
 		{
 			$pass = $this->create_random_password();
@@ -271,4 +273,19 @@
 	}
 	
+	
+	function checkLicense ($userId) 
+	{
+		$isNotExpired = false;
+		$userInfo = $this->get_user_by_id($userId);		
+		$expireDate = $userInfo['expire_date'];
+		
+		if ((trim($expireDate) == '')) return $isNotExpired;
+		
+		$today = mktime();
+		$expireTime = strtotime($expireDate.' 23:59:59');
+		$isNotExpired = ($today < $expireTime);
+		return $isNotExpired;
+	}
+	
 	function insert_smslog($sentNumber, $userID, $serviceID, $commandcode, $info, $receiveTime)
 	{
Index: pro-violet-viettel/sourcecode/application/modules/frontend/views/flashscript.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/views/flashscript.php	(revision 472)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/views/flashscript.php	(revision 472)
@@ -0,0 +1,62 @@
+<script type="text/javascript" language="JavaScript">
+<!--//
+
+var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
+var g_Flash = null;
+var g_cbData = "";
+
+function InitViolet() {
+  g_Flash = isInternetExplorer ? LectorEditorOnline : document.LectorEditorOnline;
+}
+
+function GetClipboardItem() {
+  var cbData = window.clipboardData? window.clipboardData.getData('Text'): g_cbData;
+  g_Flash.SetVariable("clipboardData", cbData);
+  g_Flash.SetVariable("command", "Get Text");
+}
+
+function SetClipboardItem(args) {
+  if (window.clipboardData) window.clipboardData.setData('Text', args);
+  else g_cbData = args;
+  g_Flash.SetVariable("command", "Set OK");
+}
+
+function SetWindowTitle(fileName) {
+  if (fileName == "") document.title = "Violet Online";
+  else {
+    var docName = fileName.substring(0, fileName.length - 4);
+    document.title = "Violet Online - " + docName;
+  }
+}
+
+function SetWindowState() {
+  var full = (g_Flash.width == "100%");
+  g_Flash.width  = full? "800": "100%";
+  g_Flash.height = full? "580": "100%";
+}
+
+// Handle all the FSCommand messages in a Flash movie.
+function LectorEditorOnline_DoFSCommand(command, args) {
+  switch (command) {
+    case "Set Title": SetWindowTitle(args); break;
+    case "Get Clipboard": GetClipboardItem(); break;
+    case "Set Clipboard": SetClipboardItem(args); break;
+    case "Set State": SetWindowState(); break;
+    case "Quit": window.open('','_self').close(); break;
+    case "trace": alert(args); break;
+    case "Check License": console.log('Báº¡n chÆ°a ÄÄng kÃœ sá»­ dá»¥ng dá»ch vá»¥!'); break;
+  }
+}
+
+// Hook for Internet Explorer.
+if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
+  document.write('<script language=\"VBScript\"\>\n');
+  document.write('On Error Resume Next\n');
+  document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
+  document.write('  Call LectorEditorOnline_DoFSCommand(command, args)\n');
+  document.write('End Sub\n');
+  document.write('</script\>\n');
+}
+
+//-->
+</script>
Index: pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php	(revision 469)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php	(revision 472)
@@ -1,9 +1,7 @@
 <?php
-$this->load->view('layout/frontend/header');
+$this->load->view('layout/frontend/header', array('flashScript' => $flashScript));
 $base_url = base_url();
 $this->load->view('layout/frontend/sidebar');
 ?>
-
-
 			<div class="main-container-inner">
 
@@ -12,4 +10,10 @@
 					<div class="page-content no-padding">
 								<!-- PAGE CONTENT BEGINS -->
+								<?php $langParam = '&language=Vietnamese' ?>
+								<?php $flashVars = 'online=true&applicationId=Violet Online' ?>
+								<?php $flashVars.= '&commonLibList=sxIOE3.xml,sxIOE4.xml,sxIOE5.xml,tnIOE3.xml,tnIOE4.xml,tnIOE5.xml' ?>
+								<?php $flashVars.= '&youtubeUrl=Service/fake_youtube.php'.$langParam.'&command=Init OK' ?>
+								<?php $flashVars.= '&licenseStatus='.$licenseAvailable ?>
+
 								<div class="embed-responsive embed-responsive-16by9">
 								  <embed								  	  
@@ -18,5 +22,5 @@
 									  wmode="transparent"
 									  type="application/x-shockwave-flash"
-									  flashvars="host=<?php echo $base_url; ?>ajax/user/login/xml" 
+									  flashvars="host=<?php echo $base_url; ?>&<?php echo $flashVars;?>"
 								  />
 								</div>							
