Changeset 627
- Timestamp:
- 07/05/08 01:09:56 (3 months ago)
- Location:
- trunk/app
- Files:
-
- 5 modified
-
controllers/forums_controller.php (modified) (6 diffs)
-
controllers/users_controller.php (modified) (5 diffs)
-
locale/spa/LC_MESSAGES/default.po (modified) (5 diffs)
-
views/users/admin_edit.ctp (modified) (2 diffs)
-
views/users/register.ctp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/forums_controller.php
r626 r627 119 119 public function admin_topics( $f_id ) 120 120 { 121 $forum_id = (int) $f_id;122 123 if ( !is_int($forum_id) ) 124 {125 $this->redirect('/');126 }121 $forum_id = (int) $f_id; 122 123 if ( !is_int($forum_id) ): 124 $this->redirect('/'); 125 return false; 126 endif; 127 127 128 128 $this->layout = 'admin'; … … 139 139 $this->set('vclassrooms', $this->Forum->getVclassrooms($this->Auth->user('id'))); 140 140 141 if ( !empty( $this->data['Forum'] ) ) 142 { 141 if ( !empty( $this->data['Forum'] ) ): 142 143 143 $this->Sanitize = new Sanitize; 144 144 … … 149 149 $this->Forum->create(); 150 150 151 if ( $this->Forum->save($this->data['Forum']) ) 152 { 153 $this->msgFlash('Forum created', '/admin/catforums/listing'); 154 } 155 } 156 else 157 { 151 if ( $this->Forum->save($this->data['Forum']) ): 152 $this->msgFlash(__('Forum created', true), '/admin/catforums/listing'); 153 endif; 154 155 else: 158 156 $this->set('catforum_id', $catforum_id); 159 }157 endif; 160 158 } 161 159 … … 165 163 $this->set('vclassrooms', $this->Forum->getVclassrooms($this->Auth->user('id'))); 166 164 167 if (empty($this->data['Forum'])) 168 {165 if (empty($this->data['Forum'])): 166 169 167 $this->layout = 'admin'; 170 168 … … 172 170 173 171 $this->data = $this->Forum->read(); 174 } 175 else 176 { 177 $this->Sanitize = new Sanitize; 172 173 else: 174 $this->Sanitize = new Sanitize; 178 175 179 $this->Sanitize->clean($this->data['Forum']);176 $this->Sanitize->clean($this->data['Forum']); 180 177 181 if ($this->Forum->save($this->data['Forum'])) 182 { 183 $this->msgFlash('Forum updated', '/admin/catforums/listing'); 184 } 185 } 178 if ($this->Forum->save($this->data['Forum'])): 179 $this->msgFlash(__('Data saved', true), '/admin/catforums/listing'); 180 endif; 181 endif; 186 182 } 187 183 // change status published/draft … … 202 198 } 203 199 204 public function admin_delete($ id)200 public function admin_delete($forum_id) 205 201 { 206 if ( $this->Forum->del($id) ) 207 { 208 $this->msgFlash('Forum deleted', '/admin/catforums/listing'); 209 } 210 } 211 202 if ( $this->Forum->del($forum_id) ): 203 $this->msgFlash(__('Forum deleted', true), '/admin/catforums/listing'); 204 endif; 205 } 212 206 } 213 207 ?> -
trunk/app/controllers/users_controller.php
r614 r627 527 527 public function admin_edit() 528 528 { 529 if ( empty($this->data['User']) ) 530 { 531 $this->layout = 'admin'; 529 if ( empty($this->data['User']) ): 530 $this->layout = 'admin'; 532 531 533 $this->set('Groups', Set::combine($this->User->Group->find('all', array('order' => 'name')), "{n}.Group.id","{n}.Group.name"));532 $this->set('Groups', Set::combine($this->User->Group->find('all', array('order' => 'name')), "{n}.Group.id","{n}.Group.name")); 534 533 535 $this->User->unbindModel($this->User->notNow);534 $this->User->unbindModel($this->User->notNow); 536 535 537 $this->data = $this->User->read(null, $this->Auth->user('id')); 538 } 539 else 540 { 541 //die( debug($this->data['User']) ); 542 if ($this->User->save($this->data['User'])) 543 { 544 $this->msgFlash('User has been updated.','/admin/users/edit/'); 545 } 546 } 536 $this->data = $this->User->read(null, $this->Auth->user('id')); 537 538 else: 539 //die( debug($this->data['User']) ); 540 if ($this->User->save($this->data['User'])): 541 $this->msgFlash(__('User has been updated', true), '/admin/users/edit/'); 542 endif; 543 endif; 547 544 } 548 545 … … 596 593 $this->data['User']['id'] = $id; 597 594 598 if ($this->User->save($this->data)) 599 { 595 if ($this->User->save($this->data['User'])): 600 596 $this->msgFlash('User status changed', '/admin/users/listing/'); 601 } 602 else 603 { 597 else: 604 598 $this->flash('Problem!!', '/admi/users/listing/'); 605 }599 endif; 606 600 } 607 601 608 602 /*** DELETE **/ 609 public function admin_delete($id) 610 { 611 if ($this->User->del($id)) 612 { 613 $this->msgFlash('User has been deleted.', '/admin/users/listing'); 614 } 603 public function admin_delete($user_id) 604 { 605 if ($this->User->del($user_id)): 606 $this->msgFlash(__('User deleted', true), '/admin/users/listing'); 607 endif; 615 608 } 616 609 … … 658 651 /** Security: checks to see if file is an image, if not do not allow upload ==*/ 659 652 660 if ( $type != "image/jpeg" && $type != "image/pjpeg" && $type != "image/png" && $type != "image/gif") 661 { /** is this a valid file? */ 662 $ErrMsg = "<h1>ERROR</h1> the file $imgfile_name $imgfile is not valid.<br>"; 663 $ErrMsg .= "<p>Only .jpg, .gif or .png files<br><br>"; 664 $ErrMsg .= "Current type file: " . $type . "</p>\n"; 665 666 /** delete uploaded file */ 667 unlink($imgfile); 668 die($this->flash($ErrMsg, '/admin/users/edit/') ); 669 } 670 671 if ( $imgfile_size > $maxfilesize) 672 { 673 $ErrMsg = "<h1>ERROR</h1> The image is too big.<br />"; 674 $ErrMsg .= "<p>Bigger than 2.0 MB <br /><br />"; 675 $ErrMsg .= "Current size: " . $imgfile_size ."</p>\n"; 676 677 /** delete uploaded file */ 678 unlink($imgfile); 679 die( $this->flash($ErrMsg,'/admin/users/edit/') ); 680 } 653 if ( $type != "image/jpeg" && $type != "image/pjpeg" && $type != "image/png" && $type != "image/gif"): 654 /** is this a valid file? */ 655 $msg = "Error, the file $imgfile_name $imgfile is not valid, only .jpg, .gif or .png, current type file: " . $type; 656 unlink($imgfile); /** delete uploaded file */ 657 $this->flash($msg, '/admin/users/edit/'); 658 return false; 659 endif; 660 661 if ( $imgfile_size > $maxfilesize): 662 $msg = ">Error. The image is bigger than 2.0 MB Current size: " . $imgfile_size; 663 unlink($imgfile); /** delete uploaded file */ 664 $this->flash($msg,'/admin/users/edit/'); 665 return false; 666 endif; 681 667 682 668 //check size 683 if ($width > 100 || $height > 100) 684 { 685 $ErrMsg = "<h1>ERROR</h1> The image is too large.<br>"; 686 $ErrMsg .= "<p>Widht or height is larger than 100 pixels <br /><br />"; 687 $ErrMsg .= "Current size: width ". $width ."px height ". $height ."px</p>\n"; 688 689 /** delete uploaded file */ 690 unlink($imgfile); 691 die( $this->flash($ErrMsg,'/admin/users/edit/') ); 692 693 } 669 if ($width > 100 || $height > 100): 670 $msg = "Error. Width or height is larger than 100 pixels. Width ". $width ."px, height ". $height ."px</p>\n"; 671 unlink($imgfile); /** delete uploaded file */ 672 $this->flash($msg,'/admin/users/edit/'); 673 return false; 674 endif; 694 675 695 676 $extension = $this->Adds->get_extension($type); … … 703 684 $newfile = $uploaddir . "/" . $final_filename; 704 685 705 /** do extra security check to prevent malicious abuse */ 706 if (is_uploaded_file($imgfile)) 707 { 686 /** do extra security check to prevent malicious abuse */ 687 if (is_uploaded_file($imgfile)): 708 688 /** move file to proper directory ==*/ 709 if (!copy($imgfile, $newfile)) 710 { 689 if (!copy($imgfile, $newfile)): 711 690 /** if an error occurs the file could not be written, read or possibly does not exist */ 712 die($this->flash('Error Uploading File.', '/ users/edit/'.$this->Auth->user('id')));713 }714 }691 die($this->flash('Error Uploading File.', '/admin/users/edit/')); 692 endif; 693 endif; 715 694 716 695 /** Database stuff **/ … … 718 697 $this->data['User']['avatar'] = $final_filename; 719 698 720 if ($this->User->save($this->data)) 721 { 722 $this->redirect('/admin/users/edit/'. $this->Auth->user('id')); 723 } 699 if ($this->User->save($this->data)): 700 $this->redirect('/admin/users/edit/'); 701 endif; 724 702 725 703 /** delete the temporary uploaded file **/ -
trunk/app/locale/spa/LC_MESSAGES/default.po
r626 r627 1 msgid "Group" 2 msgstr "Grupo" 3 4 msgid "Email" 5 msgstr "Correo" 6 7 msgid "Name and last name" 8 msgstr "Nombre y apellido" 9 10 msgid "Left empty if you do not want to change" 11 msgstr "Dejar vacÃo si no se desea cambiarlo" 12 1 13 msgid "Delete" 2 14 msgstr "Eliminar" 3 15 16 msgid "Layout" 17 msgstr "Diseño" 18 19 msgid "Quote" 20 msgstr "Frase" 21 22 msgid "Subscribe to newsletter" 23 msgstr "Deseo recibir el boletÃn" 24 25 msgid "Upload new avatar" 26 msgstr "Subir nuevo avatar" 27 4 28 msgid "Data saved" 5 29 msgstr "Datos guardados" … … 14 38 msgstr "Agregar" 15 39 40 msgid "New user" 41 msgstr "Nuevo usuario" 42 43 msgid "About you and your interests" 44 msgstr "Escribe acerca de ti y tus interéses" 45 46 msgid "I read and I do agree with terms" 47 msgstr "He leÃdo y acepto los términos del servicio" 48 16 49 msgid "Finishing date" 17 50 msgstr "Fecha de fin de curso" … … 55 88 msgid "Send comment" 56 89 msgstr "Enviar comentario" 90 91 msgid "Send" 92 msgstr "Enviar" 93 94 msgid "At least 5 characters, only lowercase. No spaces." 95 msgstr "Al menos cinco caracteres, sólo minúsculas, no usar espacios." 96 97 msgid "At least 6 characters" 98 msgstr "Al menos seis caracteres" 57 99 58 100 msgid "Write comment" … … 215 257 msgstr "Subir archivo" 216 258 217 msgid "read_terms"218 msgstr "He leido y aceptado los terminos"219 220 259 msgid "Welcome" 221 260 msgstr "Bienvenido" … … 260 299 msgstr "Estado modificado" 261 300 301 msgid "Registration form" 302 msgstr "Forma de registro" 303 262 304 msgid "Hidden" 263 305 msgstr "Oculto" -
trunk/app/views/users/admin_edit.ctp
r613 r627 20 20 21 21 echo '<legend>'.$session->read('Auth.User.username') .'\'s account</legend>'; 22 echo $form->input('User.pwd', array( "size"=>9, "maxlength"=>9,"value"=>"")) . ' Left empty if you do not want to change';23 echo $ form->error('User.pwd', 'A name is required.');22 echo $form->input('User.pwd', array('size'=>9, 'maxlength'=>9, 'value'=>'', 'label'=>__('Password', true))) . ' '.__('Left empty if you do not want to change', true); 23 echo $html->para(null, '<br />'); 24 24 25 echo $form->input('User.name', array( "size" => 35, "maxlength"=>50));25 echo $form->input('User.name', array('size' => 35, 'maxlength'=>50)); 26 26 echo $form->error('User.name', 'A name is required.'); 27 27 28 echo $form->input('User.email', array( "size" => 30, "maxlength"=>50));28 echo $form->input('User.email', array('size' => 30, 'maxlength'=>50)); 29 29 echo $form->error('User.email', 'An email is required.'); 30 30 31 // if the user belongs to admin group 32 if ($session->read('Auth.User.group_id') == 1): 33 echo $form->label('User.group_id', 'Group:' ); 34 echo $form->select('User.group_id', $Groups); 35 endif; 36 37 echo $form->label('User.layout', 'Layout:' ); 31 echo $form->label('User.layout', __('Layout',true).': '); 38 32 $designs = array('rubyx'=>'Rubyx', 'school'=>'School', 'paris'=>'Paris'); 39 33 echo $form->select('User.layout', $designs, null, null, false); 40 34 41 echo $form->label('User.cv', 'Profile:');42 echo $form->textarea('User.cv', array( "cols" => 70, "rows"=> 7));35 echo $form->label('User.cv', __('Profile',true) ); 36 echo $form->textarea('User.cv', array('cols' => 70, 'rows' => 7)); 43 37 44 echo $form->input('User.quote', array( "size" => 70, "maxlength" => 150));38 echo $form->input('User.quote', array('size' => 70, 'maxlength' => 150, 'label'=>__('Quote', true))); 45 39 46 echo $form->input('User.name_blog', array( "size" => 45, "maxlength"=> 150));40 echo $form->input('User.name_blog', array('size' => 45, 'maxlength' => 150)); 47 41 48 echo $form->label('User.newsletter', 'Subscribe to newsletter:');49 echo $form->checkbox('User.newsletter', array( "value"=> 1));42 echo $form->label('User.newsletter', __('Subscribe to newsletter', true).': '); 43 echo $form->checkbox('User.newsletter', array('value' => 1)); 50 44 51 echo $form->end( 'Save');45 echo $form->end(__('Save', true)); 52 46 ?> 53 47 </fieldset> … … 63 57 <fieldset> 64 58 <legend><?php __('Upload new avatar'); ?></legend> 65 <br /> 66 <p>An image 40 x 40 pixels</p> 67 <?php 68 echo $form->label('User.file', 'Avatar:' ); 69 echo $form->file('User.file'); 70 echo $form->error('User.file', 'Title is required.'); 71 echo $form->end('Upload'); 59 <?php 60 echo $html->div(null, 'An image 40 x 40 pixels'); 61 echo $form->file('User.file'); 62 echo $form->error('User.file', 'Title is required.'); 63 echo $form->end(__('Upload', true)); 72 64 ?> 73 65 </fieldset> -
trunk/app/views/users/register.ctp
r615 r627 4 4 else: 5 5 ?> 6 <div style="border-bottom:1px dotted gray;font-size:16pt;color:green;font-weigth:bold;margin-top:15px">Registration form </div> 6 <div style="border-bottom:1px dotted gray;font-size:16pt;color:green;font-weigth:bold;margin-top:15px"> 7 <?php __('Registration form'); ?> </div> 7 8 8 9 <div id="charging" style="display:none;"><?php echo $html->image('static/loading.gif', array("alt"=>"Loading")); ?></div> … … 15 16 16 17 <fieldset> 17 <legend>New User:</legend> 18 <?php echo $form->input('User.username', array("size" => 10, "maxlength" => 10, "between"=>": ", "onBlur"=>"this.value=this.value.toLowerCase()")); ?><span class="small">At least 5 characters, only lowercase. No spaces.</span> 19 <br /> 18 <legend><?php __('New user'); ?></legend> 19 <?php echo $form->input('User.username', array("size" => 10, "maxlength" => 10, "between"=>": ", "onBlur"=>"this.value=this.value.toLowerCase()")); ?> 20 <span class="small"><?php __('At least 5 characters, only lowercase. No spaces.');?></span> 21 <div><br /></div> 22 <?php echo $form->label('User.pwd', __('Password'.': ', true)) . $form->password('User.pwd', array('size'=>9,'maxlength'=>9)); ?> 23 <span class="small"><?php __('At least 6 characters'); ?></span> 24 <?php 25 echo $html->div(null, '<br />'); 26 echo $form->input('User.name', array('size' => 25, 'maxlength' => 50, 'between'=>': ', 'label'=>__('Name and last name', true))); 27 28 echo $html->div(null, '<br />'); 29 echo $form->input('User.email', array('size' => 20, 'maxlength' => 45, 'between'=>': ', 'label'=>__('Email', true))); 30 31 echo $html->div(null, '<br />'); 32 echo $form->label('User.group_id', __('Group'.': ', true)); 33 34 $fieldName = 'User.group_id'; 35 $selected = 3; 36 $showEmpty = false; 37 $return = true; 38 39 echo $form->select($fieldName, $groups, $selected, null, null, $showEmpty, $return); 20 40 21 <?php echo $form->input('User.email', array("size" => 20, "maxlength" => 45, "between"=>": ")); ?>22 <br />41 echo $html->div(null, '<br />'); 42 echo $form->input('User.code', array('size' => 7, 'maxlength' => 7, 'between'=>': ')); 23 43 24 <?php echo $form->input('User.name', array("size" => 25, "maxlength" => 50, "between"=>": ")); ?> 25 <br /> 26 <?php echo $form->label('User.group_id', 'Group:' );?> 27 <?php 28 $fieldName = 'User.group_id'; 29 $selected = 3; 30 $showEmpty = false; 31 $return = true; 32 33 echo $form->select($fieldName, $groups, $selected, null, null, $showEmpty, $return); 34 ?> 35 <br /> 36 37 <?php echo $form->input('User.code', array("size" => 7, "maxlength" => 7)); ?> 38 39 <?php echo $form->label('User.pwd', 'Password: ') . $form->password('User.pwd', array('size' => 9, 'maxlength' => 9)); ?> 40 <span class="small">At least 6 characters</span> 41 <br /><br /> 42 <?php echo $form->label('User.description', 'About you and your interests:' );?><br /> 43 <?php echo $form->textarea('User.description', array("rows"=>4, "cols"=>50)) ?> 44 <br /><br /> 45 <?php 44 echo $html->div(null, '<br />'); 45 echo $form->label('User.description', __('About you and your interests', true) ) . '<br />'; 46 echo $form->textarea('User.description', array("rows"=>4, "cols"=>50)).'<br />'; 46 47 47 $tmp = $html->link('I read the terms:','#header',48 $tmp = $html->link(__('I read and I do agree with terms', true),'#header', 48 49 array("onclick"=>"javascript:window.open('/colleges/terms', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=400')")) . ' '; 49 50 50 echo $form->label('User.agree', $tmp); 51 echo $form->checkbox('User.agree', array("value"=>1)); 52 53 echo $ajax->submit('Send', array("url" => "/users/insert/", 51 echo $form->label('User.agree', $tmp); 52 echo $form->checkbox('User.agree', array('value'=>1)); 53 54 echo $html->div(null, '<br />'); 55 56 echo $ajax->submit(__('Send', true), array("url" => "/users/insert/", 54 57 "update"=>"updater", 55 58 "before" => "if ( !validateData() ) return false;", … … 62 65 63 66 <?php 64 echo $html->para(null, 67 echo $html->para(null, 65 68 'Please contact <a href="mailto:webmaster@conrad-college.edu">webmaster@conrad-college.edu</a> if you have doubts or comments about this registration process.'); 66 69 ?>
