Changeset 292

Show
Ignore:
Timestamp:
02/29/08 21:14:53 (10 months ago)
Author:
aarkerio
Message:

Upate FCKeditor

Location:
trunk/app
Files:
216 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/entries_controller.php

    r291 r292  
    1818    if (isset( $this->params[Configure::read('Routing.admin')] ))  
    1919    { 
    20     if ($this->Auth->user('group_id') == 1)  
     20        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 )  // admin and teachers 
    2121        { 
    2222        return true; 
     
    6060      $this->pageTitle = 'Search Results :: Karamelo E-learning on Web 2.0'; 
    6161       
    62       $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars 
     62      $this->Portal->statics(); // Charge Portal components aka Sidebars 
    6363       
    64       // 
    6564      $this->Sanitize = new Sanitize; 
    6665       
    6766      $this->Sanitize->paranoid($this->data["Entry"]["terms"]);  
    6867       
    69         $this->set('data', $this->Search->getRows($this->data["Entry"]["terms"])); 
     68      $this->set('data', $this->Search->getRows($this->data["Entry"]["terms"])); 
    7069 } 
    7170  
     
    7473 public function admin_add() 
    7574 { 
    76       $this->layout    = 'admin'; 
     75    $this->layout    = 'admin'; 
    7776 
    78        $this->set('subjects', $this->Entry->Subject->generateList(null,'title')); 
     77    $this->set('subjects', Set::combine($this->Entry->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 
    7978       
    80       if ( !empty($this->data["Entry"]) )   
    81       { 
     79    if ( !empty($this->data["Entry"]) )   
     80    { 
    8281        $this->Sanitize = new Sanitize; 
    8382       
     
    134133  public function admin_edit($id = null) 
    135134  { 
    136      $this->layout    = 'admin'; 
    137       
    138      $this->set('subjects', $this->Entry->Subject->generateList(null,'title')); 
     135     $this->layout    = 'admin';   
     136     
     137     $this->set('subjects', Set::combine($this->Entry->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 
    139138      
    140139     if (empty($this->data["Entry"])) 
     
    144143     } 
    145144     else 
    146        {  
     145     {  
    147146         $this->Sanitize = new Sanitize; 
    148147       
     
    150149          
    151150         $this->Sanitize->html($this->data["Entry"]["body"]); 
     151 
     152         $this->data["Entry"]["user_id"] = $this->Auth->user('id'); 
    152153 
    153154         if ($this->Entry->save($this->data['Entry'])) 
  • trunk/app/controllers/images_controller.php

    r247 r292  
    44*  Manuel Montoya 2002-2008  
    55*  Chipotle Software TM 
    6 *  GPL manuel<at>mononeurona<dot>org 
     6*  GPL manuel<arroba>mononeurona<punto>org 
    77*/  
    88  
     
    1414     
    1515  public $components    = array('Adds'); 
    16    
     16 
    1717  public function isAuthorized()  
    18   { 
    19     if ($this->action == 'delete')  
    20       { 
    21     if ($this->Auth->user('group_id') == 1)  
    22           { 
     18  {       
     19    if (isset( $this->params[Configure::read('Routing.admin')] ))  
     20    { 
     21        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 )  // admin and teachers 
     22        { 
    2323        return true; 
    24           } else { 
    25         return false; 
    26           } 
    27       } 
    28   
    29     return true; 
    30   } 
     24        }  
     25    }  
     26    return false;  // go away !! 
     27 } 
    3128   
    3229  public function index($id = null) 
     
    5754        $this->pageTitle = 'Your Images'; 
    5855         
    59         $conditions = array("user_id"=>$this->othAuth->user('id')); 
     56        $conditions = array("user_id"=>$this->Auth->user('id')); 
    6057         
    6158        $fields     = array("id", "file", "user_id"); 
     
    8279    $this->Sanitize = new Sanitize; 
    8380     
    84     $this->Sanitize->cleanArray($this->data['Image']); 
     81    $this->Sanitize->clean($this->data['Image']); 
    8582     
    8683    /** SUBMITTED INFORMATION - use what you need 
     
    144141    $extension   = $this->Adds->last3chars($imgfile_name); 
    145142     
    146     $Name        = strtolower($this->othAuth->user('username') . "_" . $next_id . '.' .$extension); 
     143    $Name        = strtolower($this->Auth->user('username') . "_" . $next_id . '.' .$extension); 
    147144     
    148145    /** setup final file location and name */ 
     
    173170    
    174171   $this->data['Image']['file']    = $final_filename; 
    175    $this->data['Image']['user_id'] = $this->othAuth->user('id'); 
     172   $this->data['Image']['user_id'] = $this->Auth->user('id'); 
    176173    
    177174   $this->Image->create(); 
     
    187184 
    188185  /*** DELETE  **/  
    189   public function admin_delete($id) 
     186  public function admin_delete() 
    190187  { 
    191     $file = $this->Image->field("Image.file", array("Image.id"=>$id)); 
    192      
    193     $this->Image->del($id); 
     188    $file = $this->Image->field("Image.file", array("Image.id"=>$this->data['Image']['id'])); 
     189     
     190    $this->Image->del($this->data['Image']['id']); 
    194191     
    195192    /** delete image and thumb from hard disk**/ 
  • trunk/app/controllers/users_controller.php

    r284 r292  
    1111class UsersController extends AppController 
    1212{ 
    13   public $helpers          = array('Ajax', 'Fck', 'Gags'); 
    14      
    15   public $components       = array('Edublog', 'Portal', 'Email', 'Adds'); 
    16  
    17   public function beforeFiler() 
    18   { 
    19     $this->Auth->allow( array('entry', 'about', 'bloggers', 'blog', 'recover', 'directory') ); 
    20     parent::beforeFilter(); 
    21   }   
    22  
    23   public function isAuthorized()  
    24   { 
    25            if (isset($this->params[Configure::read('Routing.admin')