Changeset 34
- Timestamp:
- 07/16/07 16:10:24 (18 months ago)
- Location:
- trunk/app
- Files:
-
- 23 added
- 10 modified
-
controllers/ecourses_controller.php (modified) (1 diff)
-
controllers/entries_controller.php (modified) (5 diffs)
-
controllers/news_controller.php (modified) (1 diff)
-
controllers/themes_controller.php (added)
-
controllers/users_controller.php (modified) (28 diffs)
-
models/theme.php (modified) (1 diff)
-
views/entries/admin_start.thtml (modified) (1 diff)
-
views/helpers/news.php (modified) (1 diff)
-
views/layouts/default.thtml (modified) (1 diff)
-
views/news/view.thtml (modified) (3 diffs)
-
views/themes/admin_cancel.thtml (added)
-
views/themes/admin_edit.thtml (added)
-
views/themes/admin_listing.thtml (added)
-
views/themes/row.thtml (added)
-
views/themes/themes.thtml (added)
-
webroot/css/styles.css (modified) (6 diffs)
-
webroot/img/socialnet (added)
-
webroot/img/socialnet/barrapunto.png (added)
-
webroot/img/socialnet/boton_negativo.gif (added)
-
webroot/img/socialnet/boton_negativo_off.gif (added)
-
webroot/img/socialnet/boton_positivo.gif (added)
-
webroot/img/socialnet/boton_positivo_off.gif (added)
-
webroot/img/socialnet/delicious.png (added)
-
webroot/img/socialnet/fresqui.png (added)
-
webroot/img/socialnet/google.png (added)
-
webroot/img/socialnet/icon_stumbleupon.gif (added)
-
webroot/img/socialnet/meneame.png (added)
-
webroot/img/socialnet/technorati.png (added)
-
webroot/img/socialnet/vote_loader.gif (added)
-
webroot/img/static/newwindow.gif (added)
-
webroot/img/themes/notice-board.jpg (added)
-
webroot/img/themes/theme-announcement.png (added)
-
webroot/img/themes/theme-biology.png (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/ecourses_controller.php
r31 r34 42 42 } 43 43 44 public function admin_add() { 44 public function admin_add() 45 { 45 46 46 47 //die(print_r($this->data)); -
trunk/app/controllers/entries_controller.php
r31 r34 11 11 12 12 class EntriesController extends AppController { 13 14 public $helpers = array('Ajax', 'Form', 'Fck');15 16 public $displayField = 'Blog';17 18 public $components = array('Edublog', 'Portal');19 20 public function admin_start($order = null)21 {22 if (!$this->othAuth->user('id'))23 {24 die($this->redirect('/users/general')); // Get Out!!!25 }26 27 $this->layout = 'admin';28 $this->pageTitle = 'Entries';29 30 $conditions = null;31 $fields = array("id", "title", "body", "category_id");32 $data = $this->Entry->findAll( $conditions, $fields, $order, null, null, true );33 34 $this->set('data', $data);35 }36 13 37 public function admin_listing($order = null) { 38 39 $this->layout = 'admin'; 40 41 $conditions = array("Entry.user_id"=>$this->othAuth->user('id')); 42 43 $data = $this->Entry->findAll($conditions, $order); 44 45 $this->set('data', $data); 46 47 } 14 public $helpers = array('Ajax', 'Form', 'Fck'); 48 15 49 public function results($string) { 16 public $components = array('Edublog', 'Portal'); 17 18 public function results($string) 19 { 50 20 51 21 $conditions = array("Entry.body"=>$string); … … 56 26 } 57 27 58 public function rss($user_id) { 28 public function rss($user_id) 29 { 59 30 60 31 $this->layout = 'rss'; … … 71 42 72 43 public function search() 73 { 44 { 45 $this->layout = 'portal'; 46 74 47 $this->pageTitle = 'Search Results :: Karamelo E-learning on Web 2.0'; 75 48 76 $this->set(' subjects', $this->Portal->cms()); // Using Portal component49 $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars 77 50 78 $this->set('randomQuote', $this->Portal->quote()); // quote footer 79 80 if (!empty($this->data) ) 51 /* if (!empty($this->data["Entry"]) ) 81 52 { 82 53 $data = $this->Lucene->query($this->data['Entry']['terms']); 83 54 84 55 $this->set('data', $data); 85 } 56 } */ 86 57 } 87 58 88 public function ad d()59 public function admin_add() 89 60 { 90 61 91 62 $this->layout = 'admin'; 92 63 // adds new blog entries 93 if ( empty($this-> params['data']) )64 if ( empty($this->data) ) 94 65 { 95 66 … … 109 80 { 110 81 111 //$this->Sanitize = new Sanitize;82 $this->Sanitize = new Sanitize; 112 83 113 //$this->Sanitize->cleanArray($this->params['data']); //Hopefully this is enough 114 115 116 if ($this->Entry->save($this->params['data'])) 84 $this->Sanitize->paranoid($this->data["Entry"]["title"]); //Hopefully this is enough 85 86 if ($this->Entry->save($this->data["Entry"])) 117 87 { 118 $this->redirect('/entries/listing'); 119 } else { 120 $this->flash('Database error!', '/entries/listing'); 88 $this->msgFlash('Story has been added', '/admin/entries/listing'); 89 } 90 else 91 { 92 $this->flash('Database error!', '/admin/entries/listing'); 121 93 } 122 94 } 123 95 } 96 /** === ADMIN SECTION */ 124 97 125 public function edit($id = null) 98 public function admin_start($order = null) 99 { 100 if (!$this->othAuth->user('id')) 101 { 102 die($this->redirect('/users/general')); // Get Out!!! 103 } 104 105 $this->layout = 'admin'; 106 $this->pageTitle = 'Entries'; 107 108 $conditions = null; 109 $fields = array("id", "title", "body", "category_id"); 110 $data = $this->Entry->findAll( $conditions, $fields, $order, null, null, true ); 111 112 $this->set('data', $data); 113 } 114 115 public function admin_listing($order = null) 116 { 117 118 $this->layout = 'admin'; 119 120 $conditions = array("Entry.user_id"=>$this->othAuth->user('id')); 121 122 $data = $this->Entry->findAll($conditions, $order); 123 124 $this->set('data', $data); 125 126 } 127 128 public function admin_edit($id = null) 126 129 { 127 130 $this->layout = 'admin'; … … 138 141 if ($this->Entry->save($this->data['Entry'])) 139 142 { 140 $this->flash('Your entry has been updated.', '/ entries/listing');143 $this->flash('Your entry has been updated.', '/admin/entries/listing'); 141 144 } 142 145 } 143 }146 } 144 147 145 public functiondelete($id)146 {148 public function admin_delete($id) 149 { 147 150 $this->Entry->del($id); 148 151 149 $this-> flash('The entry with id: '.$id.' has been deleted.', '/entries/listing');152 $this->msgFlash('The entry has been deleted.', '/admin/entries/listing'); 150 153 } 151 154 } -
trunk/app/controllers/news_controller.php
r31 r34 21 21 public function view($page=1) 22 22 { 23 $this->layout = 'portal'; 24 23 25 //pagination 24 26 $total_rows = $this->News->findCount(array("status"=>1)); -
trunk/app/controllers/users_controller.php
r31 r34 61 61 } 62 62 63 public function about($user_id) { 63 public function about($user_id) 64 { 64 65 65 66 $this->pageTitle = 'About me'; … … 75 76 } 76 77 77 public function admin_edit($id = null) { 78 public function admin_edit($id = null) 79 { 78 80 79 81 $this->layout = 'admin'; … … 104 106 } 105 107 106 public function admin_listing($order = null) { 108 public function admin_listing($order = null) 109 { 107 110 108 111 $this->layout = 'admin'; … … 121 124 public function alumni() 122 125 { 126 $this->layout = 'portal'; 127 123 128 $this->pageTitle = 'Students :: Karamelo E-learning on Web 2.0'; 124 129 … … 137 142 public function general() 138 143 { 144 $this->layout = 'portal'; 145 139 146 $this->pageTitle = 'Welcome :: Karamelo E-learning on Web 2.0'; 140 147 141 $this->Cover = new Cover; 142 143 $conditions = array("Cover.status"=>1, "Cover.group_id"=>6); 144 $fields = array("id", "title", "body", "created"); 145 $order = "Cover.id DESC"; 146 $limit = 1; 147 148 $this->set('cover', $this->Cover->findAll($conditions, $fields, $order, $limit)); 149 150 $this->set('Element', $this->Portal->statics()); // Using Portal component 151 152 148 $this->set('Element', $this->Portal->statics()); // Using Portal component 153 149 154 150 /********** News ****/ … … 167 163 $this->set('new', $lastNew); 168 164 169 170 /********** Poll ****/171 172 $this->Poll = new Poll; //Instantiate the model173 174 $conditions = array("status"=>1);175 $fields = array("Poll.id", "Poll.question");176 $order = "Poll.id DESC";177 $limit = 1;178 179 $this->set('poll', $this->Poll->findAll($conditions, $fields, $order, $limit, null, 2));180 181 /********** last blogs Entries ****/182 $this->Entry = new Entry; //Instantiate the model183 184 $conditions = array("Entry.status"=>1);185 $fields = array("Entry.id", "Entry.title", "Entry.created", "Entry.user_id");186 $order = "Entry.id DESC";187 $limit = 10;188 189 $this->set('entries', $this->Entry->findAll($conditions, $fields, $order, $limit, null, 2));190 191 $this->set('Element', $this->Portal->statics()); // Using Portal component192 193 194 165 } 195 166 196 167 public function parents() 197 168 { 169 $this->layout = 'portal'; 170 198 171 $this->pageTitle = 'Students :: Karamelo E-learning on Web 2.0'; 199 172 … … 214 187 public function academics() 215 188 { 189 $this->layout = 'portal'; 190 216 191 $this->pageTitle = 'Students :: Karamelo E-learning on Web 2.0'; 217 192 … … 255 230 $this->set('Element', $this->Portal->statics()); // Using Portal component 256 231 257 232 $this->layout = 'portal'; 258 233 259 234 /********** list teachers ****/ … … 278 253 $this->set('Element', $this->Portal->statics()); // Using Portal component 279 254 280 255 $this->layout = 'portal'; 281 256 } 282 257 … … 287 262 $this->set('Element', $this->Portal->statics()); // Using Portal component 288 263 289 264 $this->layout = 'portal'; 290 265 } 291 266 292 267 293 268 public function bloggers($order = 'username', $desc = 'DESC') 294 { 269 { 270 $this->layout = 'portal'; 271 295 272 $conditions = array("group_id"=>1); 296 273 $fields = array("id", "username", "name", "name_blog", "created"); … … 300 277 301 278 $this->set('Element', $this->Portal->statics()); // Using Portal component 302 303 304 279 } 305 280 public function login() … … 311 286 312 287 313 if (isset($this-> params['data']))288 if (isset($this->data)) 314 289 { 315 $auth_num = $this->othAuth->login($this-> params['data']['User']);290 $auth_num = $this->othAuth->login($this->data['User']); 316 291 317 292 $this->set('auth_msg', $this->othAuth->getMsg($auth_num)); … … 321 296 322 297 public function logout() 323 { 298 { 324 299 $this->othAuth->logout(); 325 300 326 $this->redirect('/ users/general');327 } 328 329 public function noaccess()301 $this->redirect('/news/view'); 302 } 303 304 public function noaccess() 330 305 { 331 $this->flash("You don't have permissions to access this page.",'/users/login');306 $this->flash("You don't have permissions to access this page.",'/users/login'); 332 307 } 333 308 334 309 public function register() 335 310 { 311 $this->layout = 'portal'; 312 313 336 314 $this->Group = new Group; 337 315 … … 345 323 $this->layout = 'ajax'; 346 324 // adds new classroom to database 347 if (!empty($this-> params['data']))325 if (!empty($this->data)) 348 326 { 349 327 //die(print_r($this->params)); … … 356 334 357 335 /** Check Passwd **/ 358 if (strlen($this-> params['data']['User']['passwd']) < 6)336 if (strlen($this->data['User']['passwd']) < 6) 359 337 { 360 338 $message['pwd_worng'] = "The password has less than 6 characters "; 361 339 } 362 340 363 if (strpos($this-> params['data']['User']['username'], ' ')) // nos spaces341 if (strpos($this->data['User']['username'], ' ')) // nos spaces 364 342 { 365 343 $message['username_spaces'] = "Your username should not contain spaces"; … … 367 345 368 346 /** username check **/ 369 if (strlen($this-> params['data']['User']['username']) < 5)347 if (strlen($this->data['User']['username']) < 5) 370 348 { 371 349 $message['pwd_username'] = "The username has less than 5 characters "; … … 373 351 374 352 /** name check **/ 375 if (strlen($this-> params['data']['User']['name']) < 5)353 if (strlen($this->data['User']['name']) < 5) 376 354 { 377 355 $message['pwd_username'] = "The name is too short"; 378 356 } 379 357 380 if (strpos($this-> params['data']['User']['passwd'], ' ')) // nos spaces358 if (strpos($this->data['User']['passwd'], ' ')) // nos spaces 381 359 { 382 360 $message['username_spaces'] = "Your password should not contain spaces"; … … 384 362 385 363 /** description check **/ 386 if (strlen($this-> params['data']['User']['description']) < 5)364 if (strlen($this->data['User']['description']) < 5) 387 365 { 388 366 $message['description_too_short'] = "C'mon pal, talk us about you!"; … … 390 368 391 369 /** email check **/ 392 if ($this->Adds->validEmail($this-> params['data']['User']['email']) === false)370 if ($this->Adds->validEmail($this->data['User']['email']) === false) 393 371 { 394 372 $message['pwd_username'] = "The email is invalid"; … … 396 374 397 375 /** Check the user **/ 398 $username = $this->User->field('username', array("username" => $this-> params['data']['User']['username']));376 $username = $this->User->field('username', array("username" => $this->data['User']['username'])); 399 377 400 378 if ($username != null) … … 404 382 405 383 /** Check the email **/ 406 $email = $this->User->field('email', array("email" => $this-> params['data']['User']['email']));384 $email = $this->User->field('email', array("email" => $this->data['User']['email'])); 407 385 408 386 if ($email != null) … … 411 389 } 412 390 413 if ( $this-> params['data']['User']['group_id'] == 5 && $this->params['data']['User']['code'] != $code)391 if ( $this->data['User']['group_id'] == 5 && $this->data['User']['code'] != $code) 414 392 { 415 393 $message['wrong_code'] = "The teacher's code is incorrect"; … … 424 402 $this->Sanitize = new Sanitize; 425 403 426 $this->Sanitize->cleanArray($this-> params['data']); //Hopefully this is enough427 428 $this-> params['data']['User']['passwd'] = md5($this->params['data']['User']['passwd']); // MD5429 $this-> params['data']['User']['active'] = 0;430 431 if ($this->User->save($this-> params['data']))404 $this->Sanitize->cleanArray($this->data); //Hopefully this is enough 405 406 $this->data['User']['passwd'] = md5($this->data['User']['passwd']); // MD5 407 $this->data['User']['active'] = 0; 408 409 if ($this->User->save($this->data)) 432 410 { 433 411 434 412 $this->Confirm = new Confirm; //confirm model 435 $this-> params['data']['Confirm']['user_id'] = $this->User->getLastInsertID(); //the user id436 $this-> params['data']['Confirm']['secret'] = $this->Adds->genPassword(14);437 438 if ($this->Confirm->save($this-> params['data'])) // put the user in confirm model, this is, waiting confirmation413 $this->data['Confirm']['user_id'] = $this->User->getLastInsertID(); //the user id 414 $this->data['Confirm']['secret'] = $this->Adds->genPassword(14); 415 416 if ($this->Confirm->save($this->data)) // put the user in confirm model, this is, waiting confirmation 439 417 { 440 418 //Send the confirmation email 441 if ( $this->sendMail($this-> params['data']['User']['email'], $this->params['data']['Confirm']['secret']) )419 if ( $this->sendMail($this->data['User']['email'], $this->data['Confirm']['secret']) ) 442 420 { 443 421 $this->set('message', array("Suceess"=>"<h2>You have been registered!</h2> <p>A confirmation email have 444 been sent to: ".$this-> params['data']['User']['email']." </p>"));422 been sent to: ".$this->data['User']['email']." </p>")); 445 423 $this->set('ok', true); 446 424 $this->render('validate', 'ajax'); … … 459 437 } 460 438 439 /** === ADMIN SECTION ==***/ 461 440 462 441 /*** DELETE **/ … … 478 457 } 479 458 /**** AVATAR ***/ 480 public function avatar() { 481 482 //die(print_r($this->params)); 483 459 public function avatar() 460 { 484 461 $this->layout = 'admin'; 485 462 486 if (!empty($this-> params['data']) && is_uploaded_file($this->params['data']['User']['file']['tmp_name']))487 { 488 489 // echo "tmp_name : ". $this-> params['data']['User']['file']['tmp_name'] . "<br />"; // usefull print463 if (!empty($this->data) && is_uploaded_file($this->data['User']['file']['tmp_name'])) 464 { 465 466 // echo "tmp_name : ". $this->data['User']['file']['tmp_name'] . "<br />"; // usefull print 490 467 491 468 $this->Sanitize = new Sanitize; 492 469 493 $this->Sanitize->cleanArray($this-> params['data']); //Hopefully this is enough470 $this->Sanitize->cleanArray($this->data); //Hopefully this is enough 494 471 495 472 /** SUBMITTED INFORMATION - use what you need … … 505 482 $maxfilesize = 2097152; /** 2MB max size */ 506 483 507 $imgfile_name = $this-> params['data']['User']['file']['name'];508 509 $imgfile_size = $this-> params['data']['User']['file']['size'];510 511 $imgfile = $this-> params['data']['User']['file']['tmp_name'];484 $imgfile_name = $this->data['User']['file']['name']; 485 486 $imgfile_size = $this->data['User']['file']['size']; 487 488 $imgfile = $this->data['User']['file']['tmp_name']; 512 489 513 $type = $this-> params['data']['User']['file']['type'];490 $type = $this->data['User']['file']['type']; 514 491 515 492 /** Security: checks to see if file is an image, if not do not allow upload ==*/ … … 560 537 /** Database stuff **/ 561 538 562 $this-> params['data']['User']['avatar'] = $final_filename;563 564 if ($this->User->save($this-> params['data']))565 {539 $this->data['User']['avatar'] = $final_filename; 540 541 if ($this->User->save($this->data)) 542 { 566 543 $this->redirect('/users/edit/'. $this->othAuth->user('id')); 567 }568 569 /** delete the temporary uploaded file **/544 } 545 546 /** delete the temporary uploaded file **/ 570 547 unlink($imgfile); 571 548 … … 573 550 } 574 551 575 private function get_extension($imagetype) { 552 private function get_extension($imagetype) 553 { 576 554 577 555 if ( empty($imagetype) ) -
trunk/app/models/theme.php
