Changeset 409
- Timestamp:
- 04/18/08 14:30:29 (9 months ago)
- Location:
- trunk/app
- Files:
-
- 4 added
- 6 modified
-
config/core.php (modified) (3 diffs)
-
config/sql/karamelo_postgres.sql (modified) (1 diff)
-
controllers/discussions_controller.php (modified) (5 diffs)
-
controllers/users_controller.php (modified) (1 diff)
-
views/discussions (added)
-
views/discussions/admin_listing.ctp (added)
-
views/discussions/renka.ctp (added)
-
views/elements/email/text/newdiscussion.ctp (added)
-
views/news/display.ctp (modified) (2 diffs)
-
views/news/view.ctp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/core.php
r407 r409 14 14 * In development mode, you need to click the flash message to continue. 15 15 */ 16 Configure::write('debug', 1);16 Configure::write('debug', 2); 17 17 /** 18 18 * Application wide charset encoding … … 75 75 * 76 76 */ 77 Configure::write('Session.save', ' cake');77 Configure::write('Session.save', 'database'); 78 78 /** 79 79 * The name of the table used to store CakePHP database sessions. … … 199 199 * ); 200 200 */ 201 Cache::config('default', array('engine' => 'File'));201 Cache::config('default', array('engine' => 'File')); 202 202 ?> -
trunk/app/config/sql/karamelo_postgres.sql
r401 r409 148 148 "level" int NOT NULL, 149 149 "discussion_id" int NOT NULL, 150 "user_id" int REFERENCES news(id) NOT NULL,150 "user_id" int REFERENCES users(id) NOT NULL, 151 151 "status" int NOT NULL DEFAULT 0 152 152 ); -
trunk/app/controllers/discussions_controller.php
r407 r409 16 16 class DiscussionsController extends AppController 17 17 { 18 public $name = 'Discussions';18 public $name = 'Discussions'; 19 19 20 public $helpers = array('Ajax', 'Time', 'Gags');21 22 public $components = array('Captcha');20 public $helpers = array('Ajax', 'Gags'); 21 22 public $components = array('Captcha', 'Email'); 23 23 24 24 public function beforeFilter() 25 25 { 26 $this->Auth->allow(array('captcha', 'a gregar', 'renka'));26 $this->Auth->allow(array('captcha', 'add')); 27 27 parent::beforeFilter(); 28 28 } … … 40 40 } 41 41 42 public function a gregar()42 public function add() 43 43 { 44 45 $this->layout = 'portal'; 46 47 echo 'I am in agregar function !!!<br />'; 48 49 die(debug($this->data)); 44 //die(debug($this->data)); 50 45 51 46 if ( !empty($this->data['Discussion']) ) 52 47 { 48 $this->data['Discussion']['level'] = 1; 49 $this->data['Discussion']['discussion_id'] = 1; 50 53 51 $this->Sanitize = new Sanitize; 54 52 … … 57 55 $this->data['Discussion']['comment'] = nl2br($this->data['Discussion']['comment']); 58 56 59 if ( $this->Auth->user( 'id') )57 if ( $this->Auth->user() ) 60 58 { 61 $this->data['Discussion']['user_id'] = $this->Auth->user('id'); 59 $this->data['Discussion']['user_id'] = $this->Auth->user('id'); 60 $this->data['Discussion']['username'] = $this->Auth->user('username'); 62 61 } 63 62 else 64 63 { 65 if ($this->data['Discussion']['captcha'] != $this->Session->read('captcha') || strlen($this->data['Discussion']['captcha']) < 3)64 /*if ($this->data['Discussion']['captcha'] != $this->Session->read('captcha') || strlen($this->data['Discussion']['captcha']) < 3) 66 65 { 67 66 $this->flash('Code incorrect, please pulse back button', '/news/view/'.$this->data["Discussion"]["new_id"], 6); // wrong captcha, spambot ?? 68 exit(); 69 } 67 } */ 70 68 71 69 $this->data['Discussion']['user_id'] = 0; … … 84 82 } 85 83 } 86 84 87 85 /* == PRIVATE == **/ 88 private function __send Email($user_id, $new_id)86 private function __sendMail($user_id, $new_id) 89 87 { 90 $ User = new User;88 $this->User = new User; 91 89 92 90 $this->User->unbindModel(array("hasMany"=>array('Entry', 'Lesson', 'Faq', 'Vclassroom', 'Acquaintance'))); 93 91 94 $ user= $this->User->find(array('User.id'=>$user_id), array("User.name", "User.email"));95 96 $this->layout = ' newcomment';97 $this->Email->to = $ user['email'];92 $val = $this->User->find(array('User.id'=>$user_id), array("User.name", "User.email")); 93 94 $this->layout = 'default'; 95 $this->Email->to = $val['User']['email']; 98 96 $this->Email->subject = 'Karamelo e-Learning:: New comment'; 99 97 $this->Email->replyTo = 'support@karamelo.org'; 100 98 $this->Email->from = 'Chipotle-software.com'; 101 $this->Email->template = ' confirmation'; // note no '.ctp'99 $this->Email->template = 'newdiscussion'; // note no '.ctp' 102 100 //Send as 'html', 'text' or 'both' (default is 'text') 103 101 $this->Email->sendAs = 'text'; // because we like to send pretty mail 104 102 //Set view variables as normal 105 $this->set('name', $ user['name']);103 $this->set('name', $val['User']['name']); 106 104 $this->set('new_id', $new_id); 107 105 … … 115 113 return false; 116 114 } 117 }118 119 public function renka()120 {121 $this->layout = 'portal';122 //return $this->Captcha->render();123 115 } 124 116 -
trunk/app/controllers/users_controller.php
r374 r409 19 19 public function beforeFilter() 20 20 { 21 $this->Auth->allow(array('blog', 'entry','portfolio', 'about', 'register', 'directory', 'bloggers', 'insert', 'validate' ));21 $this->Auth->allow(array('blog', 'entry','portfolio', 'about', 'register', 'directory', 'bloggers', 'insert', 'validate', 'logout')); 22 22 parent::beforeFilter(); 23 23 } -
trunk/app/views/news/display.ctp
r401 r409 6 6 foreach ($data as $val) 7 7 { 8 $tmp = $html->div('news_title', $html->link($val['News']['title'], '/news/view/'. $val['News']['id'])); 8 echo '<div class="wrapnew">'; 9 10 echo $html->div('news_title', $html->link($val['News']['title'], '/news/view/'. $val['News']['id'])); 9 11 10 $tmp .=$html->div('news_date', $val['News']['created']);12 echo $html->div('news_date', $val['News']['created']); 11 13 12 $tmp .=$html->div('news_body',14 echo $html->div('news_body', 13 15 $html->div('img_new', $html->link( 14 16 $html->image('themes/'.$val['Theme']['img'], … … 23 25 24 26 25 $tmp .=$val['News']['body'];26 27 if ( strlen($val['News']['reference']) > 5 ) // the reference27 echo $val['News']['body']; 28 29 if ($val['News']['comments'] == 1 ) // comments enabled on this new 28 30 { 29 $tmp .= $html->div(null, $html->link('Reference', $val['News']['reference'])); 30 } 31 32 if ($val['News']['comments'] == 1 ) // the reference 33 { 34 $tmp .= $html->div(null, $html->link('Put your comment', '/news/view/'.$val['News']['id'])); 31 echo $html->para(null, $html->link('Put your comment', '/news/view/'.$val['News']['id'])); 35 32 } 36 echo $html->div('wrapnew', $tmp); 33 34 35 ?> 36 <br /> 37 <span style="font-size:7pt;">Permalink:</span> <br /> 38 <?php echo $html->link( 39 'http://'.$_SERVER['SERVER_NAME'].'/news/view/'.$val['News']['id'], 40 'http://'.$_SERVER['SERVER_NAME'].'/news/view/'.$val['News']['id'] 41 ); 42 ?> 43 <br /><br /> 44 <b>Reference:</b> 45 46 <?php echo $html->link( 47 $html->image('static/newwindow.gif', array("alt"=>"Open new window", "title"=>"Open new window")), 48 $val['News']['reference'], 49 array("onclick"=>"window.open(this.href, '_help', 'status,scrollbars,resizable,width=800,height=600,left=10,top=10,menubar,toolbar')"), 50 null, 51 null, 52 false); 53 54 echo $news->socialNets($val['News']['id'], $val['News']['title']); // Social nets buttons 55 56 57 58 echo '</div>'; 37 59 } 38 60 ?> -
trunk/app/views/news/view.ctp
r407 r409 46 46 47 47 echo '<div class="comentnew" style="background-color:'.$bg.'">'; 48 echo $time->timeAgoInWords($v['created']) . ' <b>'. $v[' name'] . '</b> wrote:<br />';48 echo $time->timeAgoInWords($v['created']) . ' <b>'. $v['username'] . '</b> wrote:<br />'; 49 49 echo $v["comment"]; 50 50 echo "</div>"; … … 53 53 echo "</div>"; 54 54 55 echo $form->create('Discussion', array('action'=>'agregar')); 56 //echo '<form action="/discussions/agregar" method="post">'; 55 if ( isset( $cU['User']['id'] ) ): 56 echo $form->create('Discussion', array('action'=>'add')); 57 echo $form->hidden('Discussion.new_id', array('value'=>$data['News']['id'])); 57 58 ?> 58 59 60 59 <fieldset> 61 60 <legend>Write comment:</legend> 62 61 <?php 63 echo $form->hidden('Discussion.new_id', array('value'=>$data['News']['id'])); 64 echo $form->hidden('Discussion.level', array('value'=>1)); 65 echo $form->hidden('Discussion.comentnew_id', array('value'=>1)); 66 67 if ( isset( $cU['User']['id'] ) ): 68 echo $form->hidden('Discussion.user_id', array('value'=> $cU['User']['id'])); 69 echo $form->hidden('Discussion.name', array('value'=>$cU['User']['username'])); 70 echo '<b>'. $cU['User']['username'] . '</b> write: <br />'; 71 72 else: 73 74 echo $form->hidden('Discussion.user_id', array('value'=> 0)); 75 echo $form->input('Discussion.name', array('size'=> 25, 'maxlength' => 40)); 76 // echo '<br /><br /> <img src="'. $html->url('/discussions/captcha') .'" alt="Captcha" title="Captcha" /> <br />'; 77 //echo $form->input('Discussion.captcha', array("size" => 6, "maxlength" => 6)); 78 //echo $form->label('Discussion.captcha', 'Introduce el código, todas la letras son minúsculas' ).'<br />'; 79 endif; 80 81 echo $form->textarea('Discussion.comment', array('cols'=>60, 'rows'=>10)) . $form->end('Send comment'); 82 62 echo $form->label('Discussion.comment', '<b>'. $cU['User']['username'] . '</b> write:').'<br />'; 63 echo $form->textarea('Discussion.comment', array('cols'=>60, 'rows'=>10)); 64 echo $form->end('Send comment'); 65 else: 66 echo $html->para(null, $html->link('Login to write comments', '/users/login')); 67 endif; 83 68 } 84 69 ?>
