Changeset 254
- Timestamp:
- 03/18/09 17:28:31 (3 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
controllers/comentblogs_controller.php (modified) (2 diffs)
-
controllers/users_controller.php (modified) (8 diffs)
-
models/news.php (modified) (1 diff)
-
models/user.php (modified) (4 diffs)
-
views/images/admin_listing.ctp (modified) (1 diff)
-
views/users/about.ctp (modified) (1 diff)
-
views/users/admin_edit.ctp (modified) (3 diffs)
-
webroot/img/static/mn-small.png (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
trunk/controllers/comentblogs_controller.php
r221 r254 39 39 $user_id = $this->Comentblog->Entry->field('user_id', array('Entry.id'=>$this->data['Comentblog']['entry_id'])); 40 40 41 $this->_sendMail($user_id, $this->data[ "Comentblog"]["entry_id"]);41 $this->_sendMail($user_id, $this->data['Comentblog']['entry_id']); 42 42 43 43 $this->redirect($this->data['Comentblog']['redirect_to'].'#comments'); … … 69 69 $url = '<img src="http://www.mononeurona.org/img/admin/new_user.jpg" alt="MonoNeurona" title="MonoNeurona" /><br />'; 70 70 $url .= '<h2>'.$data["User"]["username"].'</h2><p>You have a new comment in your blog: '; 71 $url .= '<a href="http://'.$_SERVER['SERVER_NAME'].'/ users/entry/'.$data["User"]["username"].'/'.$entry_id.'">';72 $url .= 'http://'.$_SERVER['SERVER_NAME'].'/ users/entry/'.$data["User"]["username"].'/'.$entry_id.'</a></p>';71 $url .= '<a href="http://'.$_SERVER['SERVER_NAME'].'/entries/view/'.$data['User']['username'].'/'.$entry_id.'">'; 72 $url .= 'http://'.$_SERVER['SERVER_NAME'].'/entries/view/'.$data['User']['username'].'/'.$entry_id.'</a></p>'; 73 73 74 74 //die($url); -
trunk/controllers/users_controller.php
r253 r254 11 11 class UsersController extends AppController { 12 12 13 public $helpers = array('Javascript', ' Ajax', 'Form', 'User', 'Fck', 'Time', 'Gags');13 public $helpers = array('Javascript', 'User', 'Fck', 'Gags'); 14 14 15 15 public $components = array('Email', 'Blog', 'Adds'); … … 21 21 22 22 if ( isset($this->data['User']['pwd'] ) ): 23 if ( strlen($this->data['User']['pwd']) < 6 ): // passwd too short, so unset23 if ( strlen($this->data['User']['pwd']) < 6 && strlen($this->data['User']['pwd']) != 0 ): // passwd too short, so unset 24 24 unset($this->data['User']['pwd']); 25 25 $this->Session->setFlash(__('Password too short', true)); 26 elseif( strlen($this->data['User']['pwd']) == 0 ): 27 unset($this->data['User']['pwd']); 26 28 endif; 27 29 endif; … … 32 34 $this->layout = 'blog'; 33 35 $this->pageTitle = 'About me, ' . $username; 34 $user_id = $this->User->field('id', array('username'=>$username)); 35 $conditions = array('User.id'=>$user_id); 36 $this->set('Element', $this->Blog->bloggerStuff($user_id)); // Charge Blog components aka Sidebars 37 $this->set('data', $this->User->findAll($conditions)); 38 $this->set('style', $this->Blog->getStyle($user_id)); 39 $this->set('tagCloud', $this->Blog->tagCloud($username)); // tagCloud 36 $this->Blog->setUserID($username); 37 $this->User->contain(); 38 $data = $this->User->find(array('User.username'=>$username)); 39 if (!$data): 40 $this->cakeError('error404'); 41 endif; 42 $this->set('data', $data); 40 43 } 41 44 … … 105 108 $this->flash('Error!, call to the companie\'s computers guy ', '/users/register'); 106 109 endif; 107 endif; 110 endif; 108 111 else: 109 112 $this->set('message', $this->User->validationErrors); … … 148 151 $this->layout = 'admin'; 149 152 if (empty($this->data['User'])): 150 $this->data = $this->User->read(null, $this->Auth->user('id')); 153 $this->User->contain(); 154 $this->data = $this->User->read(null, $this->Auth->user('id')); 151 155 else: 152 $this->data['User'] = Sanitize::clean($this->data['User']); 156 #$this->data['User'] = Sanitize::clean($this->data['User']); 157 #die(debug( $this->data['User'])); 158 unset($this->data['User']['username']); #don't save this 159 unset($this->data['User']['email']); 153 160 if ($this->User->save($this->data)): 154 161 $this->msgFlash('Profile has been saved','/admin/users/edit/'); 162 else: 163 die(debug($this->User->validationErrors)); 155 164 endif; 156 165 endif; … … 166 175 } 167 176 168 public function admin_delete($ id)169 { 170 $this->User->del($id);171 $this->msgFlash('User deleted', '/admin/users/listing');172 177 public function admin_delete($user_id) 178 { 179 if ($this->User->del($user_id) ): 180 $this->msgFlash('User deleted', '/admin/users/listing'); 181 endif; 173 182 } 174 183 … … 176 185 { 177 186 $this->layout = 'admin'; 178 179 180 187 } 181 188 // change user status actived/no actived … … 211 218 $uploaddir = '../webroot/img/avatars'; 212 219 $maxfilesize = 2097152; /** 2MB max size */ 213 214 220 $imgfile_name = $this->data['User']['file']['name']; 215 221 $imgfile_size = $this->data['User']['file']['size']; -
trunk/models/news.php
r175 r254 4 4 { 5 5 public $name = 'News'; 6 6 7 public $actsAs = array('Containable'); 8 7 9 public $hasMany = array( 8 10 'Comentnew' => array( -
trunk/models/user.php
r238 r254 2 2 //AppModel gives you all of Cake's Model functionality 3 3 4 class User extends AppModel { 5 6 // Its always good practice to include this variable. 7 public $name = 'User'; 8 9 public $belongsTo = array( 4 class User extends AppModel 5 { 6 7 public $name = 'User'; 8 9 public $actsAs = array('Containable'); 10 11 public $belongsTo = array( 10 12 'Group' => array( 11 13 'className' => 'Group', … … 13 15 )); 14 16 15 public $hasOne = array(17 public $hasOne = array( 16 18 'Style' => array( 17 19 'className' => 'Style', … … 53 55 public $validate = array( 54 56 'username' => array( 55 array(57 array( 56 58 'rule' => array('minLength', 5), 57 59 'message' => 'Username must be at least 5 characters long', 58 60 'allowEmpty' => false, 61 'on' => 'create', // but not on update 59 62 'required' => true 60 63 ), 61 64 array( 62 'rule' => 'isUnique', 65 'rule' => 'isUnique', 66 'on' => 'create', // but not on update 63 67 'message' => 'This username has already been taken.' 64 68 ) … … 69 73 'message' => 'Email must be at least 8 characters long', 70 74 'allowEmpty' => false, 75 'on' => 'create', // but not on update 71 76 'required' => true 72 77 ), 73 78 array( 74 'rule' => 'isUnique', 75 'message' => 'This email has already been taken.' 79 'rule' => 'isUnique', 80 'message' => 'This email has already been taken.', 81 'on' => 'create' // but not on update 76 82 ), 77 83 array( 78 'rule' => array('email', true), 79 'message' => 'Please supply a valid email address.' 84 'rule' => array('email', true), 85 'message' => 'Please supply a valid email address.', 86 'on' => 'create' // but not on updat 80 87 ) 81 88 ), -
trunk/views/images/admin_listing.ctp
r231 r254 74 74 ?> 75 75 </table> 76 77 76 <?php 78 77 $t = $html->div(null,$paginator->prev('«'. __('Previous', true).' ',null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); -
trunk/views/users/about.ctp
r130 r254 4 4 <?php 5 5 //die( var_dump($blog) ); 6 echo "<div class=\"title_section\">Here I am</div>"; 7 echo $data[0]['User']['name'] . " <br />"; 8 echo $data[0]['User']['cv'] . " <br />"; 9 echo $html->image('avatars/'.$data[0]['User']['avatar'], array('alt' => $data[0]['User']['name'], 'title' =>$data[0]['User']['name'])) . " "; 10 6 echo $html->div('title_section', 'Here I am'); 7 echo $data['User']['name'] . ' <br />'; 8 echo $data['User']['cv'] . ' <br />'; 9 echo $html->image('avatars/'.$data['User']['avatar'], array('alt' => $data['User']['name'], 'title' =>$data['User']['name'])) . ' '; 11 10 ?> 12 11 </div> -
trunk/views/users/admin_edit.ctp
r196 r254 1 1 <?php 2 //die( var_dump( $this->data ) );2 #die( debug( $this->data ) ); 3 3 4 4 if ($this->data['User']['id'] != $session->read('Auth.User.id')): … … 8 8 echo $html->para(null, $html->image('avatars/'.$this->data['User']['avatar'], array('alt'=>$this->data['User']['username'], 'title'=>$this->data['User']['username']))); 9 9 10 echo $form->create('User' , array('onsubmit'=>'return chkForm()'));10 echo $form->create('User'); 11 11 echo $form->hidden('User.id'); 12 12 echo $form->hidden('User.email'); … … 24 24 echo $form->input('User.quote', array('size' => 70, 'maxlength' => 150, 'label'=>__('Quote', true))); 25 25 26 echo $form->input('User.name_blog', array('size' => 45, 'maxlength' => 150, 'label'=>__('eduBlog name', true))); 27 26 echo $form->input('User.name_blog', array('size' => 45, 'maxlength' => 150, 'label'=>__('eduBlog name', true))); 27 28 echo $form->label('User.tags', __('Tags', true)). '<br />'; 29 echo $form->textarea('User.tags', array('cols' => 70, 'rows' => 2, 'label'=>__('Tags', true))); 30 28 31 echo $form->label('User.newsletter', __('Subscribe to newsletter', true).': '); 29 32 echo $form->checkbox('User.newsletter');
Note: See TracChangeset
for help on using the changeset viewer.
