Changeset 308
- Timestamp:
- 03/05/08 10:57:33 (10 months ago)
- Location:
- trunk/app
- Files:
-
- 4 modified
-
app_controller.php (modified) (1 diff)
-
controllers/shares_controller.php (modified) (11 diffs)
-
views/quotes/admin_edit.ctp (modified) (1 diff)
-
views/shares/admin_listing.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/app_controller.php
r285 r308 20 20 $this->Auth->loginError = 'Invalid e-mail / password combination. Please try again'; 21 21 $this->Auth->authorize = 'controller'; 22 $this->Auth->allow( array('view', 'display', 'subscribe', 'recover', 'register', 'insert', 'vote' ) );23 22 $this->Auth->allow( array('view', 'display', 'subscribe', 'recover', 'register', 'insert', 'vote', 'download') ); 23 $this->Auth->autoRedirect = true; 24 24 $this->set('cU', $this->Auth->user()); // $cU current user array to use in the views if user logged 25 25 } -
trunk/app/controllers/shares_controller.php
r247 r308 6 6 */ 7 7 8 9 8 uses('sanitize'); 10 9 … … 13 12 public $helpers = array('Gags'); 14 13 15 public $components = array('Edublog', 'Portal' );14 public $components = array('Edublog', 'Portal', 'Adds'); 16 15 17 16 public function isAuthorized() … … 19 18 if (isset($this->params[Configure::read('Routing.admin')])) 20 19 { 21 if ($this->Auth->user('group_id') != 1)22 {23 return false;24 }25 }26 return true;20 if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2) 21 { 22 return true; 23 } 24 } 25 return false; 27 26 } 28 27 … … 35 34 $file = $this->Share->field('file', $conditions); 36 35 37 $this->redirect("/files/userfiles/".$file); 36 if (!$file) 37 { 38 $this->redirect('/'); 39 } 40 else 41 { 42 $this->redirect("/files/userfiles/".$file); 43 } 38 44 } 39 45 … … 45 51 $fields = array("id", "file", "description", "secret"); 46 52 $order = "id DESC"; 47 $limit = 20;48 49 $this->set('data', $this->Share->findAll($conditions, $fields, $order, $limit , null, true));53 $limit = 30; 54 55 $this->set('data', $this->Share->findAll($conditions, $fields, $order, $limit)); 50 56 51 57 $this->layout = $this->Edublog->layout($user_id); … … 57 63 === ADMIN METHOD === 58 64 **/ 59 public function admin_listing()60 {61 $this->pageTitle = $this-> othAuth->user('username') . '\'s Shares';65 public function admin_listing() 66 { 67 $this->pageTitle = $this->Auth->user('username') . '\'s Shares'; 62 68 63 69 $this->layout = 'admin'; 64 70 65 $conditions = array("Share.user_id"=>$this-> othAuth->user('id'));71 $conditions = array("Share.user_id"=>$this->Auth->user('id')); 66 72 $fields = array("id", "file", "description", "created", "secret", "public"); 67 73 $order = "Share.id DESC"; … … 74 80 { 75 81 $this->layout = 'admin'; 76 $this->Subject = new Subject; 77 $this->set('optionElements', $this->Subject->generateList(null, 'title')); 78 82 79 83 if (!empty($this->data["Share"]) && is_uploaded_file($this->data['Share']['file']['tmp_name'])) 80 84 { … … 84 88 $this->Sanitize = new Sanitize; 85 89 86 $this->Sanitize->clean Array($this->data["Share"]); //Hopefully this is enough90 $this->Sanitize->clean($this->data["Share"]); //Hopefully this is enough 87 91 88 92 /* SUBMITTED INFORMATION - use what you need … … 129 133 } 130 134 131 $conditions = array("user_id" => $this-> othAuth->user('id'));135 $conditions = array("user_id" => $this->Auth->user('id')); 132 136 133 137 $order = "Share.id DESC"; … … 146 150 } 147 151 148 $Name = $this-> othAuth->user('username') . "_" . $next_id . '.'. $extension;152 $Name = $this->Auth->user('username') . "_" . $next_id . '.'. $extension; 149 153 150 154 /** setup final file location and name */ … … 172 176 $this->data['Share']['file'] = $final_filename; 173 177 $this->data['Share']['secret'] = $this->Adds->genPassword(15); 174 $this->data['Share']['user_id'] = $this-> othAuth->user('id');178 $this->data['Share']['user_id'] = $this->Auth->user('id'); 175 179 176 180 if ($this->Share->save($this->data["Share"])) -
trunk/app/views/quotes/admin_edit.ctp
r307 r308 4 4 echo $html->getCrumbs(' / '); 5 5 6 echo $form->create('Quote' , array('url' => 'quotes/admin_edit'));6 echo $form->create('Quote'); 7 7 echo $form->hidden('Quote.id'); 8 8 ?> -
trunk/app/views/shares/admin_listing.ctp
r251 r308 1 <div class="title_section"><?php echo $ othAuth->user('username'); ?>'s shared files</div>1 <div class="title_section"><?php echo $cU['User']['username']; ?>'s shared files</div> 2 2 3 <?php echo $html->link($html->image('actions/new.png', array("alt"=>"Add new share", "title"=>"Add new share")), '#', array("onclick"=>"hU()"), false, false); ?></p> 4 5 <?php $session->flash(); ?> 3 <?php 4 echo $html->para(null, 5 $html->link( 6 $html->image('actions/new.png', array('alt'=>'Add new share', 'title'=>'Add new share')), 7 '#', array('onclick'=>'hU()'), false, false 8 ) 9 ); 10 $session->flash(); 11 ?></p> 6 12 7 13 <div id="addshare" style="display:none"> 8 14 9 <?php echo $ html->formTag('/admin/shares/add/','post', array("enctype"=>"multipart/form-data") ); ?>15 <?php echo $form->create('Share', array('type'=>'file', 'action'=>'admin_add') ); ?> 10 16 <fieldset> 11 17 <legend>Upload Share</legend> 12 18 <?php 13 echo $form->label Tag('Share/file', 'File:' );14 echo $ html->file('Share/file');15 echo $ html->tagErrorMsg('Share/file', 'Title is required.');19 echo $form->label('Share.file', 'File:' ); 20 echo $form->file('Share.file'); 21 echo $form->error('Share.file', 'Title is required.'); 16 22 17 echo $form->labelTag('Share/description', 'Description:' ); 18 echo $html->input('Share/description', array("size"=>40)); 19 echo $html->tagErrorMsg('Share/description', 'Title is required.'); 20 21 echo $html->submit('Upload'); 22 ?> 23 </fieldset> 24 </form> 23 echo $form->label('Share.description', 'Description:' ); 24 echo $form->input('Share.description', array("size"=>40)); 25 echo $form->error('Share.description', 'Title is required.'); 26 echo '</fieldset>'; 27 echo $form->end('Upload'); 28 ?> 25 29 </div> 26 30
