Пример #1
0
 public function checkemail()
 {
     $email = strtolower($this->request->query['email']);
     $uuid = new Uuid();
     $emails = Documents::find('first', array('conditions' => array('email' => $email)));
     if (count($emails) === 0) {
         $kyc_id = $uuid->v4v();
         $email_code = substr($kyc_id, 0, 4);
         $data = array('kyc_id' => $kyc_id, 'email_code' => $email_code, 'email' => $email, 'hash' => md5($email), 'IP' => $_SERVER['REMOTE_ADDR']);
         $Documents = Documents::create($data);
         $saved = $Documents->save();
     } else {
         $emails = Documents::find('first', array('conditions' => array('email' => $email)));
         $kyc_id = $emails['kyc_id'];
         if ($emails['Verify']['Score'] >= 80) {
             return $this->render(array('json' => array('success' => 0, 'reason' => 'Aleredy KYC complete')));
         }
     }
     /////////////////////////////////Email//////////////////////////////////////////////////
     $emaildata = array('kyc_id' => $kyc_id, 'email' => $email);
     $function = new Functions();
     $compact = array('data' => $emaildata);
     $from = array(NOREPLY => "noreply@" . COMPANY_URL);
     $email = $email;
     $function->sendEmailTo($email, $compact, 'process', 'sendKYC', "KYCGlobal - Email Code", $from, '', '', '', null);
     /////////////////////////////////Email//////////////////////////////////////////////////
     return $this->render(array('json' => array('success' => 1)));
 }
Пример #2
0
 public function document()
 {
     $user = Session::read('member');
     $id = md5($user['email']);
     $document = Details::find('first', array('conditions' => array('user_id' => (string) $user['_id'])));
     //		if(count($document)==0){return $this->redirect('/');}
     $uploadOk = 1;
     if ($this->request->data) {
         $extension = pathinfo($this->request->data['file']['name'], PATHINFO_EXTENSION);
         $allowed = array('pdf');
         if (!in_array(strtolower($extension), $allowed)) {
             $msg = "Sorry, only PDF files are allowed.";
             $uploadOk = 0;
         }
         if ($uploadOk = 1) {
             $option = 'doc';
             $data = array('details_' . $option . '_id' => (string) $document['_id'], 'docname' => $this->request->data['docname'], 'date' => $this->request->data['date'], 'DateTime' => new \MongoDate(), 'keywords' => $this->request->data['keywords'], 'description' => $this->request->data['description'], $option => $this->request->data['file'], $option . '.verified' => 'No', $option . '.IP' => $_SERVER['REMOTE_ADDR']);
             $field = 'details_' . $option . '_id';
             $Documents = Documents::create($data);
             $saved = $Documents->save();
             $fileData = array('file' => $this->request->data['file'], 'documents_' . $option . '_id' => (string) $Documents->_id);
             $file = File::create();
             if ($file->save($fileData)) {
                 $msg = "Upload OK";
             }
             $image_address = File::find('first', array('conditions' => array('documents_doc_id' => (string) $Documents->_id)));
             if ($image_address['filename'] != "") {
                 $imagename_address = $image_address['_id'] . '_' . $image_address['filename'];
                 $path = LITHIUM_APP_PATH . '/webroot/download/' . $imagename_address;
                 file_put_contents($path, $image_address->file->getBytes());
             }
             //		print_r($path);
             $pages = $this->getPDFPages($path);
             // Output: 13
             //				print_r($pages);exit;
             unlink($path);
             $docdata = array();
             foreach ($pages as $page) {
                 $params = explode(":", $page);
                 $left = $params[0];
                 $right = $params[1];
                 $docdata = array_merge($docdata, array($left => trim($right)));
             }
             $data = array("document" => $docdata);
             $conditions = array("_id" => (string) $Documents->_id);
             Documents::update($data, $conditions);
             // Use the function
         }
     }
     return $this->redirect('ex::save');
 }
Пример #3
0
 public function checkemail()
 {
     $email = $this->request->query['email'];
     $uuid = new Uuid();
     $emails = Documents::find('first', array('conditions' => array('email' => $email)));
     if (count($emails) === 0) {
         $kyc_id = $uuid->v4v();
         $data = array('kyc_id' => $kyc_id, 'email' => $email, 'hash' => md5($email), 'IP' => $_SERVER['REMOTE_ADDR']);
         $Documents = Documents::create($data);
         $saved = $Documents->save();
     }
     $emails = Documents::find('first', array('conditions' => array('email' => $email)));
     /////////////////////////////////Email//////////////////////////////////////////////////
     $emaildata = array('kyc_id' => $kyc_id, 'email' => $email);
     $function = new Functions();
     $compact = array('data' => $emaildata);
     $from = array(NOREPLY => "noreply@" . COMPANY_URL);
     $email = $email;
     $function->sendEmailTo($email, $compact, 'process', 'sendKYC', "XGCWallet - Your KYC ID", $from, '', '', '', null);
     /////////////////////////////////Email//////////////////////////////////////////////////
     return $this->render(array('json' => array('success' => 1)));
 }
Пример #4
0
 public function signup()
 {
     if ($this->request->data) {
         //		if(stristr( $_SERVER['HTTP_REFERER'],COMPANY_URL)===FALSE){return $this->redirect('/login');exit;}
         $Users = Users::create($this->request->data);
         $saved = $Users->save();
         if ($saved == true) {
             $verification = sha1($Users->_id);
             //			$oauth = new OAuth2();
             //			$key_secret = $oauth->request_token();
             $ga = new GoogleAuthenticator();
             $data = array('user_id' => (string) $Users->_id, 'username' => (string) $Users->username, 'email.verify' => $verification, 'mobile.verified' => "No", 'mobile.number' => "", 'key' => $ga->createSecret(64), 'secret' => $ga->createSecret(64), 'Friend' => array());
             $Details = Details::create($data);
             $saved = $Details->save();
             $data = array('user_id' => (string) $Users->_id, 'email' => $Users->email, 'username' => (string) $Users->username, 'detail_id' => (string) $Details->_id, 'hash' => md5($Users->email), 'IP' => $_SERVER['REMOTE_ADDR']);
             $Documents = Documents::create($data);
             $saved = $Documents->save();
             $email = $this->request->data['email'];
             $name = $this->request->data['firstname'];
             $view = new View(array('loader' => 'File', 'renderer' => 'File', 'paths' => array('template' => '{:library}/views/{:controller}/{:template}.{:type}.php')));
             $body = $view->render('template', compact('email', 'verification', 'name'), array('controller' => 'users', 'template' => 'confirm', 'type' => 'mail', 'layout' => false));
             $transport = Swift_MailTransport::newInstance();
             $mailer = Swift_Mailer::newInstance($transport);
             $message = Swift_Message::newInstance();
             $message->setSubject("Verification of email from " . COMPANY_URL);
             $message->setFrom(array(NOREPLY => 'Verification email ' . COMPANY_URL));
             $message->setTo($Users->email);
             $message->addBcc(MAIL_1);
             $message->addBcc(MAIL_2);
             $message->addBcc(MAIL_3);
             $message->setBody($body, 'text/html');
             $mailer->send($message);
             $this->redirect('Users::email');
         }
     }
     return compact('saved', 'Users');
 }