Changeset 18
- Timestamp:
- 09/03/09 00:19:47 (12 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 modified
-
controllers/UserController.php (modified) (1 diff)
-
models/Model.php (modified) (3 diffs)
-
models/User.php (modified) (1 diff)
-
views/snippet/view.php (modified) (1 diff)
-
views/user/register.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/controllers/UserController.php
r16 r18 60 60 public function register() 61 61 { 62 // already logged in? 63 if($this->current_user->id){ 64 $this->redirect_to(array('action'=>'view','id'=>$this->current_user->id)); 65 exit(); 66 } 62 67 68 $this->title = "Register"; 63 69 70 // if there's post data 71 if($_POST){ 72 73 $u = User::find_all(array('login'=>$_POST['login'])); 74 if($u){ 75 var_dump($u); 76 $this->error = 'That username is unavailable.'; 77 } else { 78 79 $user = new User; 80 81 $user->email = $_POST['email']; 82 $user->login = $_POST['login']; 83 $user->user_level = 1; 84 85 if($user->set_password($_POST['password'],$_POST['confirm_password'])){ 86 $user->save(); 87 $this->redirect_to(array('action'=>'login','result'=>'success')); 88 exit(); 89 }else{ 90 $this->error = 'Your passwords did not match!'; 91 } 92 } 93 } 64 94 } 65 95 -
trunk/models/Model.php
r16 r18 242 242 }*/ 243 243 244 $cols = '('.implode(',',array_keys($this->initial)).')';244 //$cols = '('.implode(',',array_keys($this->initial)).')'; 245 245 246 246 $updates = array(); … … 266 266 } 267 267 268 $cols = '('.implode(',',array_keys($data)).')'; 269 268 270 $vals = "(".implode(",", array_map(array('Model','quote'),array_map(array($db, 'real_escape_string'), array_values($data)))).")"; 269 271 … … 273 275 $update = ''; 274 276 } 275 277 //echo "INSERT INTO {$this->table} $cols VALUES $vals $update;"; 278 //exit(); 276 279 $db->query("INSERT INTO {$this->table} $cols VALUES $vals $update;"); 277 280 -
trunk/models/User.php
r6 r18 17 17 18 18 protected $password; 19 protected $user_level;20 19 21 20 /** -
trunk/views/snippet/view.php
r15 r18 135 135 '<span class="line-number">$1</span>', 136 136 $comment->body)); ?></span> 137 <span class="comment-collapsed" ><?php echo substr($comment->body,0,50); ?>...137 <span class="comment-collapsed" onclick="$(this).parent().toggleClass('collapsed');"><?php echo substr($comment->body,0,50); ?>... 138 138 <span class="comment-author"><?php echo $comment->user->name; ?></span> 139 139 </span>
