Guest User

Untitled

a guest
May 27th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2. class PasteController extends AppController{
  3.  
  4. var $name = "Paste";
  5. var $uses = array("SourceCode");
  6. var $components = array('KindSyntaxComp');
  7. var $layout = 'default';
  8. //var $helpers = array('');
  9.  
  10. function index(){
  11. //$IDGenerator= new IDGenerator();
  12. //echo $IDGenerator->getNextId();
  13. $this->render('paste_source');
  14. }
  15. function view(){
  16. if(empty($this->data['SourceCode']['source_code'])){
  17. $this->redirect('index');
  18. }
  19. if(!empty($this->data)){
  20. $this->data['SourceCode']['paste_date']=date('Y-m-d H:i:s');
  21. $this->SourceCode->save($this->data);
  22. $this->KindSyntaxComp->STX($this->data['SourceCode']['lang_type']);
  23. $code=$this->KindSyntaxComp->stx_string($this->data['SourceCode']['source_code']);
  24. $this->set('code',$code);
  25. $this->render('view_source');
  26. }
  27. }
  28. }
  29. ?>
Add Comment
Please, Sign In to add comment