Subversion Repositories SmartDukaan

Rev

Rev 15227 | Rev 15335 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13532 anikendra 1
<?php
2
App::uses('Controller', 'Controller');
3
 
4
/**
5
 * Application Controller
6
 *
7
 * Add your application-wide methods in the class below, your controllers
8
 * will inherit them.
9
 *
10
 * @package       app.Controller
11
 * @link http://book.cakephp.org/2.0/en/controllers.html#the-app-controller
12
 */
13
class AppController extends Controller {
13808 anikendra 14
 
15
	public $limit;
16
	public $apihost;
15311 anikendra 17
	public $acls;
13808 anikendra 18
 
13532 anikendra 19
	public $components = array(
14970 anikendra 20
		'Session','Resize','Cookie',
13532 anikendra 21
		'Auth' => array(
22
			'loginAction' => array('controller' => 'users', 'action' => 'login'),
23
			'allowedActions' => array('index', 'view', 'display')
24
		)			
25
	);
13808 anikendra 26
 
13532 anikendra 27
	var $helpers = array('Session', 'Form', 'Html');
28
	var $keywords = array('instagram followers','instagram button','instagram follow back','instagram tool','instagram automation','free istagram followers','instagram stats','instagram follow button');
29
 
30
	function beforeFilter() {
13659 anikendra 31
		$this->Auth->autoRedirect = false;		
13579 anikendra 32
 
33
		//Set config settings according to domain
13532 anikendra 34
		// get host name from URL
35
		preg_match('@^(?:http://)?([^/]+)@i',$_SERVER['HTTP_HOST'], $matches);
36
		$host = $matches[1];
37
		switch($host){			
13567 anikendra 38
			case 'localdtr':
13532 anikendra 39
				Configure::load('dev');
40
				break;
13946 anikendra 41
			case 'staging.profittill.com':
42
			case 'www.staging.profittill.com':
13944 anikendra 43
				Configure::load('staging');
44
				break;
13532 anikendra 45
			default:
13567 anikendra 46
			case 'www.profittill.com':
47
			case 'profittill.com':
13633 anikendra 48
			case 'api.profittill.com':
13532 anikendra 49
				Configure::load('live');
50
				break;
51
		}
13579 anikendra 52
		$facebookConfig = Configure::read("Facebook");		
53
		$categories = Configure::read('Categories');
13532 anikendra 54
		//Facebook configuration
55
		$this->set('fbappid', $facebookConfig['fbappid']);
13579 anikendra 56
		$this->set('apihost', Configure::read('apihost'));
57
 
13532 anikendra 58
	   	$sessionState = $this->Session->read('state');
59
		if(!isset($sessionState)){
60
			$this->Session->write('state' , md5(uniqid(rand(), TRUE))); // CSRF protection
61
		}
62
	 	$dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" 
63
		   . $facebookConfig['fbappid'] . "&redirect_uri=" . urlencode($facebookConfig['base_url'].'/users/checkfbuser/') . "&state="
64
		   . $this->Session->read('state').'&scope=publish_stream,email,user_birthday,publish_actions,user_location';
65
	   	$this->set('dialog_url', $dialog_url);
66
		$this->set('description','Why spend money when you can get something for free');
13579 anikendra 67
		$this->set('categories',$categories);
13532 anikendra 68
		if(isset($this->params['admin'])) {
13739 anikendra 69
			$this->layout = 'admin';
13808 anikendra 70
		}	
71
		$this->apihost = Configure::read('pythonapihost');
72
		$this->limit = Configure::read('dealsperpage');	
13685 anikendra 73
		$staticVersion = Configure::read('staticversion');
74
		$this->set('staticversion',$staticVersion);
14929 anikendra 75
		$this->set('requiremobileverification',Configure::read('requiremobileverification'));			
14970 anikendra 76
		$debugusers = Configure::read('debugusers');
77
		if($id = $this->isAuthorized()){
78
			if(in_array($id, $debugusers)){
79
				$this->Cookie->write('debuguser',1);
80
			}else{
81
				$this->Cookie->delete('debuguser');
82
			}
83
		}
15188 anikendra 84
		//acl
85
		$cachekey = 'acls';
86
		$acls = Cache::read($cachekey,'month');
87
		if(empty($acls)) {
88
			$acls = array();
89
			$this->loadModel('Acl');
90
			$result = $this->Acl->find('all');
91
			foreach ($result as $key => $value) {
92
				if($value['Acl']['access']) {
93
					$acls[$value['Acl']['group_id']]['allowed'][] = $value['Acl']['action'];
94
				}else{
95
					$acls[$value['Acl']['group_id']]['disallowed'][] = $value['Acl']['action'];
96
				}				
97
			}
98
			Cache::write($cachekey,$acls,'month');
99
		}
15311 anikendra 100
		$this->acls = $acls;
15188 anikendra 101
		$this->set('acls',$acls);
13532 anikendra 102
    }
103
 
15311 anikendra 104
	function checkAcl() {		
105
    	if(!in_array($this->here,$this->acls[$this->Session->read('Auth.User.group_id')]['allowed'])){
15227 anikendra 106
    		$this->Session->setFlash(__('You are not authorized to access this page.'));
107
    		return $this->redirect(array('controller'=>'administration','action' => 'dashboard','admin'=>false));
108
    	}
109
    }
110
 
13532 anikendra 111
    function isAuthorized() {
112
        return $this->Auth->user('id');
113
    }
114
 
115
    function isFbAuthorized() {
116
        return $this->Session->read('facebook_id');
117
    }
118
 
119
    function afterFilter() {
13579 anikendra 120
		$result['ucadcode'] = $this->ucadcode;
13532 anikendra 121
    }
122
 
13659 anikendra 123
    function beforeRender() {   
13736 anikendra 124
    	$logged_user = $this->Auth->user();
125
    	$this->set('logged_user', $logged_user); 	
13579 anikendra 126
        $this->set('base_url', 'http://' . $_SERVER['SERVER_NAME'] . Router::url('/'));
13532 anikendra 127
    }
128
 
13736 anikendra 129
    function checkMobileNumber() {
130
    	$logged_user = $this->Auth->user();
131
    	if(empty($logged_user['mobile_verified']) && $this->params['controller'] !='users') {
132
			$skipmobileverification = $this->Session->read('skipmobileverification');
133
			if(!isset($skipmobileverification) || empty($skipmobileverification)) {
134
				$this->redirect('/users/verifymobile');
135
			}
136
		}
137
    }
138
 
14890 anikendra 139
    function checkToken() {
140
		$headers =  $this->getallheaders();
141
        $this->log(print_r($headers,1),'headers');
14897 anikendra 142
        $token = $_COOKIE['token'];
15188 anikendra 143
        $checkToken = $_COOKIE['walletAuthentication'];
14894 anikendra 144
        $this->log("Token : $token",'headers');
15188 anikendra 145
        $this->log("CheckToken : $checkToken",'headers');
146
        if(isset($checkToken) && !empty($checkToken) && isset($token) && !empty($token)) {
14890 anikendra 147
        	$this->loadModel('SocialProfile');
14992 anikendra 148
        	$options = array('conditions'=>array('access_token'=>$token),'fields'=>array('user_id'),'recursive'=>-1);
14890 anikendra 149
        	$user = $this->SocialProfile->find('first',$options);
150
        	$userId = $this->request->query('user_id');
151
			if(isset($userId) && !empty($userId)){
152
				if($userId == $user['SocialProfile']['user_id']){
153
					return true;
154
				}
155
			}
156
        } else {
157
        	return true;
158
        }
15311 anikendra 159
        return true;
14890 anikendra 160
    }
161
 
13659 anikendra 162
    function getallheaders() { 
163
	   $headers = ''; 
164
       foreach ($_SERVER as $name => $value) 
165
       { 
166
	   if (substr($name, 0, 5) == 'HTTP_') 
167
	   { 
168
	       $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; 
169
	   } 
170
       } 
171
       return $headers; 
172
    } 
13633 anikendra 173
 
15015 anikendra 174
    public function getDealsApiUrl($page=1,$userId = null,$categoryId=0,$sort=null,$direction=null,$filter=null,$brands=null){
13808 anikendra 175
    	$this->log('categoryId '.$categoryId,'api');
176
    	$this->log('page '.$page,'api');
177
    	$offset = ($page - 1) * $this->limit;
178
    	if(isset($sort) && !empty($sort) && $sort!=-1){
179
    		$url = $this->apihost.'deals/'.$userId.'?categoryId='.$categoryId.'&sort='.$sort.'&direction='.$direction.'&limit='.$this->limit.'&offset='.$offset;
180
    	}else{
181
    		$url = $this->apihost.'deals/'.$userId.'?categoryId='.$categoryId.'&limit='.$this->limit.'&offset='.$offset;
182
    	}    	
15015 anikendra 183
    	if(isset($filter) && !empty($filter)){
184
    		$url .= "&filterData=brandFilter:".$brands;
185
    	}
13808 anikendra 186
    	return $url;
187
    }
188
 
13633 anikendra 189
	function make_request($url,$fields,$format='json'){
13683 anikendra 190
		$this->log("[url] $url",'api');
191
		$this->log("[fields] ".print_r($fields,1),'api');
13633 anikendra 192
		$fields_string = '';
193
		//open connection
194
		$ch = curl_init();
195
		//set the url, number of POST vars, POST data
196
		curl_setopt($ch,CURLOPT_URL, $url);
197
		curl_setopt($ch,CURLOPT_RETURNTRANSFER , true);
198
		if(!empty($fields)) {
199
			curl_setopt($ch,CURLOPT_POSTFIELDS, $fields);
200
			curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
201
			    'Content-Type: application/json',                                                                                
13994 anikendra 202
			    // 'Content-Length: ' . sizeof($fields))                                                                       
203
			    'Content-Length: ' . strlen($fields))                                                                       
13633 anikendra 204
			);   
205
		}
206
		//execute post
207
		$result = curl_exec($ch);
14928 anikendra 208
		// $this->log("[response] ".print_r($result,1),'api');
13633 anikendra 209
		//close connection
210
		curl_close($ch);
211
		switch($format){
212
			case 'json':
213
			$response = json_decode($result,1);
214
			break;
215
		}
216
		return $response;	
217
	}
13901 anikendra 218
 
14016 anikendra 219
	function post_request($url,$fields,$format='json'){
220
		$this->log("[url] $url",'api');
221
		$this->log("[fields] ".print_r($fields,1),'api');
222
		$fields_string = '';
223
		//open connection
224
		$ch = curl_init();
225
		//execute post
226
		foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
227
		rtrim($fields_string, '&');
228
		//set the url, number of POST vars, POST data
229
		curl_setopt($ch,CURLOPT_URL, $url);
230
		curl_setopt($ch,CURLOPT_POST, count($fields));
231
		curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
232
		$result = curl_exec($ch);
233
		$this->log("[response] ".print_r($result,1),'api');
234
		//close connection
235
		curl_close($ch);
236
		switch($format){
237
			case 'json':
238
			$response = json_decode($result,1);
239
			break;
240
		}
241
		return $response;	
242
	}
14215 anikendra 243
 
13901 anikendra 244
	public function get_solr_result($q,$page) {
245
		$dealsperpage = Configure::read('dealsperpage');
246
		$offset = ($page - 1)*$dealsperpage;
13993 anikendra 247
		$cond = "$q";
13901 anikendra 248
	 	$sort = "store desc";
249
 
250
		$params = array(
251
			'conditions' =>array(
252
		 	'solr_query' => $cond
253
	 	),
254
		 	//'order' => $sort,
255
		 	'offset' => $offset,
256
		 	'limit' => $dealsperpage
257
	 	);
14215 anikendra 258
		$this->loadModel('Solr');		
13901 anikendra 259
		$solroutput = $this->Solr->find('all', $params);
260
		$result = array();
14215 anikendra 261
		if(sizeof($solroutput)<$dealsperpage){
262
			$hasMore = false;
263
		}else{
264
			$hasMore = true;
265
		}
13901 anikendra 266
		if(!empty($solroutput['Solr'])) {			
267
			$skuMap = array();
14215 anikendra 268
			foreach ($solroutput['Solr'] as $key => $value) {
14432 anikendra 269
				// if(!$value['in_stock'])continue;
13901 anikendra 270
				$skuMap[$value['id']] = $value;
271
				$result[$value['skuBundleId']][$value['id']] = $value['available_price'];
14215 anikendra 272
			}	
273
			if(!empty($result)) {
274
				foreach ($result as $key => $value) {					
275
					asort($value);
276
					$lowestPriceSku = key($value);
277
					$result[$key] = $skuMap[$lowestPriceSku];
278
				}
13901 anikendra 279
			}
14215 anikendra 280
		}		
281
		$result['hasMore'] = $hasMore;
13901 anikendra 282
		return $result;
283
	}
14098 anikendra 284
 
285
	public function admin_update(){
286
		$this->response->type('json');
287
		$this->layout = 'ajax';
288
		$data[$this->request->data['id']] = $this->request->data['value'];
289
		$data['oid'] = $this->request->data['oid'];
14584 anikendra 290
		$id = $this->request->data['id'];
291
		$multi = $this->request->data['multi'];
14098 anikendra 292
		if($this->modelClass == 'Exceptionalskudiscount') {
293
			$data['class'] = 'SkuDiscountInfo';	
294
		}elseif($this->modelClass == 'Skuscheme'){
14584 anikendra 295
			if($id == 'dp'){
296
				$data['class'] = 'SkuDealerPrices';
297
			}else{
298
				$data['class'] = 'SkuSchemeDetails';
299
			}
14426 anikendra 300
		}elseif($this->modelClass == 'Exceptionalnlc'){
301
			$data['class'] = 'ExceptionalNlc';
302
		}
303
		else{
14098 anikendra 304
			$data['class'] = $this->modelClass;
305
		}		
14584 anikendra 306
		$data_string = json_encode($data,JSON_NUMERIC_CHECK);		
14098 anikendra 307
		$ch = curl_init();
308
		$url = $this->apihost.'Catalog/updateCollection';
14584 anikendra 309
		if(isset($multi) && $multi==1){
310
			$url .= "/?multi=1";
311
		}		
14098 anikendra 312
		$this->log("[url] $url",'api');
313
		$this->log("[fields] ".print_r($data_string,1),'api');
314
		curl_setopt($ch, CURLOPT_URL, $url);
315
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
316
		curl_setopt($ch, CURLOPT_POST, true);
317
		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); // note the PUT here
318
 
319
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
320
		curl_setopt($ch, CURLOPT_HEADER, true);
321
 
322
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
323
		    'Content-Type: application/json',                                                                                
324
		    'Content-Length: ' . strlen($data_string)                                                                       
325
		));       
326
 
327
		// execute the request
328
 
329
		$output = curl_exec($ch);
330
		$result = $this->request->data['value'];
331
		$this->log("[response] ".print_r($output,1),'api');
332
		curl_close($ch);
333
		$this->set(array(
334
		    'result' => $result,
335
		    '_serialize' => array('result')
336
		));
337
		$this->render('/Elements/json');
338
	}
14150 anikendra 339
 
14509 anikendra 340
	public function remove($id,$class){
341
		$data['oid'] = $id;
342
		$data['class'] = $class;
343
 
344
		$data_string = json_encode($data,JSON_NUMERIC_CHECK);
345
		$ch = curl_init();
346
		$url = $this->apihost.'Catalog/deleteDocument';
347
		$this->log("[url] $url",'api');
348
		$this->log("[fields] ".print_r($data_string,1),'api');
349
		curl_setopt($ch, CURLOPT_URL, $url);
350
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
351
		curl_setopt($ch, CURLOPT_POST, true);
352
		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); // note the PUT here
353
 
354
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
355
		curl_setopt($ch, CURLOPT_HEADER, true);
356
 
357
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
358
		    'Content-Type: application/json',                                                                                
359
		    'Content-Length: ' . strlen($data_string)                                                                       
360
		));       
361
 
362
		// execute the request
363
 
364
		$output = curl_exec($ch);
365
		$result = $this->request->data['value'];
366
		$this->log("[response] ".print_r($output,1),'api');
367
		curl_close($ch);
368
		// $this->set(array(
369
		    // 'result' => $result,
370
		    // '_serialize' => array('result')
371
		// ));
372
		// $this->render('/Elements/json');
373
		return $result;
374
	}
375
 
14150 anikendra 376
	function getAutoLoginUrl($userId,$next) {
14996 anikendra 377
		$saholicoffline = Configure::read('saholicoffline');
378
		if($saholicoffline) {
379
			$url = "/abouts/saholicoffline";
380
			return $url;
381
		}
14150 anikendra 382
		$this->loadModel('User');
383
		$this->User->Behaviors->attach('Containable');
14166 anikendra 384
		$options = array('contain'=>array('UserAccount'), 'conditions'=>array('User.id'=>$userId),'fields'=>array('username','email'),'recursive'=>-1);
14150 anikendra 385
		$user = $this->User->find('first',$options);
14166 anikendra 386
		$this->log("user_accounts ".print_r($user,1));
14441 anikendra 387
		$data = array('email'=>$user['User']['email'],'Id'=>$user['UserAccount'][0]['account_key'],'cartId' => $user['UserAccount'][1]['account_key'],'isPrivateDealUser'=>1,'next'=>$next);
14150 anikendra 388
		$data = '?data='.base64_encode(serialize($data));
389
		$token = '&token='.md5(Configure::read('saholicapikey').'|'.$user['UserAccount'][0]['account_key']);		
14441 anikendra 390
		return Configure::read('saholicauthurl').$data.$token;
14150 anikendra 391
	}
14509 anikendra 392
 
393
 	function createUploadDirectory($modelClass) {
394
        //Create directory
395
        if (!is_dir(WWW_ROOT.'uploads'.DS.$modelClass)) {            
396
            $this->log("making directory for $modelClass". WWW_ROOT.DS.'uploads'.DS.$modelClass);
397
            mkdir(WWW_ROOT.'uploads'.DS.$modelClass,0777);
398
        }
399
        if (!is_dir(WWW_ROOT.'uploads'.DS.$modelClass)) {
400
            $this->log("failed to create directory for $modelClass");
401
            return false; 
402
        } else {
403
            return true;
404
        }
405
    }
406
 
407
    public function upload() {
408
        $result['status'] = 0; 
409
        $result['success'] = false;
410
        $result['message'] = __('Unable to upload');
411
 
412
        App::import('Vendor','qqFileUploader',array('file' =>'qqFileUploader.php'));
413
 
414
        $uploader = new qqFileUploader();
415
 
416
        // Specify the list of valid extensions, ex. array("jpeg", "xml", "bmp")
417
        $uploader->allowedExtensions = array('jpeg','png','jpg','gif','bmp');
418
 
419
        // Specify max file size in bytes.
420
        $uploader->sizeLimit = 10 * 1024 * 1024;
421
 
422
        // Specify the input name set in the javascript.
423
        $uploader->inputName = 'qqfile';
424
 
425
        // If you want to use resume feature for uploader, specify the folder to save parts.
426
        $uploader->chunksFolder = 'chunks';
427
 
428
        // $min_width = isset($this->request->data['minwidth']) ? $this->request->data['minwidth'] : 0; 
429
        // $min_height = isset($this->request->data['minheight']) ? $this->request->data['minheight'] : 0; 
430
        $modelClass = $this->modelClass; 
431
 
432
        $this->log($this->request);
433
        $folderName = Inflector::pluralize(strtolower($modelClass));
434
 
435
        if (!$this->createUploadDirectory($folderName)) {
436
            $result['message'] = 'Failed to create directory :'.$modelClass.
437
            '.  Sorry we are having trouble.  Please try again, or email help@profittill.com';
438
        } else {
439
            // To save the upload with a specified name, set the second parameter
440
            $result = $uploader->handleUpload('uploads'.DS.$folderName.DS, $uploader->getName());
441
            if($result){
442
                //Resize and create thumbnail
443
                $inFile = WWW_ROOT.'uploads'.DS.$folderName.DS. $uploader->getName();
444
 
445
                $largeOutFile = WWW_ROOT.'uploads'.DS.$folderName.DS.'large-'.basename($inFile);
446
                $this->resizeImage($inFile,$largeOutFile,800,800);
447
 
448
                $outFile = WWW_ROOT.'uploads'.DS.$folderName.DS.'small-'.basename($inFile);
449
                $this->resizeImage($inFile,$outFile,200,200);
450
 
451
                $newUrl = '/uploads/'.$folderName.'/'.basename($inFile);
452
                // To return a name used for uploaded file you can use the following line.
453
                $result['uploadName'] = $newUrl;
454
 
455
                $result['status'] = 1;
456
                $result['success'] = true;
457
                // $result['filesize'] = $filesize;
458
                $result['message'] = __('Uploaded');
459
            }
460
        }
461
        $this->log($result);
462
        return new CakeResponse(array('body' => json_encode($result)));
463
    }
464
 
465
    function cropImage ($url, $height, $width, $x1, $x2, $y1, $y2) {
466
        ini_set('memory_limit', '2G');
467
        $result['status'] = 0; 
468
        $result['message'] = __('Unable to crop');
469
 
470
        $image_type = substr($url, strrpos($url, '.', -1)); 
471
        $filepath = WWW_ROOT.substr($url, strlen(FULL_BASE_URL)+1);
472
        $croppedfile = substr($filepath, 0, strrpos($filepath, '/', -1)).
473
            '/C_'.substr($filepath, strrpos($filepath, '/', -1)+1);
474
 
475
        // Create image instances
476
        $dest = imagecreatetruecolor($x2,$y2);
477
 
478
        switch ($image_type) {
479
            case '.jpg':
480
            case '.jpeg':
481
            case '.JPEG':
482
            case '.JPG':
483
                $src = imagecreatefromjpeg($filepath);
484
                imagecopyresampled($dest,$src,0,0,$x1,$y1,$x2,$y2,$width,$height);
485
                imagejpeg($dest, $croppedfile);
486
                $ext = '.jpg';
487
                break;
488
            case '.gif':
489
                $src = imagecreatefromgif($filepath);
490
                imagecopyresampled($dest,$src,0,0,$x1,$y1,$x2,$y2,$width,$height);
491
                imagegif($dest, $croppedfile);
492
                $ext = '.gif';
493
                break;
494
            case '.png':
495
                $src = imagecreatefrompng($filepath);
496
                imagecopyresampled($dest,$src,0,0,$x1,$y1,$x2,$y2,$width,$height);
497
                imagepng($dest, $croppedfile);
498
                $ext = '.png';
499
                break;
500
            default: 
501
                $result['message'] = __('Unsupported image format.');   
502
                return $result;
503
        }
504
        $result['status'] = 1; 
505
        $result['message'] = __('Cropped');
506
        $result['data'] = substr($url, 0, strrpos($url, '/', -1)).'/C_'.substr($url, strrpos($url, '/', -1)+1);
507
        return $result;
508
    }
509
 
510
    function resizeImage ($inFile, $outFile, $w, $h) {
511
        $image = $this->Resize;
512
        $image->load($inFile);                       
513
        $image->crop($w,$h);
514
        $image->save($outFile);
515
    }
516
 
517
    public function crop() {
518
        $url = $this->request->data['file_url'];
519
        $height = $this->request->data['h']; 
520
        $width = $this->request->data['w']; 
521
        $x1 = $this->request->data['x'];
522
        $x2 = $this->request->data['x2'];
523
        $y1 = $this->request->data['y'];
524
        $y2 = $this->request->data['y2'];
525
 
526
        $result = $this->cropImage($url, $height, $width, $x1, $x2, $y1, $y2);
527
 
528
        $this->set('result', $result);
529
        $this->set('_serialize', array('result'));
530
    }
14561 anikendra 531
 
532
    public function generateMultiUrl($url,&$data){
533
    	if(!empty($data['multi']) && $data['multi']==1){
534
    		$url .= '/?multi=1';    		
535
    	}
536
    	unset($data['multi']);
537
    	return $url;
538
    }
13532 anikendra 539
}