Subversion Repositories SmartDukaan

Rev

Rev 11012 | Rev 11108 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11012 Rev 11049
Line 68... Line 68...
68
		$authorized = $this->session->userdata('authorized');
68
		$authorized = $this->session->userdata('authorized');
69
		if(isset($authorized) && !empty($authorized) && $authorized['isLoggedIn'] == 1){
69
		if(isset($authorized) && !empty($authorized) && $authorized['isLoggedIn'] == 1){
70
			redirect(base_url().'home');
70
			redirect(base_url().'home');
71
		}
71
		}
72
		//get cache 
72
		//get cache 
73
		$configdata =array();
-
 
74
		$configdata = $this->config->item('productinfo');
-
 
75
		$cachemodule = array('header','footer');
-
 
76
		$configdata = getCache($configdata,$cachemodule);
-
 
77
		$authorized = $this->session->userdata('authorized');
73
		$authorized = $this->session->userdata('authorized');
78
		if(isset($_POST) && !empty($_POST)){
74
		if(isset($_POST) && !empty($_POST)){
79
			if(isset($authorized) && !empty($authorized)){
75
			if(isset($authorized) && !empty($authorized)){
80
				$_POST['userId'] = $authorized['Id'];
76
				$_POST['userId'] = $authorized['Id'];
81
				$_POST['cartId'] = $authorized['cartId'];
77
				$_POST['cartId'] = $authorized['cartId'];
Line 84... Line 80...
84
				}
80
				}
85
				elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
81
				elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
86
				$_POST['isLoggedIn'] = 'false';
82
				$_POST['isLoggedIn'] = 'false';
87
				}
83
				}
88
			}
84
			}
89
		}
-
 
90
		//end of get cache
85
			//end of get cache
91
		$data['response']=$this->oauth_model->getLogin($this->input->get(),$this->input->post(),$this->config->item('oauth_login'));
86
			$data['response']=$this->oauth_model->getLogin($this->input->get(),$this->input->post(),$this->config->item('oauth_login'));
92
		//set cache to output or renew cache
87
			//set cache to output or renew cache
93
		if(isset($cachemodule) and !empty($cachemodule))
88
			if(isset($data['response']['response']['login']['authorized']))
94
		{
-
 
95
			foreach($cachemodule as $cm)
-
 
96
			{
89
			{
-
 
90
				$this->session->set_userdata('authorized',$data['response']['response']['login']['authorized']);
-
 
91
				//$this->session->set_flashdata(array('msg'=>$data['response']['response']['login']['msg']));
-
 
92
				$location = $this->session->userdata('location');
97
				if(isset($configdata[$cm]) and !empty($configdata[$cm]))
93
				if(isset($location) && !empty($location)){
98
				{
-
 
99
					$data['response'][$cm]=$configdata[$cm];
94
					$this->session->unset_userdata('location');
-
 
95
					redirect($location);
100
				}
96
				}
-
 
97
				else{
-
 
98
					redirect(base_url().$data['response']['response']['login']['redirect']);	
-
 
99
				}
-
 
100
				
-
 
101
 
101
			}
102
			}
102
		}
103
			else
103
		setCache($configdata['module'],$cachemodule,$data['response']);
-
 
104
		if(isset($data['response']['response']['login']['authorized']))
-
 
105
		{
104
			{
106
			$this->session->set_userdata('authorized',$data['response']['response']['login']['authorized']);
105
				$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
107
			//$this->session->set_flashdata(array('msg'=>$data['response']['response']['login']['msg']));
-
 
108
			$location = $this->session->userdata('location');
106
				$data['title'] = 'Saholic';
109
			if(isset($location) && !empty($location)){
107
				$data['stylesheet'] = 'auth.css';
110
				$this->session->unset_userdata('location');
108
				$this->layout->view(strtolower(__CLASS__).'/oauth_view',$data);
111
				redirect($location);
-
 
112
			}
-
 
113
			else{
-
 
114
				redirect(base_url().$data['response']['response']['login']['redirect']);	
-
 
115
			}
109
			}
116
			
-
 
117
 
-
 
118
		}
110
		}
119
		else
111
		else{
120
		{
112
			$data = array();
-
 
113
			$data['response']=$this->oauth_model->getLogin($this->input->get(),$this->input->post(),$this->config->item('oauth_login'));
121
			$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
114
			$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
122
			$data['title'] = 'Saholic';
115
			$data['title'] = 'Saholic';
123
			$data['stylesheet'] = 'auth.css';
116
			$data['stylesheet'] = 'auth.css';
124
			$this->layout->view(strtolower(__CLASS__).'/oauth_view',$data);
117
			$this->layout->view(strtolower(__CLASS__).'/login',$data);
125
		}
118
		}
126
	}
119
	}
127
	function signup()
120
	function signup()
128
	{
121
	{
129
		//standard array
122
		//standard array
Line 143... Line 136...
143
   					$this->session->set_userdata('location',$redirect);	
136
   					$this->session->set_userdata('location',$redirect);	
144
   				}
137
   				}
145
			}
138
			}
146
		}
139
		}
147
		//get cache 
140
		//get cache 
148
		$configdata =array();
-
 
149
		$configdata = $this->config->item('oauth_signup');
-
 
150
		$cachemodule = array('header','footer');
-
 
151
		$configdata = getCache($configdata,$cachemodule);
-
 
152
		//end of get cache
-
 
153
		$authorized = $this->session->userdata('authorized');
141
		$authorized = $this->session->userdata('authorized');
154
		if(isset($_POST) && !empty($_POST)){
142
		if(isset($_POST) && !empty($_POST)){
155
			if(isset($authorized) && !empty($authorized)){
143
			if(isset($authorized) && !empty($authorized)){
156
				$_POST['userId'] = $authorized['Id'];
144
				$_POST['userId'] = $authorized['Id'];
157
				$_POST['Id'] = $authorized['cartId'];
145
				$_POST['Id'] = $authorized['cartId'];
Line 160... Line 148...
160
				}
148
				}
161
				elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
149
				elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
162
					$_POST['isLoggedIn'] = 'false';
150
					$_POST['isLoggedIn'] = 'false';
163
				}
151
				}
164
			}
152
			}
165
		}
153
		
166
		$data['response']=$this->oauth_model->getSignup($this->input->get(),$this->input->post(),$this->config->item('oauth_signup'));
154
			$data['response']=$this->oauth_model->getSignup($this->input->get(),$this->input->post(),$this->config->item('oauth_signup'));
167
		//set cache to output or renew cache
155
			//set cache to output or renew cache
168
		if(isset($cachemodule) and !empty($cachemodule))
156
			if(isset($data['response']['response']['signup']['authorized']))
169
		{
-
 
170
			foreach($cachemodule as $cm)
-
 
171
			{
157
			{
-
 
158
				$this->session->set_userdata('authorized',$data['response']['response']['signup']['authorized']);
-
 
159
				$this->session->set_flashdata(array('msg'=>$data['response']['response']['signup']['msg']));
-
 
160
				$location = $this->session->userdata('location');
172
				if(isset($configdata[$cm]) and !empty($configdata[$cm]))
161
				if(isset($location) && !empty($location)){
173
				{
-
 
174
					$data['response'][$cm]=$configdata[$cm];
162
					$this->session->unset_userdata('location');
-
 
163
					redirect($location);
175
				}
164
				}
-
 
165
				redirect(base_url().$data['response']['response']['signup']['redirect']);
176
			}
166
			}
177
		}
167
			else
178
		setCache($configdata['module'],$cachemodule,$data['response']);
-
 
179
		//end of set cache
-
 
180
 
-
 
181
		if(isset($data['response']['response']['signup']['authorized']))
-
 
182
		{
168
			{
183
			$this->session->set_userdata('authorized',$data['response']['response']['signup']['authorized']);
169
				$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
184
			$this->session->set_flashdata(array('msg'=>$data['response']['response']['signup']['msg']));
-
 
185
			$location = $this->session->userdata('location');
170
				$data['title'] = 'Saholic';
186
			if(isset($location) && !empty($location)){
171
				$data['stylesheet'] = 'auth.css';
187
				$this->session->unset_userdata('location');
172
				$this->layout->view(strtolower(__CLASS__).'/oauth_view',$data);
188
				redirect($location);
-
 
189
			}
173
			}
190
			redirect(base_url().$data['response']['response']['signup']['redirect']);
-
 
191
		}
-
 
192
		else
174
		}else{
193
		{
175
			$data = array();
-
 
176
			$data['response']=$this->oauth_model->getSignup($this->input->get(),$this->input->post(),$this->config->item('oauth_signup'));
194
			$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
177
			$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
195
			$data['title'] = 'Saholic';
178
			$data['title'] = 'Saholic';
196
			$data['stylesheet'] = 'auth.css';
179
			$data['stylesheet'] = 'auth.css';
197
			$this->layout->view(strtolower(__CLASS__).'/oauth_view',$data);
180
			$this->layout->view(strtolower(__CLASS__).'/signup',$data);
198
		}
181
		}
199
	}
182
	}
200
	function logout()
183
	function logout()
201
	{
184
	{
202
 
185