| 338 | | // the user try to be a teacher |
| 339 | | if ( $this->data['User']['group_id'] == 2) |
| 340 | | { |
| 341 | | // get the secret code for teachers registration process |
| 342 | | $code = $this->User->Group->field('code', array("id"=>2)); |
| 343 | | |
| 344 | | if ( $this->data['User']['code'] != $code ) |
| 345 | | { |
| 346 | | $message['wrong_code'] = "The teacher's code is incorrect"; |
| 347 | | } |
| | 338 | |
| | 339 | // get the secret code for teachers registration process |
| | 340 | $code = $this->User->Group->field('code', array("id"=>$this->data['User']['group_id'])); |
| | 341 | |
| | 342 | if ( $this->data['User']['code'] != $code ) |
| | 343 | { |
| | 344 | $message['wrong_code'] = "The code is incorrect, please put in contact with your school webmaster."; |
| 621 | | /** Private functions */ |
| 622 | | private function get_extension($imagetype) |
| 623 | | { |
| 624 | | if ( empty($imagetype) ) |
| 625 | | { |
| 626 | | return false; |
| 627 | | } |
| 628 | | |
| 629 | | switch($imagetype) |
| 630 | | { |
| 631 | | case 'image/bmp': return '.bmp'; |
| 632 | | case 'image/cis-cod': return '.cod'; |
| 633 | | case 'image/gif': return '.gif'; |
| 634 | | case 'image/ief': return '.ief'; |
| 635 | | case 'image/jpeg': return '.jpg'; |
| 636 | | case 'image/pipeg': return '.jfif'; |
| 637 | | case 'image/tiff': return '.tif'; |
| 638 | | case 'image/x-cmu-raster': return '.ras'; |
| 639 | | case 'image/x-cmx': return '.cmx'; |
| 640 | | case 'image/x-icon': return '.ico'; |
| 641 | | case 'image/x-portable-anymap': return '.pnm'; |
| 642 | | case 'image/x-portable-bitmap': return '.pbm'; |
| 643 | | case 'image/x-portable-graymap': return '.pgm'; |
| 644 | | case 'image/x-portable-pixmap': return '.ppm'; |
| 645 | | case 'image/x-rgb': return '.rgb'; |
| 646 | | case 'image/x-xbitmap': return '.xbm'; |
| 647 | | case 'image/x-xpixmap': return '.xpm'; |
| 648 | | case 'image/x-xwindowdump': return '.xwd'; |
| 649 | | case 'image/png': return '.png'; |
| 650 | | case 'image/x-jps': return '.jps'; |
| 651 | | case 'image/x-freehand': return '.fh'; |
| 652 | | default: return false; |
| 653 | | } |
| 654 | | } |
| 655 | | |
| 656 | | private function sendMail($email, $secret) |
| 657 | | { |
| 658 | | $this->Email->sender = '::MonoNeurona.org::'; |
| 659 | | $this->Email->to = $email; |
| 660 | | $this->Email->subject = 'Confirm karamelo activation account'; |
| 661 | | //$this->Email->replyTo = 'noreply@mononeurona.org'; |
| 662 | | $this->Email->sendAs = 'html'; |
| 663 | | $this->Email->template = null; |
| 664 | | $this->Email->from = 'noreply@ononeurona.org'; |
| 665 | | //$this->set('foo', 'Cake tastes good today'); |
| 666 | | //Set the body of the mail as we send it. |
| 667 | | //Note: the text can be an array, each element will appear as a |
| 668 | | //seperate line in the message body. |
| 669 | | |
| 670 | | $url = '<h2>Karamelo</h2><p>Open this in new tab to confirm: '; |
| 671 | | $url .= '<a href="http://'.$_SERVER['SERVER_NAME'].'/confirms/signup/'.$secret.'">'; |
| 672 | | $url .= 'http://'.$_SERVER['SERVER_NAME'].'/confirms/signup/'.$secret.'</a></p>'; |
| 673 | | |
| 674 | | //die($url); |
| 675 | | |
| 676 | | if ( $this->Email->send($url) ) |
| 677 | | { |
| | 619 | /* == PRIVATE == **/ |
| | 620 | private function _sendNewUserPwd($email, $random) |
| | 621 | { |
| | 622 | $this->layout = 'confirmation'; |
| | 623 | $this->Email->to = $email; |
| | 624 | //$this->Email->bcc = array('noreply@karamelo.org'); // note |
| | 625 | // this could be just a string too |
| | 626 | $this->Email->subject = 'Karamelo e-Learning:: confirma account'; |
| | 627 | $this->Email->replyTo = 'support@karamelo.org'; |
| | 628 | $this->Email->from = 'Chipotle-software.com'; |
| | 629 | $this->Email->template = 'confirmation'; // note no '.ctp' |
| | 630 | //Send as 'html', 'text' or 'both' (default is 'text') |
| | 631 | $this->Email->sendAs = 'text'; // because we like to send pretty mail |
| | 632 | //Set view variables as normal |
| | 633 | $this->set('random', $random); |
| | 634 | //Do not pass any args to send() |
| | 635 | if ( $this->Email->send() ) |
| | 636 | { |