Changeset ee4c2b7fedeac65c7bf3af2de933963981702433

Show
Ignore:
Timestamp:
01/28/12 16:33:14 (4 months ago)
Author:
Xemle <xemle@phtagr.org>
Children:
a42ace5079b711cff1c0078740ad0bb7a735e0fc
Parents:
0fb8d7c9464f805d666366ee2f31f047ee138b3a
git-committer:
Xemle <xemle@phtagr.org> / 2012-01-28T16:33:14Z+0100
Message:

Migration to CakePHP 2.0 almost complete

Files:
74 modified

Legend:

Unmodified
Added
Removed
  • Controller/AppController.php

    r3605ef4 ree4c2b7f  
    3838    parent::beforeFilter(); 
    3939    $this->_checkSession(); 
    40     $this->Feed->add('/explorer/rss', array('title' => __('Recent photos', true))); 
    41     $this->Feed->add('/explorer/media', array('title' =>  __('Media RSS of recent photos', true), 'id' => 'gallery')); 
    42     $this->Feed->add('/comment/rss', array('title' => __('Recent comments', true))); 
     40    $this->Feed->add('/explorer/rss', array('title' => __('Recent photos'))); 
     41    $this->Feed->add('/explorer/media', array('title' =>  __('Media RSS of recent photos'), 'id' => 'gallery')); 
     42    $this->Feed->add('/comment/rss', array('title' => __('Recent comments'))); 
    4343     
    4444    $this->_configureEmail(); 
  • Controller/BrowserController.php

    r3605ef4 ree4c2b7f  
    3636    parent::beforeFilter(); 
    3737    $this->subMenu = array( 
    38       'import' => __("Import Files", true), 
    39       'upload' => __("Upload", true), 
    40       'sync' => __("Meta Data Sync", true), 
     38      'import' => __("Import Files"), 
     39      'upload' => __("Upload"), 
     40      'sync' => __("Meta Data Sync"), 
    4141      ); 
    4242 
     
    5353    } 
    5454 
    55     $this->pageTitle = __('My Files', true); 
     55    $this->pageTitle = __('My Files'); 
    5656    $this->layout = 'backend'; 
    5757  } 
     
    265265  function import() { 
    266266    $path = $this->_getPathFromUrl(); 
    267     if (empty($this->data)) { 
     267    if (empty($this->request->data)) { 
    268268      Logger::warn("Empty post data"); 
    269269      $this->redirect('index/'.$path); 
     
    274274    $files = array(); 
    275275    $toRead = array(); 
    276     foreach ($this->data['Browser']['import'] as $file) { 
     276    foreach ($this->request->data['Browser']['import'] as $file) { 
    277277      if (!$file) { 
    278278        continue; 
     
    298298      } 
    299299    } 
    300     $this->Session->setFlash(sprintf(__("Imported %d files (%d) errors)", true), $readCount, $errorCount)); 
     300    $this->Session->setFlash(__("Imported %d files (%d) errors)", $readCount, $errorCount)); 
    301301 
    302302    $this->redirect('index/'.$path); 
     
    313313      Logger::warn("Deny access to file: $fsPath"); 
    314314    } else { 
    315       $this->Session->setFlash(sprintf(__("Media %d was unlinked successfully", true), $file['File']['media_id'])); 
     315      $this->Session->setFlash(__("Media %d was unlinked successfully", $file['File']['media_id'])); 
    316316      $this->Media->unlinkFile($file['File']['media_id'], $file['File']['id']); 
    317317    } 
     
    330330      if ($this->FileManager->delete($fsPath)) { 
    331331        if ($isDir) { 
    332           $this->Session->setFlash(__('Deleted directory successfully', true)); 
     332          $this->Session->setFlash(__('Deleted directory successfully')); 
    333333        } else { 
    334           $this->Session->setFlash(__('Deleted file successfully', true)); 
     334          $this->Session->setFlash(__('Deleted file successfully')); 
    335335        } 
    336336      } else { 
    337         $this->Session->setFlash(__('Could not delete file or directory', true)); 
     337        $this->Session->setFlash(__('Could not delete file or directory')); 
    338338      } 
    339339    } 
     
    385385      $data['unsynced'] = $this->Media->find('count', array('conditions' => $conditions)); 
    386386    } 
    387     $this->data = $data; 
     387    $this->request->data = $data; 
    388388  } 
    389389 
     
    391391    $user = $this->getUser(); 
    392392    $userId = $this->getUserId(); 
    393     $this->data = $user; 
     393    $this->request->data = $user; 
    394394    $external = (FILE_FLAG_EXTERNAL); 
    395395 
     
    419419    if (!$fsPath) { 
    420420      Logger::warn("Invalid path to create folder"); 
    421       $this->Session->setFlash(__("Invalid path to create folder", true)); 
     421      $this->Session->setFlash(__("Invalid path to create folder")); 
    422422      $this->redirect("index"); 
    423423    } 
    424424    if ($this->FileManager->isExternal($fsPath)) { 
    425       $this->Session->setFlash(sprintf(__("Could not create folder here: %s", true), $path)); 
     425      $this->Session->setFlash(__("Could not create folder here: %s", $path)); 
    426426      Logger::warn("Could not create folder in external path: $fsPath"); 
    427427      $this->redirect("index/".$path); 
    428428    } 
    429429 
    430     if (!empty($this->data['Folder']['name'])) { 
     430    if (!empty($this->request->data['Folder']['name'])) { 
    431431      $folder = new Folder($fsPath); 
    432       $name = $this->data['Folder']['name']; 
     432      $name = $this->request->data['Folder']['name']; 
    433433 
    434434      $newFolder = Folder::slashTerm($fsPath).$name; 
     
    439439      } else { 
    440440        Logger::err("Could not create folder $name in $fsPath"); 
    441         $this->Session->setFlash(__("Could not create folder", true)); 
     441        $this->Session->setFlash(__("Could not create folder")); 
    442442        $this->redirect('folder/'.$path); 
    443443      } 
     
    456456      return false; 
    457457    } elseif (!$this->FileManager->canWrite($this->Upload->getSize())) { 
    458       $this->Session->setFlash(__("Your upload quota is exceeded", true)); 
     458      $this->Session->setFlash(__("Your upload quota is exceeded")); 
    459459      Logger::warn("User upload quota exceeded. Upload denied."); 
    460460      return false; 
     
    563563    if (!$fsPath) { 
    564564      Logger::warn("Invalid path for upload"); 
    565       $this->Session->setFlash(__("Invalid path for upload", true)); 
     565      $this->Session->setFlash(__("Invalid path for upload")); 
    566566      $this->redirect("index"); 
    567567    } 
    568568    // Check for internal path 
    569569    if ($this->FileManager->isExternal($fsPath)) { 
    570       $this->Session->setFlash(sprintf(__("Could not upload here: %s", true), $path)); 
     570      $this->Session->setFlash(__("Could not upload here: %s", $path)); 
    571571      Logger::warn("Could not upload in external path: $fsPath"); 
    572572      $this->redirect("index/".$path); 
    573573    } 
    574     if (!empty($this->data) && $this->Upload->isUpload()) { 
     574    if (!empty($this->request->data) && $this->Upload->isUpload()) { 
    575575      $files = $this->_upload($fsPath); 
    576576 
    577577      $fileCount = count($files); 
    578578      $extractedCount = 0; 
    579       if ($this->data['File']['extract']) { 
     579      if ($this->request->data['File']['extract']) { 
    580580        $zips = $this->_extract($fsPath, $files); 
    581581        if ($zips) { 
     
    589589      }   
    590590      if ($extractedCount) { 
    591         $this->Session->setFlash(sprintf(__("Uploaded %d and %d extraced file(s)", true), $fileCount, $extractedCount)); 
     591        $this->Session->setFlash(__("Uploaded %d and %d extraced file(s)", $fileCount, $extractedCount)); 
    592592      } else { 
    593         $this->Session->setFlash(sprintf(__("Uploaded %d file(s)", true), $fileCount)); 
     593        $this->Session->setFlash(__("Uploaded %d file(s)", $fileCount)); 
    594594      } 
    595595    } 
     
    602602    if (!$root) { 
    603603      Logger::err("Invalid user upload directory"); 
    604       $this->Session->setFlash(__("Error: Invalid upload directory", true)); 
     604      $this->Session->setFlash(__("Error: Invalid upload directory")); 
    605605      return false; 
    606606    } 
     
    610610    if (!$folder) { 
    611611      Logger::err("Daily upload directory not created"); 
    612       $this->Session->setFlash(__("Error: Invalid upload directory", true)); 
     612      $this->Session->setFlash(__("Error: Invalid upload directory")); 
    613613      return false; 
    614614    } 
     
    617617 
    618618  function quickupload() { 
    619     if (!empty($this->data)) { 
     619    if (!empty($this->request->data)) { 
    620620      if (!$this->Upload->isUpload()) { 
    621621        Logger::info("No upload data"); 
    622         $this->Session->setFlash(__("No files uploaded or upload errors", true)); 
     622        $this->Session->setFlash(__("No files uploaded or upload errors")); 
    623623        $this->redirect($this->action); 
    624624      } 
     
    637637      } 
    638638      if (!$files) { 
    639         $this->Session->setFlash(__("No files uploaded", true)); 
     639        $this->Session->setFlash(__("No files uploaded")); 
    640640        $this->redirect($this->action); 
    641641      } else {  
     
    645645      $readed = $this->FilterManager->readFiles($files); 
    646646      $errors = $this->FilterManager->errors; 
    647       $this->Session->setFlash(sprintf(__("Uploaded %d files with %d errors.", true), count($readed), count($errors))); 
     647      $this->Session->setFlash(__("Uploaded %d files with %d errors.", count($readed), count($errors))); 
    648648      $this->set('imports', $readed); 
    649649      $this->set('errors', $errors); 
  • Controller/CommentsController.php

    r1a41cea ree4c2b7f  
    5555  function view($id = null) { 
    5656    if (!$id) { 
    57       $this->Session->setFlash(__('Invalid Comment.', true)); 
     57      $this->Session->setFlash(__('Invalid Comment.')); 
    5858      $this->redirect(array('action'=>'index')); 
    5959    } 
     
    6262 
    6363  function add() { 
    64     if (!empty($this->data) && isset($this->data['Media']['id'])) { 
    65       $mediaId = intval($this->data['Media']['id']); 
     64    if (!empty($this->request->data) && isset($this->request->data['Media']['id'])) { 
     65      $mediaId = intval($this->request->data['Media']['id']); 
    6666      $user = $this->getUser(); 
    6767      $userId = $this->getUserId(); 
     
    7878 
    7979      // Check capatcha if required 
    80       if (($auth & COMMENT_AUTH_CAPTCHA) > 0 && (!$this->Session->check('captcha') || $this->data['Captcha']['verification'] != $this->Session->read('captcha'))) { 
     80      if (($auth & COMMENT_AUTH_CAPTCHA) > 0 && (!$this->Session->check('captcha') || $this->request->data['Captcha']['verification'] != $this->Session->read('captcha'))) { 
    8181        $this->Session->setFlash("Verification failed"); 
    82         Logger::warn("Captcha verification failed: ".$this->data['Captcha']['verification']." != ".$this->Session->read('captcha')); 
     82        Logger::warn("Captcha verification failed: ".$this->request->data['Captcha']['verification']." != ".$this->Session->read('captcha')); 
    8383        $this->Session->delete('captcha'); 
    84         $this->Session->write('Comment.data', $this->data); 
     84        $this->Session->write('Comment.data', $this->request->data); 
    8585        $this->Session->write('Comment.validationErrors', $this->Comment->validationErrors); 
    8686        $this->redirect("/images/view/$mediaId/{$this->namedArgs}");  
     
    102102 
    103103      $this->Comment->create(); 
    104       $this->data['Comment']['media_id'] = $mediaId; 
    105       $this->data['Comment']['date'] = date("Y-m-d H:i:s", time()); 
     104      $this->request->data['Comment']['media_id'] = $mediaId; 
     105      $this->request->data['Comment']['date'] = date("Y-m-d H:i:s", time()); 
    106106      uses('Sanitize'); 
    107       $this->data['Comment']['text'] = Sanitize::html($this->data['Comment']['text']); 
     107      $this->request->data['Comment']['text'] = Sanitize::html($this->request->data['Comment']['text']); 
    108108      if (($auth & COMMENT_AUTH_NAME) == 0) { 
    109         $this->data['Comment']['user_id'] = $user['User']['id']; 
    110         $this->data['Comment']['name'] = $user['User']['username']; 
    111         $this->data['Comment']['email'] = $user['User']['email']; 
    112       } 
    113       if ($this->Comment->save($this->data)) { 
     109        $this->request->data['Comment']['user_id'] = $user['User']['id']; 
     110        $this->request->data['Comment']['name'] = $user['User']['username']; 
     111        $this->request->data['Comment']['email'] = $user['User']['email']; 
     112      } 
     113      if ($this->Comment->save($this->request->data)) { 
    114114        $commentId = $this->Comment->getLastInsertID(); 
    115         $this->Session->setFlash(__('The Comment has been saved', true)); 
     115        $this->Session->setFlash(__('The Comment has been saved')); 
    116116        Logger::info("New comment of media $mediaId"); 
    117117        // Send email notification of other media owners 
     
    121121        $this->_sendNotifies($mediaId, $commentId); 
    122122      } else { 
    123         $this->Session->setFlash(__('The Comment could not be saved. Please, try again.', true)); 
     123        $this->Session->setFlash(__('The Comment could not be saved. Please, try again.')); 
    124124        Logger::err("Could not save comment to media $mediaId"); 
    125125        Logger::trace($this->Comment->validationErrors); 
    126         $this->Session->write('Comment.data', $this->data); 
     126        $this->Session->write('Comment.data', $this->request->data); 
    127127        $this->Session->write('Comment.validationErrors', $this->Comment->validationErrors); 
    128128      } 
     
    219219  function delete($id = null) { 
    220220    if (!$id) { 
    221       $this->Session->setFlash(__('Invalid id for Comment', true)); 
     221      $this->Session->setFlash(__('Invalid id for Comment')); 
    222222      $this->redirect("/explorer"); 
    223223    } 
     
    233233    if ((isset($comment['User']['id']) && $comment['User']['id'] == $userId) || ($comment['Media']['user_id'] == $userId) || ($this->getUserRole() == ROLE_ADMIN)) { 
    234234      if ($this->Comment->delete($id)) { 
    235         $this->Session->setFlash(__('Comment deleted', true)); 
     235        $this->Session->setFlash(__('Comment deleted')); 
    236236        Logger::info("Delete comment {$comment['Comment']['id']} of media {$comment['Media']['id']}"); 
    237237      } 
     
    250250    $this->layoutPath = 'rss'; 
    251251    $conditions = $this->Media->buildAclConditions($this->getUser()); 
    252     $this->data = $this->Comment->find('all', array('conditions' => $conditions, 'order' => 'Comment.date DESC', 'limit' => 20)); 
     252    $this->request->data = $this->Comment->find('all', array('conditions' => $conditions, 'order' => 'Comment.date DESC', 'limit' => 20)); 
    253253 
    254254    if (Configure::read('debug') > 1) { 
  • Controller/Component/BaseFilterComponent.php

    r3605ef4 ree4c2b7f  
    4040    } 
    4141    $this->Manager =& $manager; 
     42    $this->Media =& $manager->controller->Media; 
     43    $this->MyFile =& $manager->controller->MyFile; 
    4244    return true; 
    4345  } 
  • Controller/Component/FileManagerComponent.php

    r3605ef4 ree4c2b7f  
    3333      $this->MyFile = $controller->MyFile; 
    3434    } else { 
    35       App::import('model', 'MyFile'); 
     35      App::uses('Model', 'MyFile'); 
    3636      $this->MyFile = new MyFile(); 
    3737    } 
     
    5858    } 
    5959 
    60     $id = $this->MyFile->fileExists($filename); 
     60    $id = $this->controller->MyFile->fileExists($filename); 
    6161    if ($id) { 
    6262      Logger::verbose("File $filename already exists (id $id)"); 
     
    6767      $flag |= FILE_FLAG_EXTERNAL; 
    6868    } 
    69     $file = $this->MyFile->create($filename, $userId, $flag); 
    70  
    71     if ($this->MyFile->save($file)) { 
    72       $id = $this->MyFile->getLastInsertID(); 
     69    $file = $this->controller->MyFile->create($filename, $userId, $flag); 
     70 
     71    if ($this->controller->MyFile->save($file)) { 
     72      $id = $this->controller->MyFile->getLastInsertID(); 
    7373      Logger::verbose("Insert file $filename to database (id $id)"); 
    7474      return $id; 
     
    8787      if (is_dir($file)) { 
    8888        $deleteFolder = !$this->isExternal($file); 
    89         return $this->MyFile->deletePath($file, $deleteFolder); 
    90       } 
    91       $id = $this->MyFile->fileExists($file); 
     89        return $this->controller->MyFile->deletePath($file, $deleteFolder); 
     90      } 
     91      $id = $this->controller->MyFile->fileExists($file); 
    9292      if (!$id) { 
    9393        Logger::warn("Could not find file $file"); 
     
    102102      return false; 
    103103    } 
    104     return $this->MyFile->delete($id); 
     104    return $this->controller->MyFile->delete($id); 
    105105  } 
    106106 
     
    164164    } 
    165165 
    166     $current = $this->MyFile->countBytes($user['User']['id'], false); 
     166    $current = $this->controller->MyFile->countBytes($user['User']['id'], false); 
    167167    $quota = $user['User']['quota']; 
    168168    if ($current + $size <= $quota) { 
     
    213213      } else { 
    214214        // Copy all properties 
    215         $srcFile = $this->MyFile->findByFilename($file); 
     215        $srcFile = $this->controller->MyFile->findByFilename($file); 
    216216        if (!$srcFile) { 
    217217          Logger::warn("Could not found source '$file' in database"); 
     
    241241      return false; 
    242242    } 
    243     return $this->MyFile->move($src, $dst); 
     243    return $this->controller->MyFile->move($src, $dst); 
    244244  } 
    245245 
  • Controller/Component/FilterManagerComponent.php

    r3605ef4 ree4c2b7f  
    2121 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. 
    2222 */ 
     23 
     24if (!App::import('Component', 'BaseFilter')) { 
     25  Logger::error("Could not load BaseFilter"); 
     26} 
    2327 
    2428class FilterManagerComponent extends Component { 
     
    4347  function initialize(&$controller) { 
    4448    $this->controller =& $controller; 
    45     if (!App::import('Component', 'BaseFilter')) { 
    46       Logger::err("Could not find filter with name 'BaseFilter'"); 
    47       return false; 
    48     } 
    4949    if (!isset($controller->MyFile) || !isset($controller->Media)) { 
    5050      Logger::err("Model MyFile and Media is not found"); 
     
    273273      return false; 
    274274    } 
    275     if (!$this->MyFile->fileExists($filename) && !$this->FileManager->add($filename)) { 
     275    if (!$this->controller->MyFile->fileExists($filename) && !$this->FileManager->add($filename)) { 
    276276      Logger::err("Could not add file $filename"); 
    277277      $this->addError($filename, 'FileAddError'); 
     
    279279    } 
    280280 
    281     $file = $this->MyFile->findByFilename($filename); 
     281    $file = $this->controller->MyFile->findByFilename($filename); 
     282    if (!$file) { 
     283      Logger::err("Could not find file with filename: " . $filename); 
     284    } 
    282285 
    283286    // Check changes 
     
    292295    } 
    293296 
    294     if ($this->MyFile->hasMedia($file)) { 
    295       $media = $this->Media->findById($file['File']['media_id']); 
     297    if ($this->controller->MyFile->hasMedia($file)) { 
     298      $media = $this->controller->Media->findById($file['File']['media_id']); 
    296299      $readed = strtotime($file['File']['readed']); 
    297300      if ($readed && !$forceRead) { 
     
    319322    $filterMissing = false; 
    320323    foreach ($media['File'] as $file) { 
    321       $file = $this->MyFile->findById($file['id']); 
    322       $filename = $this->MyFile->getFilename($file); 
     324      $file = $this->controller->MyFile->findById($file['id']); 
     325      $filename = $this->controller->MyFile->getFilename($file); 
    323326      $filter = $this->getFilterByExtension($filename); 
    324327      if (!$filter) { 
  • Controller/Component/GpsFilterComponent.php

    r1a41cea ree4c2b7f  
    5555    //Logger::trace($options); 
    5656 
    57     $filename = $this->MyFile->getFilename($file); 
     57    $filename = $this->controller->MyFile->getFilename($file); 
    5858    if (!$this->Nmea->readFile($filename)) { 
    5959      Logger::warn('Could not read file $filename'); 
     
    8080    } 
    8181    Logger::trace($conditions); 
    82     $this->Media->unbindAll(); 
    83     $mediaSet = $this->Media->find('all', array('conditions' => $conditions)); 
     82    $this->controller->Media->unbindAll(); 
     83    $mediaSet = $this->controller->Media->find('all', array('conditions' => $conditions)); 
    8484    if (!count($mediaSet)) { 
    8585      Logger::info("No images found for GPS interval"); 
     
    100100      $media['Media']['longitude'] = $position['longitude']; 
    101101      $media['Media']['flag'] |= MEDIA_FLAG_DIRTY; 
    102       if ($this->Media->save($media['Media'], true, array('latitude', 'longitude', 'flag'))) { 
     102      if ($this->controller->Media->save($media['Media'], true, array('latitude', 'longitude', 'flag'))) { 
    103103        Logger::debug("Update GPS position of image {$media['Media']['id']} to {$position['latitude']}/{$position['longitude']}"); 
    104104      } else { 
  • Controller/Component/ImageFilterComponent.php

    re449ecc0 ree4c2b7f  
    3232                        LOCATION_COUNTRY => 'Country-PrimaryLocationName'); 
    3333 
    34   function initialize(&$controller) { 
    35     $this->controller =& $controller; 
    36   } 
    37  
    3834  function getName() { 
    3935    return "Image"; 
     
    7571        $user = $this->controller->getUser(); 
    7672      } 
    77       $media = $this->Media->addDefaultAcl(&$media, &$user); 
     73      $media = $this->controller->Media->addDefaultAcl(&$media, &$user); 
    7874       
    7975      $isNew = true; 
     
    106102    if ($isNew) { 
    107103      $mediaId = $this->Media->getLastInsertID(); 
    108       if (!$this->MyFile->setMedia($file, $mediaId)) { 
     104      if (!$this->controller->MyFile->setMedia($file, $mediaId)) { 
    109105        $this->Media->delete($mediaId); 
    110106        $this->FilterManager->addError($filename, 'FileSaveError'); 
     
    117113      Logger::verbose("Updated media (id ".$media['Media']['id'].")"); 
    118114    } 
    119     $this->MyFile->updateReaded($file); 
    120     $this->MyFile->setFlag($file, FILE_FLAG_DEPENDENT); 
     115    $this->controller->MyFile->updateReaded($file); 
     116    $this->controller->MyFile->setFlag($file, FILE_FLAG_DEPENDENT); 
    121117    return $media; 
    122118  } 
     
    327323    $v['model'] = $this->_extract($data, 'jpg/exif/IFD0/Model', null); 
    328324    $v['iso'] = $this->_extract($data, 'jpg/exif/EXIF/ISOSpeedRatings', null); 
    329     Logger::debug($data); 
     325    //Logger::debug($data); 
    330326    $v['caption'] = $this->_extract($data, 'jpg/exif/EXIF/ISOSpeedRatings', null); 
    331327 
     
    385381      return false; 
    386382    }  
    387     $filename = $this->MyFile->getFilename($file); 
     383    $filename = $this->controller->MyFile->getFilename($file); 
    388384    if (!file_exists($filename) || !is_writeable(dirname($filename)) || !is_writeable($filename)) { 
    389385      $id = isset($media['Media']['id']) ? $media['Media']['id'] : 0; 
     
    430426    } 
    431427     
    432     $this->MyFile->update($file); 
     428    $this->controller->MyFile->update($file); 
    433429    if (!$this->Media->deleteFlag($media, MEDIA_FLAG_DIRTY)) { 
    434430      $this->controller->warn("Could not update image data of media {$media['Media']['id']}"); 
  • Controller/Component/MenuComponent.php

    r3605ef4 ree4c2b7f  
    4444  function setBasicMainMenu() { 
    4545    $controllers = array( 
    46       'options' => __('Account Settings', true), 
    47       'groups' => __('Groups', true), 
    48       'users' => __('Users', true), 
    49       'guests' => __('Guests', true), 
    50       'browser' => __('Media Files', true) 
     46      'options' => __('Account Settings'), 
     47      'groups' => __('Groups'), 
     48      'users' => __('Users'), 
     49      'guests' => __('Guests'), 
     50      'browser' => __('Media Files') 
    5151      ); 
    5252    if ($this->controller->hasRole(ROLE_SYSOP)) { 
    53       $controllers['system'] = __("System", true); 
     53      $controllers['system'] = __("System"); 
    5454    } 
    5555  
  • Controller/Component/SimpleImageFilterComponent.php

    r1a41cea ree4c2b7f  
    4545  function read($file, &$media, $options = array()) { 
    4646    $options = am(array('noSave' => false), $options); 
    47     $filename = $this->MyFile->getFilename($file); 
     47    $filename = $this->controller->MyFile->getFilename($file); 
    4848 
    4949    $isNew = false; 
    5050    if (!$media) { 
    51       $media = $this->Media->create(array( 
     51      $media = $this->controller->Media->create(array( 
    5252        'type' => MEDIA_TYPE_IMAGE, 
    5353        ), true); 
    5454      if ($this->controller->getUserId() != $file['File']['user_id']) { 
    55         $user = $this->Media->User->findById($file['File']['user_id']); 
     55        $user = $this->controller->Media->User->findById($file['File']['user_id']); 
    5656      } else { 
    5757        $user = $this->controller->getUser(); 
    5858      } 
    59       $media = $this->Media->addDefaultAcl(&$media, &$user); 
     59      $media = $this->controller->Media->addDefaultAcl(&$media, &$user); 
    6060       
    6161      $isNew = true; 
     
    7979    if ($options['noSave']) { 
    8080      return $media; 
    81     } elseif (!$this->Media->save($media)) { 
     81    } elseif (!$this->controller->Media->save($media)) { 
    8282      Logger::err("Could not save Media"); 
    8383      Logger::trace($media); 
     
    8686    }  
    8787    if ($isNew) { 
    88       $mediaId = $this->Media->getLastInsertID(); 
    89       if (!$this->MyFile->setMedia($file, $mediaId)) { 
    90         $this->Media->delete($mediaId); 
     88      $mediaId = $this->controller->Media->getLastInsertID(); 
     89      if (!$this->controller->MyFile->setMedia($file, $mediaId)) { 
     90        $this->controller->Media->delete($mediaId); 
    9191        $this->FilterManager->addError($filename, 'FileSaveError'); 
    9292        return false; 
    9393      } else { 
    9494        Logger::info("Created new Media (id $mediaId)"); 
    95         $media = $this->Media->findById($mediaId); 
     95        $media = $this->controller->Media->findById($mediaId); 
    9696      } 
    9797    } else { 
    9898      Logger::verbose("Updated media (id ".$media['Media']['id'].")"); 
    9999    } 
    100     $this->MyFile->updateReaded($file); 
    101     $this->MyFile->setFlag($file, FILE_FLAG_DEPENDENT); 
     100    $this->controller->MyFile->updateReaded($file); 
     101    $this->controller->MyFile->setFlag($file, FILE_FLAG_DEPENDENT); 
    102102    return $media; 
    103103  } 
  • Controller/Component/UploadComponent.php

    r3605ef4 ree4c2b7f  
    102102    } 
    103103 
    104     if (!$data && $this->controller->data) { 
    105       $data =& $this->controller->data; 
     104    if (!$data && $this->controller->request->data) { 
     105      $data =& $this->controller->request->data; 
    106106    } 
    107107 
  • Controller/Component/VideoFilterComponent.php

    re449ecc0 ree4c2b7f  
    7474   
    7575  function _readThumb($file, &$media) { 
    76     $filename = $this->MyFile->getFilename($file); 
     76    $filename = $this->controller->MyFile->getFilename($file); 
    7777    if (!$media) { 
    7878      $video = $this->_findVideo($file); 
     
    8282        return false; 
    8383      } 
    84       $media = $this->Media->findById($video['File']['media_id']); 
     84      $media = $this->controller->Media->findById($video['File']['media_id']); 
    8585      if (!$media) { 
    8686        $this->FilterManager->addError($filename, "MediaNotFound"); 
     
    103103    // restore overwritten values 
    104104    $media['Media'] = am($media['Media'], $tmp); 
    105     if (!$this->Media->save($media)) { 
     105    if (!$this->controller->Media->save($media)) { 
    106106      $this->FilterManager->addError($filename, "MediaSaveError"); 
    107107      Logger::err("Could not save media"); 
    108108      return false; 
    109109    }  
    110     $this->MyFile->setMedia($file, $media['Media']['id']); 
    111     $this->MyFile->updateReaded($file); 
     110    $this->controller->MyFile->setMedia($file, $media['Media']['id']); 
     111    $this->controller->MyFile->updateReaded($file); 
    112112    Logger::verbose("Updated media from thumb file"); 
    113     return $this->Media->findById($media['Media']['id']); 
     113    return $this->controller->Media->findById($media['Media']['id']); 
    114114  } 
    115115 
     
    118118   * @return True, false on error */ 
    119119  function read(&$file, &$media, $options = array()) { 
    120     $filename = $this->MyFile->getFilename($file); 
    121  
    122     if ($this->MyFile->isType($file, FILE_TYPE_VIDEOTHUMB)) { 
     120    $filename = $this->controller->MyFile->getFilename($file); 
     121 
     122    if ($this->controller->MyFile->isType($file, FILE_TYPE_VIDEOTHUMB)) { 
    123123      return $this->_readThumb($file, &$media); 
    124     } elseif (!$this->MyFile->isType($file, FILE_TYPE_VIDEO)) { 
     124    } elseif (!$this->controller->MyFile->isType($file, FILE_TYPE_VIDEO)) { 
    125125      $this->FilterManager->addError($filename, "FileNotSupported"); 
    126       Logger::err("File type is not supported: ".$this->MyFile->getFilename($file)); 
     126      Logger::err("File type is not supported: ".$this->controller->MyFile->getFilename($file)); 
    127127      return false; 
    128128    } 
     
    130130    $isNew = false; 
    131131    if (!$media) { 
    132       $media = $this->Media->create(array( 
     132      $media = $this->controller->Media->create(array( 
    133133            'type' => MEDIA_TYPE_VIDEO, 
    134134            'date' => date('Y-m-d H:i:s', time()), 
     
    137137            ), true); 
    138138      if ($this->controller->getUserId() != $file['File']['user_id']) { 
    139         $user = $this->Media->User->findById($file['File']['user_id']); 
     139        $user = $this->controller->Media->User->findById($file['File']['user_id']); 
    140140      } else { 
    141141        $user = $this->controller->getUser(); 
    142142      } 
    143       $media = $this->Media->addDefaultAcl(&$media, &$user); 
     143      $media = $this->controller->Media->addDefaultAcl(&$media, &$user); 
    144144 
    145145      $isNew = true; 
     
    153153      $media = $this->_readGetId3(&$media, $filename); 
    154154    } 
    155     if (!$media || !$this->Media->save($media)) { 
     155    if (!$media || !$this->controller->Media->save($media)) { 
    156156      $this->FilterManager->addError($filename, "MediaSaveError"); 
    157157      Logger::err("Could not save media"); 
     
    160160      
    161161    $mediaId = $media['Media']['id']; 
    162     if ($isNew || !$this->MyFile->hasMedia($file)) { 
    163       $mediaId = $isNew ? $this->Media->getLastInsertID() : $data['id']; 
    164       if (!$this->MyFile->setMedia($file, $mediaId)) { 
     162    if ($isNew || !$this->controller->MyFile->hasMedia($file)) { 
     163      $mediaId = $isNew ? $this->controller->Media->getLastInsertID() : $data['id']; 
     164      if (!$this->controller->MyFile->setMedia($file, $mediaId)) { 
    165165        Logger::err("File was not saved: " . $filename); 
    166166        $this->FilterManager->addError($filename, "FileSaveError"); 
    167         $this->Media->delete($mediaId); 
     167        $this->controller->Media->delete($mediaId); 
    168168        return false; 
    169169      } 
    170       $media = $this->Media->findById($mediaId); 
    171     } 
    172  
    173     $this->MyFile->updateReaded($file); 
    174     $this->MyFile->setFlag($file, FILE_FLAG_DEPENDENT); 
    175  
    176     return $this->Media->findById($mediaId); 
     170      $media = $this->controller->Media->findById($mediaId); 
     171    } 
     172 
     173    $this->controller->MyFile->updateReaded($file); 
     174    $this->controller->MyFile->setFlag($file, FILE_FLAG_DEPENDENT); 
     175 
     176    return $this->controller->Media->findById($mediaId); 
    177177  } 
    178178 
     
    277277  // Check for video thumb 
    278278  function _hasThumb($media) { 
    279     $thumb = $this->Media->getFile($media, FILE_TYPE_VIDEOTHUMB); 
     279    $thumb = $this->controller->Media->getFile($media, FILE_TYPE_VIDEOTHUMB); 
    280280    if ($thumb) { 
    281281      return true; 
     
    286286 
    287287  function _createThumb($media) { 
    288     $video = $this->Media->getFile($media, FILE_TYPE_VIDEO); 
     288    $video = $this->controller->Media->getFile($media, FILE_TYPE_VIDEO); 
    289289    if (!$video) { 
    290290      Logger::err("Media {$media['Media']['id']} has no video"); 
    291291      return false; 
    292292    } 
    293     if (!is_writable(dirname($this->MyFile->getFilename($video)))) { 
     293    if (!is_writable(dirname($this->controller->MyFile->getFilename($video)))) { 
    294294      Logger::warn("Cannot create video thumb. Directory of video is not writeable"); 
    295295    } 
     
    305305      $id = $this->_createThumb($media); 
    306306      if ($id) { 
    307         $file = $this->MyFile->findById($id); 
    308         $this->MyFile->setMedia($file, $media['Media']['id']); 
    309         $media = $this->Media->findById($media['Media']['id']); 
     307        $file = $this->controller->MyFile->findById($id); 
     308        $this->controller->MyFile->setMedia($file, $media['Media']['id']); 
     309        $media = $this->controller->Media->findById($media['Media']['id']); 
    310310        $this->write($file, $media); 
    311311      } 
    312312    } 
    313     if ($this->MyFile->isType($file, FILE_TYPE_VIDEOTHUMB)) { 
     313    if ($this->controller->MyFile->isType($file, FILE_TYPE_VIDEOTHUMB)) { 
    314314      $imageFilter = $this->FilterManager->getFilter('Image'); 
    315315      if (!$imageFilter) { 
     
    317317        return false; 
    318318      } 
    319       $filename = $this->MyFile->getFilename($file); 
     319      $filename = $this->controller->MyFile->getFilename($file); 
    320320      Logger::debug("Write video thumbnail by ImageFilter: $filename"); 
    321321      return $imageFilter->write(&$file, &$media); 
  • Controller/Component/WebdavServerComponent.php

    r1a41cea ree4c2b7f  
    979979        $options["props"][$key]['status']="403 Forbidden"; 
    980980      } else { 
    981         $property = $this->controller->Property->find(array('Property.file_id' => $fileId, 'Property.name' => $prop['name'], 'Property.ns' => $prop['ns'])); 
     981        $property = $this->controller->Property->find('first', array('conditions' => array('Property.file_id' => $fileId, 'Property.name' => $prop['name'], 'Property.ns' => $prop['ns']))); 
    982982        if (isset($prop["val"])) { 
    983983          if (!$property) { 
     
    10371037 
    10381038    if (isset($options["update"])) { // Lock Update 
    1039       $lock = $this->controller->Lock->find(array('Lock.file_id' => $fileId, 'Lock.token' => $options['update'])); 
     1039      $lock = $this->controller->Lock->find('first' => array('conditions' => array('Lock.file_id' => $fileId, 'Lock.token' => $options['update']))); 
    10401040       
    10411041      if ($lock) { 
     
    10881088      return "409 Conflict"; 
    10891089    } 
    1090     $lock = $this->controller->Lock->find(array('Lock.file_id' => $fileId, 'Lock.token' => $options['token'])); 
     1090    $lock = $this->controller->Lock->find('first', array('conditions' => array('Lock.file_id' => $fileId, 'Lock.token' => $options['token']))); 
    10911091    if (!$lock) { 
    10921092      Logger::err("Could not find lock token '{$options['token']}' for file $fileId"); 
  • Controller/ExplorerController.php

    r1a41cea ree4c2b7f  
    2626  var $components = array('RequestHandler', 'FilterManager', 'Search', 'QueryBuilder', 'FastFileResponder', 'Feed', 'FileCache'); 
    2727  var $uses = array('Media', 'MyFile', 'Group', 'Tag', 'Category', 'Location'); 
    28   var $helpers = array('Form', 'Html', 'Ajax', 'ImageData', 'Time', 'ExplorerMenu', 'Rss', 'Search', 'Navigator', 'Tab', 'Breadcrumb', 'Autocomplete'); 
     28  var $helpers = array('Form', 'Html', 'ImageData', 'Time', 'ExplorerMenu', 'Rss', 'Search', 'Navigator', 'Tab', 'Breadcrumb', 'Autocomplete'); 
    2929 
    3030  var $crumbs = array(); 
     
    4343    $paginateActions = array('category', 'date', 'edit', 'group', 'index', 'location', 'query', 'tag', 'user', 'view'); 
    4444    if (in_array($this->action, $paginateActions)) { 
    45       $this->data = $this->Search->paginateByCrumbs($this->crumbs); 
    46       $this->FastFileResponder->addAll($this->data, 'thumb'); 
     45      $this->request->data = $this->Search->paginateByCrumbs($this->crumbs); 
     46      $this->FastFileResponder->addAll($this->request->data, 'thumb'); 
    4747 
    4848      if ($this->hasRole(ROLE_USER)) { 
     
    5050        $groupSelect = Set::combine($groups, '{n}.Group.id', '{n}.Group.name'); 
    5151        asort($groupSelect); 
    52         $groupSelect[0] = __('[Keep]', true); 
    53         $groupSelect[-1] = __('[No Group]', true); 
     52        $groupSelect[0] = __('[Keep]'); 
     53        $groupSelect[-1] = __('[No Group]'); 
    5454        $this->set('groups', $groupSelect); 
    5555      } else { 
     
    5959    $this->set('crumbs', $this->crumbs); 
    6060    $this->params['crumbs'] = $this->crumbs; 
    61     $this->Feed->add('/explorer/media/' . join('/', $this->Search->encodeCrumbs($this->crumbs)), array('title' => __('Slideshow Media RSS', true), 'id' => 'slideshow')); 
     61    $this->Feed->add('/explorer/media/' . join('/', $this->Search->encodeCrumbs($this->crumbs)), array('title' => __('Slideshow Media RSS'), 'id' => 'slideshow')); 
    6262    parent::beforeRender(); 
    6363  } 
     
    6868 
    6969  function view() { 
    70     if (!empty($this->data)) { 
    71       $crumbs = split('/', $this->data['Breadcrumb']['current']); 
    72       $crumbs[] = $this->data['Breadcrumb']['input']; 
     70    if (!empty($this->request->data)) { 
     71      $crumbs = split('/', $this->request->data['Breadcrumb']['current']); 
     72      $crumbs[] = $this->request->data['Breadcrumb']['input']; 
    7373      $this->crumbs = $crumbs; 
    7474    } 
     
    8080      if ($type == 'tag' || $type == 'category') { 
    8181        $field = Inflector::camelize($type); 
    82         $value = $this->data[$field]['names']; 
     82        $value = $this->request->data[$field]['names']; 
    8383      } else { 
    84         $value = $this->data['Location'][$type]; 
    85       } 
    86       $this->data = $this->_getAssociation($type, $value); 
     84        $value = $this->request->data['Location'][$type]; 
     85      } 
     86      $this->request->data = $this->_getAssociation($type, $value); 
    8787    } elseif ($type == 'crumb') { 
    8888      $queryMap = array( 
     
    106106      } 
    107107      $queryTypes = array_keys($queryMap); 
    108       $input = trim($this->data['Breadcrumb']['input']); 
     108      $input = trim($this->request->data['Breadcrumb']['input']); 
    109109      // cut input to maximum of 64 chars 
    110110      if (strlen($input) > 64) { 
    111111        $input = substr($input, 0, 64); 
    112112      } 
    113       $this->data = array(); 
     113      $this->request->data = array(); 
    114114      if (strpos($input, ':') === false) { 
    115115        // Search for crumb type 
     
    118118        foreach ($queryTypes as $types) { 
    119119          if ($input == '' || strpos($types, $input) === 0) { 
    120             $this->data[] = $types . ':'; 
     120            $this->request->data[] = $types . ':'; 
    121121          } 
    122122        } 
     
    142142        } 
    143143        foreach ($data as $value) { 
    144           $this->data[] = "$crumbType:$exclude$value"; 
     144          $this->request->data[] = "$crumbType:$exclude$value"; 
    145145        } 
    146146      } 
     
    173173      ))); 
    174174    foreach ($tags as $tag) { 
    175       $this->data[] = 'tag:' . $prefix . $tag; 
     175      $this->request->data[] = 'tag:' . $prefix . $tag; 
    176176    } 
    177177    $categories = Set::extract('/Category/name', $this->Media->Category->find( 
     
    179179      ))); 
    180180    foreach ($categories as $category) { 
    181       $this->data[] = 'category:' . $prefix . $category; 
     181      $this->request->data[] = 'category:' . $prefix . $category; 
    182182    } 
    183183    $locations = array_unique(Set::extract('/Location/name', $this->Media->Location->find( 
     
    185185      )))); 
    186186    foreach ($locations as $location) { 
    187       $this->data[] = 'location:' . $prefix . $location; 
     187      $this->request->data[] = 'location:' . $prefix . $location; 
    188188    } 
    189189    $groups = Set::extract('/Group/name', $this->Media->Group->find( 
     
    191191      ))); 
    192192    foreach ($groups as $group) { 
    193       $this->data[] = 'group:' . $prefix . $group; 
     193      $this->request->data[] = 'group:' . $prefix . $group; 
    194194    } 
    195195    $users = Set::extract('/User/username', $this->Media->User->find( 
     
    198198    foreach ($users as $user) { 
    199199      // TODO excluding of users are currently not supported 
    200       $this->data[] = 'user:' . $user; 
     200      $this->request->data[] = 'user:' . $user; 
    201201    } 
    202202 
     
    209209      foreach ($values as $value) { 
    210210        if (substr(strtolower($value), 0, $len) == $needle) { 
    211           $this->data[] = $type . ':' . $value; 
     211          $this->request->data[] = $type . ':' . $value; 
    212212        } 
    213213      } 
     
    309309 
    310310  function quicksearch($quicksearch = false) { 
    311     if (!empty($this->data) && isset($this->data['Media']['quicksearch'])) { 
    312       $quicksearch = $this->data['Media']['quicksearch']; 
     311    if (!empty($this->request->data) && isset($this->request->data['Media']['quicksearch'])) { 
     312      $quicksearch = $this->request->data['Media']['quicksearch']; 
    313313    }  
    314314 
    315315    if ($quicksearch) { 
    316       $this->data = $this->Search->quicksearch($quicksearch, 6); 
     316      $this->request->data = $this->Search->quicksearch($quicksearch, 6); 
    317317    } 
    318318    $this->set('quicksearch', $quicksearch); 
     
    320320 
    321321  function query() { 
    322     if (!empty($this->data)) { 
    323       $this->Search->addTags(preg_split('/\s*,\s*/', trim($this->data['Media']['tags']))); 
    324       $this->Search->setTagOp($this->data['Media']['tag_op']); 
    325  
    326       $this->Search->addCategories(preg_split('/\s*,\s*/', trim($this->data['Media']['categories']))); 
    327       $this->Search->setCategoryOp($this->data['Media']['category_op']); 
    328  
    329       $this->Search->addLocations(preg_split('/\s*,\s*/', trim($this->data['Media']['locations']))); 
    330       $this->Search->setLocationOp($this->data['Media']['location_op']); 
    331       $this->Search->setOperand($this->data['Media']['operand']); 
    332  
    333       $this->Search->setFrom($this->data['Media']['from']); 
    334       $this->Search->setTo($this->data['Media']['to']); 
    335  
    336       $this->Search->setShow($this->data['Option']['show']); 
    337       $this->Search->setSort($this->data['Option']['sort']); 
     322    if (!empty($this->request->data)) { 
     323      $this->Search->addTags(preg_split('/\s*,\s*/', trim($this->request->data['Media']['tags']))); 
     324      $this->Search->setTagOp($this->request->data['Media']['tag_op']); 
     325 
     326      $this->Search->addCategories(preg_split('/\s*,\s*/', trim($this->request->data['Media']['categories']))); 
     327      $this->Search->setCategoryOp($this->request->data['Media']['category_op']); 
     328 
     329      $this->Search->addLocations(preg_split('/\s*,\s*/', trim($this->request->data['Media']['locations']))); 
     330      $this->Search->setLocationOp($this->request->data['Media']['location_op']); 
     331      $this->Search->setOperand($this->request->data['Media']['operand']); 
     332 
     333      $this->Search->setFrom($this->request->data['Media']['from']); 
     334      $this->Search->setTo($this->request->data['Media']['to']); 
     335 
     336      $this->Search->setShow($this->request->data['Option']['show']); 
     337      $this->Search->setSort($this->request->data['Option']['sort']); 
    338338      if ($this->hasRole(ROLE_GUEST)) { 
    339         $this->Search->setName($this->data['Media']['name']); 
    340         $this->Search->setType($this->data['Media']['type']); 
     339        $this->Search->setName($this->request->data['Media']['name']); 
     340        $this->Search->setType($this->request->data['Media']['type']); 
    341341        // Allow to search for my images 
    342         if ($this->data['User']['username'] == $this->getUserId()) { 
    343           $this->Search->setUser($this->data['User']['username']); 
     342        if ($this->request->data['User']['username'] == $this->getUserId()) { 
     343          $this->Search->setUser($this->request->data['User']['username']); 
    344344        } 
    345345      } 
    346346 
    347347      if ($this->hasRole(ROLE_USER)) { 
    348         $this->Search->setVisibility($this->data['Media']['visibility']); 
    349  
    350         $this->Search->setUser($this->data['User']['username']); 
    351         $this->Search->addGroup($this->data['Group']['name']); 
     348        $this->Search->setVisibility($this->request->data['Media']['visibility']); 
     349 
     350        $this->Search->setUser($this->request->data['User']['username']); 
     351        $this->Search->addGroup($this->request->data['Group']['name']); 
    352352      }  
    353353      $this->crumbs = $this->Search->convertToCrumbs(); 
     
    393393      } else { 
    394394        Logger::info(sprintf("Invalid root %s or folder %s", $fsRoot, $fsFolder)); 
    395         $this->Session->setFlash(sprintf(__("Invalid folder: %s", true), $folder)); 
     395        $this->Session->setFlash(__("Invalid folder: %s", $folder)); 
    396396      } 
    397397    } else { 
     
    482482  
    483483  function edit() { 
    484     if (isset($this->data)) { 
    485       $ids = preg_split('/\s*,\s*/', $this->data['Media']['ids']); 
     484    if (isset($this->request->data)) { 
     485      $ids = preg_split('/\s*,\s*/', $this->request->data['Media']['ids']); 
    486486      $ids = array_unique($ids); 
    487487      if (!count($ids)) { 
     
    490490 
    491491      $user = $this->getUser(); 
    492       $this->Media->prepareGroupData(&$this->data, &$user); 
    493       $editData = $this->Media->prepareMultiEditData(&$this->data); 
     492      $this->Media->prepareGroupData(&$this->request->data, &$user); 
     493      $editData = $this->Media->prepareMultiEditData(&$this->request->data); 
    494494       
    495495      $allMedia = $this->Media->find('all', array('conditions' => array('Media.id' => $ids))); 
     
    520520        } 
    521521      } 
    522       $this->data = array(); 
     522      $this->request->data = array(); 
    523523    } 
    524524    $this->redirect('view/' . implode('/', $this->Search->encodeCrumbs($this->crumbs))); 
     
    542542      $this->redirect(null, '403'); 
    543543    } 
    544     $this->data = $media; 
     544    $this->request->data = $media; 
    545545    $this->layout='bare'; 
    546546    $this->render('editmeta'); 
     
    560560    $user = $this->getUser(); 
    561561    $username = $user['User']['username']; 
    562     if (isset($this->data)) { 
     562    if (isset($this->request->data)) { 
    563563      $media = $this->Media->findById($id); 
    564564      $this->Media->setAccessFlags(&$media, $user); 
     
    569569        Logger::warn("User '{$username}' ({$user['User']['id']}) has no previleges to change tags of image ".$id); 
    570570      } else { 
    571         $this->Media->prepareGroupData(&$this->data, &$user); 
    572         $tmp = $this->Media->editSingle(&$media, &$this->data); 
     571        $this->Media->prepareGroupData(&$this->request->data, &$user); 
     572        $tmp = $this->Media->editSingle(&$media, &$this->request->data); 
    573573        if (!$this->Media->save($tmp)) { 
    574574          Logger::warn("Could not save media"); 
     
    585585    $media = $this->Media->findById($id); 
    586586    $this->Media->setAccessFlags(&$media, $user); 
    587     $this->data = $media; 
     587    $this->request->data = $media; 
    588588    $this->Search->parseArgs(); 
    589589    $this->Search->setUser($user['User']['username']); 
     
    624624    $media = $this->Media->findById($id); 
    625625    $this->Media->setAccessFlags(&$media, $user); 
    626     $this->data = $media; 
     626    $this->request->data = $media; 
    627627    $this->layout='bare'; 
    628628    if ($this->Media->checkAccess(&$media, &$user, 1, 0)) { 
     
    630630      $groups = Set::combine($groups, '{n}.Group.id', '{n}.Group.name'); 
    631631      asort($groups); 
    632       $groups[-1] = __('[No Group]', true); 
     632      $groups[-1] = __('[No Group]'); 
    633633      $this->set('groups', $groups); 
    634634    } else { 
     
    646646    $id = intval($id); 
    647647    $this->layout='bare'; 
    648     if (isset($this->data)) { 
     648    if (isset($this->request->data)) { 
    649649      // Call find() instead of read(). read() populates resultes to the model, 
    650650      // which causes problems at save() 
     
    656656        Logger::warn("User '{$user['User']['username']}' ({$user['User']['id']}) has no previleges to change ACL of image ".$id); 
    657657      } else { 
    658         $this->Media->prepareGroupData(&$this->data, &$user); 
     658        $this->Media->prepareGroupData(&$this->request->data, &$user); 
    659659        $tmp = array('Media' => array('id' => $id)); 
    660         $this->Media->updateAcl(&$tmp, &$media, &$this->data); 
     660        $this->Media->updateAcl(&$tmp, &$media, &$this->request->data); 
    661661        $this->Media->save($tmp, true); 
    662662        Logger::info("Changed acl of media $id"); 
     
    665665    $media = $this->Media->findById($id); 
    666666    $this->Media->setAccessFlags(&$media, $this->getUser()); 
    667     $this->data = $media; 
     667    $this->request->data = $media; 
    668668    $this->layout='bare'; 
    669669    $this->Search->parseArgs(); 
     
    714714        'description' => "Recently Published Images" ) 
    715715      ); 
    716     $this->data = $this->Search->paginateByCrumbs($this->crumbs); 
     716    $this->request->data = $this->Search->paginateByCrumbs($this->crumbs); 
    717717  } 
    718718 
     
    722722      Configure::write('debug', 1); 
    723723    } 
    724     $this->data = $this->Search->paginateByCrumbs($this->crumbs); 
     724    $this->request->data = $this->Search->paginateByCrumbs($this->crumbs); 
    725725  } 
    726726 
     
    728728    $this->Search->setSort('random'); 
    729729 
    730     $this->data = array(); 
     730    $this->request->data = array(); 
    731731 
    732732    $north = floatval($north); 
     
    749749        //Logger::trace("Found ".count($points)." points"); 
    750750        if ($points) { 
    751           $this->data = am($points, $this->data); 
     751          $this->request->data = am($points, $this->request->data); 
    752752        } 
    753753        $lng += $stepLng; 
     
    757757 
    758758    $this->layout = 'xml'; 
    759     Logger::trace("Search points of N:$north, S:$south, W:$west, E:$east: Found ".count($this->data)." points"); 
    760     $this->FastFileResponder->addAll($this->data, 'mini'); 
     759    Logger::trace("Search points of N:$north, S:$south, W:$west, E:$east: Found ".count($this->request->data)." points"); 
     760    $this->FastFileResponder->addAll($this->request->data, 'mini'); 
    761761    if (Configure::read('debug') > 1) { 
    762762      Configure::write('debug', 1); 
  • Controller/GroupsController.php

    r1a41cea ree4c2b7f  
    2525  var $uses = array('Group', 'User', 'Media'); 
    2626  var $components = array('RequestHandler', 'Security', 'Email', 'Search'); 
    27   var $helpers = array('Form', 'Ajax', 'ImageData', 'Text'); 
     27  var $helpers = array('Form', 'ImageData', 'Text'); 
    2828  var $subMenu = false; 
    2929 
     
    3131    parent::beforeFilter(); 
    3232    $this->subMenu = array( 
    33       'index' => __("List Group", true), 
    34       'create' => __("Create Group", true), 
     33      'index' => __("List Group"), 
     34      'create' => __("Create Group"), 
    3535      ); 
    3636    $this->requireRole(ROLE_USER); 
     
    4949  function fail() { 
    5050    Logger::err("The security component denied the form input"); 
    51     Logger::debug($this->data); 
     51    Logger::debug($this->request->data); 
    5252    $this->redirect('index'); 
    5353  } 
     
    5656    $userId = $this->getUserId(); 
    5757    if ($this->hasRole(ROLE_ADMIN)) { 
    58       $this->data = $this->Group->find('all', array('order' => 'Group.name')); 
    59     } else { 
    60       $this->data = $this->Group->find('all', array('conditions' => (array('OR' => array('User.id' => $userId, 'Group.is_hidden' => false))), 'order' => 'Group.name')); 
     58      $this->request->data = $this->Group->find('all', array('order' => 'Group.name')); 
     59    } else { 
     60      $this->request->data = $this->Group->find('all', array('conditions' => (array('OR' => array('User.id' => $userId, 'Group.is_hidden' => false))), 'order' => 'Group.name')); 
    6161    } 
    6262  } 
    6363 
    6464  function view($name) { 
    65     $this->data = $this->Group->findByName($name); 
    66     if (!$this->data) { 
    67       $this->Session->setFlash(sprintf(__("%s not found", true), __("Group", true))); 
     65    $this->request->data = $this->Group->findByName($name); 
     66    if (!$this->request->data) { 
     67      $this->Session->setFlash(__("%s not found", true, __("Group"))); 
    6868      $this->redirect('index'); 
    6969    } 
    70     $this->Group->setAdmin(&$this->data, $this->getUser()); 
    71     $this->set('mediaCount', $this->Media->countByGroupId($this->data['Group']['id'])); 
     70    $this->Group->setAdmin(&$this->request->data, $this->getUser()); 
     71    $this->set('mediaCount', $this->Media->countByGroupId($this->request->data['Group']['id'])); 
    7272 
    7373    $this->Search->addGroup($name); 
     
    7777 
    7878  function create() { 
    79     if (!empty($this->data)) { 
     79    if (!empty($this->request->data)) { 
    8080      $user = $this->getUser(); 
    81       $this->data['Group']['user_id'] = $user['User']['id']; 
    82       if (!$this->Group->isNameUnique($this->data)) { 
    83         $this->Session->setFlash(sprintf(__("%s already exists", true), __('Group', true))); 
    84       } elseif ($this->Group->save($this->data)) { 
     81      $this->request->data['Group']['user_id'] = $user['User']['id']; 
     82      if (!$this->Group->isNameUnique($this->request->data)) { 
     83        $this->Session->setFlash(__("%s already exists", true, __('Group'))); 
     84      } elseif ($this->Group->save($this->request->data)) { 
    8585        $groupId = $this->Group->getLastInsertID(); 
    8686        $group = $this->Group->findById($groupId); 
    8787        $user = $this->getUser(); 
    8888        Logger::info("User '{$user['User']['username']}' ({$user['User']['id']}) created group '{$group['Group']['name']}' ({$group['Group']['id']})"); 
    89         $this->Session->setFlash(sprintf(__("Add successfully group '%s'", true), $this->data['Group']['name'])); 
     89        $this->Session->setFlash(__("Add successfully group '%s'", $this->request->data['Group']['name'])); 
    9090        $this->redirect("view/{$group['Group']['name']}"); 
    9191      } else { 
    92         $this->Session->setFlash(sprintf(__("Could not create group '%s'", true), $this->data['Group']['name'])); 
     92        $this->Session->setFlash(__("Could not create group '%s'", $this->request->data['Group']['name'])); 
    9393      } 
    9494    } 
     
    110110        Logger::err($this->Email->smtpError); 
    111111      } 
    112       $this->Session->setFlash(__('Mail could not be sent', true)); 
     112      $this->Session->setFlash(__('Mail could not be sent')); 
    113113      return false; 
    114114    } 
    115115    Logger::info("Sent group subscribe request of user {$user['User']['username']} for group {$group['Group']['name']} to {$group['User']['username']}"); 
    116     $this->Session->setFlash(__("Group subscription request was sent to the group owner", true)); 
     116    $this->Session->setFlash(__("Group subscription request was sent to the group owner")); 
    117117    return true; 
    118118  } 
     
    176176    $group = $this->Group->findByName($name); 
    177177    if (!$group) { 
    178       $this->Session->setFlash(sprintf(__("%s not found", true), __("Group", true))); 
     178      $this->Session->setFlash(__("%s not found", true, __("Group"))); 
    179179      $this->redirect('index'); 
    180180    } 
     
    201201      $conditions['Group.user_id'] = $this->getUserId(); 
    202202    } 
    203     $group = $this->Group->find($conditions); 
     203    $group = $this->Group->find('all', array('conditions' => $conditions)); 
    204204    $user = $this->User->findByUsername($userName); 
    205205    $userId = ($user) ? $user['User']['id'] : false; 
     
    232232    $group = $this->Group->findById($id); 
    233233    if (!$this->Group->isAdmin(&$group, $this->getUser())) { 
    234       $this->Session->setFlash(__("You are not authorized to perform this action", true)); 
     234      $this->Session->setFlash(__("You are not authorized to perform this action")); 
    235235      $this->redirect("view/{$group['Group']['name']}"); 
    236236    } 
    237     $user = $this->User->findByUsername($this->data['Member']['new']); 
     237    $user = $this->User->findByUsername($this->request->data['Member']['new']); 
    238238    if (!$user) { 
    239       $this->Session->setFlash(__("%s not found", true), __("User", true)); 
     239      $this->Session->setFlash(__("%s not found", true), __("User")); 
    240240      $this->redirect("view/{$group['Group']['name']}"); 
    241241    } 
     
    244244      $this->redirect("index"); 
    245245    } elseif ($result['code'] == 201) { 
    246       $this->Session->setFlash(sprintf(__("User %s is now subscribe to this group", true), $this->data['Member']['new'])); 
     246      $this->Session->setFlash(__("User %s is now subscribe to this group", $this->request->data['Member']['new'])); 
    247247    } 
    248248    $this->redirect("view/{$group['Group']['name']}"); 
     
    252252    $group = $this->Group->findByName($groupName); 
    253253    if (!$this->Group->isAdmin(&$group, $this->getUser())) { 
    254       $this->Session->setFlash(__("You are not authorized to perform this action", true)); 
     254      $this->Session->setFlash(__("You are not authorized to perform this action")); 
    255255      $this->redirect("view/{$group['Group']['name']}"); 
    256256    } 
    257257    $user = $this->User->findByUsername($userName); 
    258258    if (!$user) { 
    259       $this->Session->setFlash(__("%s not found", true), __("User", true)); 
     259      $this->Session->setFlash(__("%s not found", true), __("User")); 
    260260      $this->redirect("view/{$group['Group']['name']}"); 
    261261    } 
     
    264264      $this->redirect("index"); 
    265265    } elseif ($result['code'] == 201) { 
    266       $this->Session->setFlash(sprintf(__("User %s is now unsubscribe from this group", true), $userName)); 
     266      $this->Session->setFlash(__("User %s is now unsubscribe from this group", $userName)); 
    267267    } 
    268268    $this->redirect("view/{$group['Group']['name']}"); 
     
    270270 
    271271  function edit($groupName) { 
    272     if (!empty($this->data)) { 
    273       if ($this->data['Group']['name'] != $groupName && !$this->Group->isNameUnique($this->data)) { 
    274         $this->Session->setFlash(sprintf(__("%s already exists", true), __('Group', true))); 
    275       } elseif (!$this->Group->save($this->data)) { 
    276         $this->Session->setFlash(sprintf(__("Could not save %s", true), __('Group', true))); 
     272    if (!empty($this->request->data)) { 
     273      if ($this->request->data['Group']['name'] != $groupName && !$this->Group->isNameUnique($this->request->data)) { 
     274        $this->Session->setFlash(__("%s already exists", true, __('Group'))); 
     275      } elseif (!$this->Group->save($this->request->data)) { 
     276        $this->Session->setFlash(__("Could not save %s", true, __('Group'))); 
    277277      } else { 
    278         $this->Session->setFlash(sprintf(__("%s updated", true), __('Group', true))); 
    279         if ($groupName != $this->data['Group']['name']) { 
    280           $this->redirect("edit/{$this->data['Group']['name']}"); 
     278        $this->Session->setFlash(__("%s updated", true, __('Group'))); 
     279        if ($groupName != $this->request->data['Group']['name']) { 
     280          $this->redirect("edit/{$this->request->data['Group']['name']}"); 
    281281        } 
    282282      } 
     
    286286      $conditions['Group.user_id'] = $this->getUserId(); 
    287287    } 
    288     $this->data = $this->Group->find($conditions); 
    289     if (!$this->data) { 
    290       $this->Session->setFlash(__("Could not find group", true)); 
     288    $this->request->data = $this->Group->find('all', array('conditions' => $conditions)); 
     289    if (!$this->request->data) { 
     290      $this->Session->setFlash(__("Could not find group")); 
    291291      $this->redirect("index"); 
    292292    } 
     
    298298  function delete($groupId) { 
    299299    $userId = $this->getUserId(); 
    300     $group = $this->Group->find(array('Group.id' => $groupId, 'Group.user_id' => $userId)); 
     300    $group = $this->Group->find('first', array('conditions' => array('Group.id' => $groupId, 'Group.user_id' => $userId))); 
    301301    if ($group) { 
    302302      $this->Group->delete($groupId); 
    303303      $user = $this->getUser(); 
    304304      Logger::info("User '{$user['User']['username']}' ({$user['User']['id']}) deleted group '{$group['Group']['name']}' ({$group['Group']['id']})"); 
    305       $this->Session->setFlash(sprintf(__("Successfully deleted group '%s'", true), $group['Group']['name'])); 
    306     } else { 
    307       $this->Session->setFlash(__("Could not find group", true)); 
     305      $this->Session->setFlash(__("Successfully deleted group '%s'", $group['Group']['name'])); 
     306    } else { 
     307      $this->Session->setFlash(__("Could not find group")); 
    308308    } 
    309309    $this->redirect("index"); 
  • Controller/GuestsController.php

    r1a41cea ree4c2b7f  
    2525  var $uses = array('Group', 'User', 'Guest'); 
    2626  var $components = array('RequestHandler'); 
    27   var $helpers = array('Form', 'Ajax'); 
     27  var $helpers = array('Form', 'Autocomplete'); 
    2828  var $subMenu = false; 
    2929 
     
    3333    $this->requireRole(ROLE_USER); 
    3434    $this->subMenu = array( 
    35       'create' => __('New Guest', true) 
     35      'create' => __('New Guest') 
    3636      ); 
    3737  } 
     
    4343  function index() { 
    4444    $userId = $this->getUserId(); 
    45     $this->data = $this->Guest->find('all', array('conditions' => array('Guest.creator_id' => $userId))); 
     45    $this->request->data = $this->Guest->find('all', array('conditions' => array('Guest.creator_id' => $userId))); 
    4646  } 
    4747 
     
    5353    uses('sanitize'); 
    5454    $sanitize = new Sanitize(); 
    55     $escName = $sanitize->escape($this->data['Group']['name']); 
     55    $escName = $sanitize->escape($this->request->data['Group']['name']); 
    5656    $groups = $this->Group->find('all', array('conditions' => "Group.user_id = $userId AND Group.name LIKE '%$escName%'")); 
    57     $this->data = $groups; 
     57    $this->request->data = $groups; 
    5858    $this->layout = "bare"; 
    5959  } 
    6060 
    6161  function create() { 
    62     if (!empty($this->data)) { 
     62    if (!empty($this->request->data)) { 
    6363      $userId = $this->getUserId(); 
    64       $this->data['Guest']['creator_id'] = $userId; 
    65       $this->data['Guest']['role'] = ROLE_GUEST; 
    66       if ($this->Guest->hasAny(array("Guest.username" => $this->data['Guest']['username']))) { 
    67         $this->Session->setFlash(__("Sorry. Username is already taken", true)); 
    68       } elseif ($this->Guest->save($this->data, true, array('username', 'password', 'role', 'creator_id', 'email', 'quota'))) { 
     64      $this->request->data['Guest']['creator_id'] = $userId; 
     65      $this->request->data['Guest']['role'] = ROLE_GUEST; 
     66      if ($this->Guest->hasAny(array("Guest.username" => $this->request->data['Guest']['username']))) { 
     67        $this->Session->setFlash(__("Sorry. Username is already taken")); 
     68      } elseif ($this->Guest->save($this->request->data, true, array('username', 'password', 'role', 'creator_id', 'email', 'quota'))) { 
    6969        $guestId = $this->Guest->getLastInsertID(); 
    7070        $guest = $this->Guest->findById($guestId); 
    7171        $user = $this->getUser(); 
    7272        Logger::info("User '{$user['User']['username']}' ({$user['User']['id']}) created a guest account '{$guest['Guest']['username']}' ({$guest['Guest']['id']})"); 
    73         $this->Session->setFlash(sprintf(__("Guest account '%s' was successfully created", true), $this->data['Guest']['username'])); 
     73        $this->Session->setFlash(__("Guest account '%s' was successfully created", $this->request->data['Guest']['username'])); 
    7474        $this->redirect("edit/$guestId"); 
    7575      } else { 
    76         $this->Session->setFlash(__("Sorry. Guest account could not created", true)); 
     76        $this->Session->setFlash(__("Sorry. Guest account could not created")); 
    7777      } 
    7878    } 
     
    8484     
    8585    if (!$this->Guest->hasAny(array('id' => $guestId, 'creator_id' => $userId))) { 
    86       $this->Session->setFlash(__("Sorry. Could not find requested guest", true)); 
     86      $this->Session->setFlash(__("Sorry. Could not find requested guest")); 
    8787      Logger::debug("Sorry. Could not find requested guest '$guestId' of user '$userId'"); 
    8888      $this->redirect("index"); 
    8989    } 
    9090 
    91     if (!empty($this->data)) { 
     91    if (!empty($this->request->data)) { 
    9292      $this->Guest->id = $guestId; 
    93       $this->Guest->set($this->data); 
     93      $this->Guest->set($this->request->data); 
    9494      if ($this->Guest->save(null, true, array('username', 'password', 'email', 'expires', 'quota'))) { 
    95         $this->Session->setFlash(__("Guest data were saved", true)); 
    96         $auth = max(0, min(3, $this->data['Comment']['auth'])); 
     95        $this->Session->setFlash(__("Guest data were saved")); 
     96        $auth = max(0, min(3, $this->request->data['Comment']['auth'])); 
    9797        $this->Option->setValue('comment.auth', $auth, $guestId); 
    9898      } else { 
    9999        Logger::err("Could not save guest"); 
    100100        Logger::trace($this->Guest->validationErrors); 
    101         $this->Session->setFlash(__("Updates could not be saved!", true)); 
    102       } 
    103     } 
    104     $this->data = $this->Guest->findById($guestId); 
    105     unset($this->data['Guest']['password']); 
    106     $this->data['Comment']['auth'] = $this->Option->getValue($this->data, 'comment.auth', COMMENT_AUTH_NONE); 
     101        $this->Session->setFlash(__("Updates could not be saved!")); 
     102      } 
     103    } 
     104    $this->request->data = $this->Guest->findById($guestId); 
     105    unset($this->request->data['Guest']['password']); 
     106    $this->request->data['Comment']['auth'] = $this->Option->getValue($this->request->data, 'comment.auth', COMMENT_AUTH_NONE); 
    107107    $this->set('userId', $userId); 
    108     $this->subMenu[] = array('url' => array('action' => $this->action, $guestId), 'title' => __("Edit", true), 'active' => true, 
    109       array('url' => array('action' => 'links', $guestId), 'title' => __("RSS", true)), 
     108    $this->subMenu[] = array('url' => array('action' => $this->action, $guestId), 'title' => __("Edit"), 'active' => true, 
     109      array('url' => array('action' => 'links', $guestId), 'title' => __("RSS")), 
    110110      ); 
    111111  } 
     
    115115  function delete($guestId) { 
    116116    $userId = $this->getUserId(); 
    117     $guest = $this->Guest->find(array('Guest.id' => $guestId, 'Creator.id' => $userId)); 
     117    $guest = $this->Guest->find('first', array('conditions' => array('Guest.id' => $guestId, 'Creator.id' => $userId))); 
    118118    if (!$guest) { 
    119       $this->Session->setFlash(__("Could not find requested guest", true)); 
     119      $this->Session->setFlash(__("Could not find requested guest")); 
    120120    } else { 
    121121      $user = $this->getUser(); 
    122122      Logger::info("User '{$user['User']['username']}' ({$user['User']['id']}) deleted guest account '{$guest['Guest']['username']}' ({$guest['Guest']['id']})"); 
    123       $this->Session->setFlash(sprintf(__("Guest account '%s' deleted!", true), $guest['Guest']['username'])); 
     123      $this->Session->setFlash(__("Guest account '%s' deleted!", $guest['Guest']['username'])); 
    124124      $this->Guest->delete($guestId); 
    125125    } 
     
    128128 
    129129  function addGroup($groupId) { 
    130     if (!empty($this->data)) { 
     130    if (!empty($this->request->data)) { 
    131131      $userId = $this->getUserId(); 
    132       $group = $this->Group->find(array('Group.name' => $this->data['Group']['name'], 'Group.user_id' => $userId)); 
    133       $guest = $this->Guest->find(array('Guest.id' => $groupId, 'Creator.id' => $userId)); 
     132      $group = $this->Group->find('first', array('conditions' => array('Group.name' => $this->request->data['Group']['name'], 'Group.user_id' => $userId))); 
     133      $guest = $this->Guest->find('first', array('conditions' => array('Guest.id' => $groupId, 'Creator.id' => $userId))); 
    134134 
    135135      if (!$guest) { 
     
    137137        $this->redirect("index"); 
    138138      } elseif (!$group) { 
    139         $this->Session->setFlash("The group '{$this->data['Group']['name']}' does not exists!"); 
     139        $this->Session->setFlash("The group '{$this->request->data['Group']['name']}' does not exists!"); 
    140140      } else { 
    141141        $list = Set::extract($guest, "Member.{n}.id"); 
     
    146146        if ($this->Guest->save()) { 
    147147          Logger::info("Added group '{$group['Group']['name']}' ({$group['Group']['id']}) to guest '{$guest['Guest']['username']}' ({$guest['Guest']['id']})"); 
    148           $this->Session->setFlash("The group '{$this->data['Group']['name']}' was added to your guest '{$guest['Guest']['username']}'"); 
     148          $this->Session->setFlash("The group '{$this->request->data['Group']['name']}' was added to your guest '{$guest['Guest']['username']}'"); 
    149149        } else { 
    150           $this->Session->setFlash("The group '{$this->data['Group']['name']}' could not be added to your guest '{$guest['Guest']['username']}'"); 
     150          $this->Session->setFlash("The group '{$this->request->data['Group']['name']}' could not be added to your guest '{$guest['Guest']['username']}'"); 
    151151        } 
    152152      } 
     
    160160    $userId = $this->getUserId(); 
    161161 
    162     $guest = $this->Guest->find(array('Guest.id' => $guestId, 'Creator.id' => $userId)); 
     162    $guest = $this->Guest->find('first', array('conditions' => array('Guest.id' => $guestId, 'Creator.id' => $userId))); 
    163163    if (!$guest) { 
    164164      $this->Session->setFlash("Could not find guest!"); 
     
    193193 
    194194    $userId = $this->getUserId(); 
    195     $guest = $this->Guest->find(array('Guest.id' => $guestId, 'Creator.id' => $userId)); 
     195    $guest = $this->Guest->find('first', array('conditions' => array('Guest.id' => $guestId, 'Creator.id' => $userId))); 
    196196    if (!$guest) { 
    197197      $this->Session->setFlash("Could not find guest!"); 
     
    211211      } 
    212212    } 
    213     $this->data = $this->Guest->findById($guestId); 
    214     $this->subMenu[] = array('url' => array('action' => 'edit', $guestId), 'title' => __("Edit", true), 'active' => true, 
    215       array('url' => array('action' => 'links', $guestId), 'title' => __("RSS", true), 'active' => true), 
     213    $this->request->data = $this->Guest->findById($guestId); 
     214    $this->subMenu[] = array('url' => array('action' => 'edit', $guestId), 'title' => __("Edit"), 'active' => true, 
     215      array('url' => array('action' => 'links', $guestId), 'title' => __("RSS"), 'active' => true), 
    216216      ); 
    217217  } 
  • Controller/HomeController.php

    r3605ef4 ree4c2b7f  
    4646    $this->uses = array('Media', 'Tag', 'Category', 'Comment'); 
    4747    $this->constructClasses(); 
    48     $this->pageTitle = __("Home", true); 
     48    $this->pageTitle = __("Home"); 
    4949 
    5050    parent::beforeFilter(); 
  • Controller/ImagesController.php

    r1a41cea ree4c2b7f  
    2727  var $components = array('RequestHandler', 'Search', 'FastFileResponder'); 
    2828  var $uses = array('Media', 'Group', 'Tag', 'Category', 'Location'); 
    29   var $helpers = array('Form', 'Html', 'Ajax', 'ImageData', 'Time', 'Search', 'ExplorerMenu', 'Rss', 'Map', 'Navigator', 'Flowplayer', 'Tab', 'Number', 'Option'); 
     29  var $helpers = array('Form', 'Html', 'ImageData', 'Time', 'Search', 'ExplorerMenu', 'Rss', 'Map', 'Navigator', 'Flowplayer', 'Tab', 'Number', 'Option', 'Autocomplete'); 
    3030  var $crumbs = array(); 
    3131 
     
    3737      $groupSelect = Set::combine($groups, '{n}.Group.id', '{n}.Group.name'); 
    3838      asort($groupSelect); 
    39       $groupSelect[0] = __('[Keep]', true); 
    40       $groupSelect[-1] = __('[No Group]', true); 
     39      $groupSelect[0] = __('[Keep]'); 
     40      $groupSelect[-1] = __('[No Group]'); 
    4141      $this->set('groups', $groupSelect); 
    4242    } else { 
     
    6565   * in the session to avoid multiple rating per session. */ 
    6666  function _updateRating() { 
    67     if (!$this->data || !isset($this->data['Media']['id'])) { 
     67    if (!$this->request->data || !isset($this->request->data['Media']['id'])) { 
    6868      Logger::warn("Precondition failed"); 
    6969      return; 
     
    7979 
    8080    // Check for media rating 
    81     $id = $this->data['Media']['id']; 
     81    $id = $this->request->data['Media']['id']; 
    8282    $ranked = array(); 
    8383    if ($this->Session->check('Media.ranked')) { 
     
    8989    } 
    9090 
    91     $this->Media->updateRanking($this->data); 
     91    $this->Media->updateRanking($this->request->data); 
    9292 
    9393    // update rated media ids 
     
    9797 
    9898  function view($id) { 
    99     $this->data = $this->Search->paginateMediaByCrumb($id, $this->crumbs); 
    100     if (!$this->data) { 
     99    $this->request->data = $this->Search->paginateMediaByCrumb($id, $this->crumbs); 
     100    if (!$this->request->data) { 
    101101      $this->render('notfound'); 
    102102    } else { 
     
    118118        $comment = $this->Session->read('Comment.data'); 
    119119        $this->Comment->validationErrors = $this->Session->read('Comment.validationErrors'); 
    120         $this->data['Comment'] = am($comment['Comment'], $this->data['Comment']); 
    121         //$this->data = am($this->Session->read('Comment.data'), $this->data); 
     120        $this->request->data['Comment'] = am($comment['Comment'], $this->request->data['Comment']); 
     121        //$this->request->data = am($this->Session->read('Comment.data'), $this->request->data); 
    122122        $this->Session->delete('Comment.data'); 
    123123      } 
    124       $this->FastFileResponder->add($this->data, 'preview'); 
     124      $this->FastFileResponder->add($this->request->data, 'preview'); 
    125125    } 
    126126  } 
    127127 
    128128  function update($id) { 
    129     if (!empty($this->data)) { 
     129    if (!empty($this->request->data)) { 
    130130      $user = $this->getUser(); 
    131131      $media = $this->Media->findById($id); 
     
    138138      } else { 
    139139        //$this->_checkAndSetGroupId(); 
    140         $tmp = $this->Media->editSingle(&$media, &$this->data); 
     140        $tmp = $this->Media->editSingle(&$media, &$this->request->data); 
    141141        if (!$this->Media->save($tmp)) { 
    142142          Logger::warn("Could not save media"); 
     
    159159 
    160160  function updateAcl($id) { 
    161     if (!empty($this->data)) { 
     161    if (!empty($this->request->data)) { 
    162162      $user = $this->getUser(); 
    163163      $media = $this->Media->findById($id); 
     
    169169        Logger::warn("User '{$username}' ({$user['User']['id']}) has no previleges to change tags of image ".$id); 
    170170      } else { 
    171         $this->Media->prepareGroupData(&$this->data, &$user); 
     171        $this->Media->prepareGroupData(&$this->request->data, &$user); 
    172172        $tmp = array('Media' => array('id' => $id)); 
    173         $this->Media->updateAcl(&$tmp, &$media, &$this->data); 
     173        $this->Media->updateAcl(&$tmp, &$media, &$this->request->data); 
    174174        $this->Media->save($tmp, true); 
    175175        Logger::info("Changed acl of media $id"); 
  • Controller/OptionsController.php

    r1a41cea ree4c2b7f  
    3030  function beforeFilter() { 
    3131    $this->subMenu = array( 
    32       'acl' => __("Default Rights", true), 
    33       'profile' => __("Profile", true), 
    34       'rss' => __("RSS Feeds", true), 
     32      'acl' => __("Default Rights"), 
     33      'profile' => __("Profile"), 
     34      'rss' => __("RSS Feeds"), 
    3535      ); 
    3636    parent::beforeFilter(); 
     
    5757 
    5858    $userId = $this->getUserId(); 
    59     if (isset($this->data)) { 
     59    if (!empty($this->request->data)) { 
    6060      // TODO check valid acl 
    61       $this->_set($userId, 'acl.group', $this->data); 
     61      $this->_set($userId, 'acl.group', $this->request->data); 
    6262 
    6363      // check values 
    64       if ($this->data['acl']['write']['meta'] > $this->data['acl']['write']['tag']) 
    65         $this->data['acl']['write']['meta'] = $this->data['acl']['write']['tag']; 
    66       if ($this->data['acl']['read']['original'] > $this->data['acl']['read']['preview']) 
    67         $this->data['acl']['read']['original'] = $this->data['acl']['read']['preview']; 
     64      if ($this->request->data['acl']['write']['meta'] > $this->request->data['acl']['write']['tag']) { 
     65        $this->request->data['acl']['write']['meta'] = $this->request->data['acl']['write']['tag']; 
     66      } 
     67      if ($this->request->data['acl']['read']['original'] > $this->request->data['acl']['read']['preview']) { 
     68        $this->request->data['acl']['read']['original'] = $this->request->data['acl']['read']['preview']; 
     69      } 
    6870 
    69       $this->_set($userId, 'acl.write.tag', $this->data); 
    70       $this->_set($userId, 'acl.write.meta', $this->data); 
     71      $this->_set($userId, 'acl.write.tag', $this->request->data); 
     72      $this->_set($userId, 'acl.write.meta', $this->request->data); 
    7173 
    72       $this->_set($userId, 'acl.read.original', $this->data); 
    73       $this->_set($userId, 'acl.read.preview', $this->data); 
     74      $this->_set($userId, 'acl.read.original', $this->request->data); 
     75      $this->_set($userId, 'acl.read.preview', $this->request->data); 
    7476 
    75       $this->Session->setFlash(__("Settings saved", true)); 
     77      $this->Session->setFlash(__("Settings saved")); 
    7678    } 
    7779    $tree = $this->Option->getTree($userId); 
    7880    $this->Option->addDefaultAclTree(&$tree); 
    79     $this->data = $tree; 
     81    $this->request->data = $tree; 
    8082 
    8183    $this->set('userId', $userId); 
     
    8688      $groups = array(); 
    8789    } 
    88     $groups[-1] = __('[No Group]', true); 
     90    $groups[-1] = __('[No Group]'); 
    8991    $this->set('groups', $groups); 
    9092  } 
     
    9496 
    9597    $userId = $this->getUserId(); 
    96     if (!empty($this->data)) { 
     98    if (!empty($this->request->data)) { 
    9799      $this->User->id = $userId; 
    98       if (!$this->User->save($this->data['User'], true, array('username', 'firstname', 'lastname', 'password', 'email', 'visible_level', 'notify_interval'))) { 
     100      if (!$this->User->save($this->request->data['User'], true, array('username', 'firstname', 'lastname', 'password', 'email', 'visible_level', 'notify_interval'))) { 
    99101        Logger::err("Could not update user profile"); 
    100         $this->Session->setFlash(__("Could not save profile!", true)); 
     102        $this->Session->setFlash(__("Could not save profile!")); 
    101103      } else { 
    102104        Logger::info("User $userId profile updated"); 
    103         $this->Session->setFlash(__("Profile saved", true)); 
     105        $this->Session->setFlash(__("Profile saved")); 
    104106      } 
    105       $browser = Set::extract("/Option/user/browser/full", $this->data); 
     107      $browser = Set::extract("/Option/user/browser/full", $this->request->data); 
    106108      $this->Option->setValue('user.browser.full', $browser[0], $userId); 
    107109    } 
    108     $this->data = $this->User->findById($userId); 
    109     $this->data['Option'] = $this->Option->getTree($userId); 
    110     unset($this->data['User']['password']); 
     110    $this->request->data = $this->User->findById($userId); 
     111    $this->request->data['Option'] = $this->Option->getTree($userId); 
     112    unset($this->request->data['User']['password']); 
    111113  } 
    112114 
     
    124126      } 
    125127    } 
    126     $this->data = $this->User->findById($userId); 
     128    $this->request->data = $this->User->findById($userId); 
    127129  } 
    128130 
  • Controller/SetupController.php

    rbbc826a ree4c2b7f  
    317317    $newContent = preg_replace("/$oldSalt/", $salt, $content); 
    318318    if (!$file->write($newContent)) { 
    319       $this->Session->setFlash(sprintf(__("Could not write configuration to '%s'", true), $this->core)); 
     319      $this->Session->setFlash(__("Could not write configuration to '%s'", $this->core)); 
    320320      Logger::err("Could not write configuration to '$this->core'"); 
    321321    } else { 
     
    324324      $this->Session->renew(); 
    325325 
    326       $this->Session->setFlash(__("Update core settings", true)); 
     326      $this->Session->setFlash(__("Update core settings")); 
    327327      Logger::info("Set new security salt to '$this->core'"); 
    328328      $this->redirect('index'); 
     
    395395    $this->Session->delete('configError'); 
    396396 
    397     if (!empty($this->data)) { 
     397    if (!empty($this->request->data)) { 
    398398      $output = "<?php  
    399399/**  
     
    407407    'datasource' => 'Database/Mysql', 
    408408    'persistent' => true, 
    409     'host' => '{$this->data['db']['host']}', 
    410     'login' => '{$this->data['db']['login']}', 
    411     'password' => '{$this->data['db']['password']}', 
    412     'database' => '{$this->data['db']['database']}', 
    413     'prefix' => '{$this->data['db']['prefix']}', 
     409    'host' => '{$this->request->data['db']['host']}', 
     410    'login' => '{$this->request->data['db']['login']}', 
     411    'password' => '{$this->request->data['db']['password']}', 
     412    'database' => '{$this->request->data['db']['database']}', 
     413    'prefix' => '{$this->request->data['db']['prefix']}', 
    414414    'encoding' => 'utf8' 
    415415  ); 
     
    423423      } else { 
    424424        Logger::err("Could not write database configuration file '{$this->dbConfig}'"); 
    425         $this->Session->setFlash(__("Could not write database configuration file", true)); 
     425        $this->Session->setFlash(__("Could not write database configuration file")); 
    426426      } 
    427427      $file->close(); 
    428       unset($this->data['db']['password']); 
    429       $this->Session->write('configData', $this->data); 
     428      unset($this->request->data['db']['password']); 
     429      $this->Session->write('configData', $this->request->data); 
    430430    } else { 
    431431      if ($this->Session->check('configData')) { 
     
    460460 
    461461    if (!$this->__hasConnection()) { 
    462       $this->Session->setFlash(__('Could not connect to database. Please check your database configuration!', true)); 
     462      $this->Session->setFlash(__('Could not connect to database. Please check your database configuration!')); 
    463463      $this->Session->write('configError', true); 
    464464      $this->redirect('config'); 
     
    484484      }  
    485485      Logger::info("Successful database migration to verion " . $this->Migration->getVersion('app')); 
    486       $this->Session->setFlash(__("All required tables are created", true)); 
     486      $this->Session->setFlash(__("All required tables are created")); 
    487487      $this->redirect('user'); 
    488488    } catch (MigrationVersionException $errors) { 
    489489      Logger::trace($errors->getMessage()); 
    490       $this->Session->setFlash(__("Could not create tables correctly. Please see logfile for details", true)); 
     490      $this->Session->setFlash(__("Could not create tables correctly. Please see logfile for details")); 
    491491    } 
    492492  } 
     
    516516        $this->Session->write('User.username', $this->request->data['User']['username']); 
    517517        Logger::info("Admin account '{$this->request->data['User']['username']}' was created"); 
    518         $this->Session->setFlash(__("Admin account was successfully created", true)); 
     518        $this->Session->setFlash(__("Admin account was successfully created")); 
    519519        $this->redirect('system'); 
    520520      } else { 
    521521        Logger::err("Admin account '{$this->request->data['User']['username']}' could not be created"); 
    522         $this->Session->setFlash(__("Could not create admin account. Please retry", true)); 
     522        $this->Session->setFlash(__("Could not create admin account. Please retry")); 
    523523      } 
    524524    } elseif (!isset($this->request->data['User']['username'])) { 
     
    689689    if (!$this->_initMigration()) { 
    690690      Logger::err("Cannot init migration data"); 
    691       $this->Session->setFlash(__("Cannot initialize database migration data", true)); 
     691      $this->Session->setFlash(__("Cannot initialize database migration data")); 
    692692      return false; 
    693693    } 
  • Controller/SystemController.php

    r1a41cea ree4c2b7f  
    2525  var $name = 'System'; 
    2626  var $helpers = array('Form'); 
    27   var $uses = array('Option'); 
     27  var $uses = array('Media', 'Option'); 
    2828  var $subMenu = array(); 
    2929 
     
    3333 
    3434    $this->subMenu = array( 
    35       'index' => __("General", true), 
    36       'external' => __("External Programs", true), 
    37       'map' => __("Map Settings", true), 
    38       'upgrade' => __("Database Upgrade", true), 
    39       'deleteUnusedMetaData' => __("Delete Unused Metadata", true) 
     35      'index' => __("General"), 
     36      'external' => __("External Programs"), 
     37      'map' => __("Map Settings"), 
     38      'upgrade' => __("Database Upgrade"), 
     39      'deleteUnusedMetaData' => __("Delete Unused Metadata") 
    4040      ); 
    4141  } 
     
    5252 
    5353  function index() { 
    54     if (isset($this->data)) { 
    55       $this->_set(0, 'general.title', $this->data); 
    56       $this->_set(0, 'general.subtitle', $this->data); 
     54    if (isset($this->request->data)) { 
     55      $this->_set(0, 'general.title', $this->request->data); 
     56      $this->_set(0, 'general.subtitle', $this->request->data); 
    5757    } 
    58     $this->data = $this->Option->getTree(0); 
     58    $this->request->data = $this->Option->getTree(0); 
    5959  } 
    6060 
    6161  function external() { 
    62     if (!empty($this->data)) { 
     62    if (!empty($this->request->data)) { 
    6363      // TODO check valid acl 
    64       $this->_set(0, 'bin.exiftool', $this->data); 
    65       $this->_set(0, 'bin.convert', $this->data); 
    66       $this->_set(0, 'bin.ffmpeg', $this->data); 
    67       $this->_set(0, 'bin.flvtool2', $this->data); 
     64      $this->_set(0, 'bin.exiftool', $this->request->data); 
     65      $this->_set(0, 'bin.convert', $this->request->data); 
     66      $this->_set(0, 'bin.ffmpeg', $this->request->data); 
     67      $this->_set(0, 'bin.flvtool2', $this->request->data); 
    6868      // debug 
    69       $this->set('commit', $this->data); 
     69      $this->set('commit', $this->request->data); 
    7070      $this->Session->setFlash("Settings saved"); 
    7171    } 
    7272    $tree = $this->Option->getTree(0); 
    73     $this->data = $tree; 
     73    $this->request->data = $tree; 
    7474  } 
    7575 
    7676  function map() { 
    77     if (!empty($this->data)) { 
    78       $this->_set(0, 'google.map.key', $this->data); 
     77    if (!empty($this->request->data)) { 
     78      $this->_set(0, 'google.map.key', $this->request->data); 
    7979      // debug 
    80       $this->set('commit', $this->data); 
     80      $this->set('commit', $this->request->data); 
    8181      $this->Session->setFlash("Settings saved"); 
    8282    } 
    8383    $tree = $this->Option->getTree(0); 
    84     $this->data = $tree; 
     84    $this->request->data = $tree; 
    8585  } 
    8686   
    8787  /** Database upgrade via the Migraions plugin */ 
    8888  function upgrade($action = '') { 
     89    CakePlugin::load('Migrations'); 
    8990    App::import('Lib', 'Migrations.MigrationVersion'); 
    9091    $Migration = new MigrationVersion(array('connection' => 'default')); 
     
    101102    if ($action == 'run' && $currentVersion < $migrationVersion) { 
    102103      if (!$Migration->run(array('type' => 'app', 'direction' => 'up'))) { 
    103         $this->Session->setFlash(__("Database migration failed. Please see the log files for errors.", true)); 
     104        $this->Session->setFlash(__("Database migration failed. Please see the log files for errors.")); 
    104105        Logger::error("Could not run migration"); 
    105106      } else { 
    106107        Logger::info("Upgraded database from version $currentVersion to " . max(array_keys($Migration->getMapping('app')))); 
    107         $this->Session->setFlash(__("The database migration was successful.", true)); 
     108        $this->Session->setFlash(__("The database migration was successful.")); 
    108109      } 
    109110    } 
     
    122123 
    123124  function deleteUnusedMetaData($delete = '') { 
    124     App::import('Model', array('Tag', 'Category', 'Location')); 
     125    $this->Media->Tag->bindModel(array('hasAndBelongsToMany' => array('Media')), false); 
     126    $this->Media->Tag->Behaviors->attach('DeleteUnused', array('relatedHabtm' => 'Media')); 
    125127 
    126     $this->Tag =& new Tag(); 
    127     $this->Tag->bindModel(array('hasAndBelongsToMany' => array('Media')), false); 
    128     $this->Tag->Behaviors->attach('DeleteUnused', array('relatedHabtm' => 'Media')); 
    129     $unusedTagCount = count($this->Tag->findAllUnused()); 
     128    $this->Media->Category->bindModel(array('hasAndBelongsToMany' => array('Media')), false); 
     129    $this->Media->Category->Behaviors->attach('DeleteUnused', array('relatedHabtm' => 'Media')); 
    130130 
    131     $this->Category =& new Category(); 
    132     $this->Category->bindModel(array('hasAndBelongsToMany' => array('Media')), false); 
    133     $this->Category->Behaviors->attach('DeleteUnused', array('relatedHabtm' => 'Media')); 
    134     $unusedCategoryCount = count($this->Category->findAllUnused()); 
    135  
    136     $this->Location =& new Location(); 
    137     $this->Location->bindModel(array('hasAndBelongsToMany' => array('Media')), false); 
    138     $this->Location->Behaviors->attach('DeleteUnused', array('relatedHabtm' => 'Media')); 
    139     $unusedLocationCount = count($this->Location->findAllUnused()); 
     131    $this->Media->Location->bindModel(array('hasAndBelongsToMany' => array('Media')), false); 
     132    $this->Media->Location->Behaviors->attach('DeleteUnused', array('relatedHabtm' => 'Media')); 
    140133 
    141134    if ($delete == 'delete') { 
    142       $this->Tag->deleteAllUnused(); 
    143       $this->Location->deleteAllUnused(); 
    144       $this->Category->deleteAllUnused(); 
    145       $this->Session->setFlash(__("All unused meta data are deleted", true)); 
     135      $this->Media->Tag->deleteAllUnused(); 
     136      $this->Media->Location->deleteAllUnused(); 
     137      $this->Media->Category->deleteAllUnused(); 
     138      $this->Session->setFlash(__("All unused meta data are deleted")); 
    146139    } 
    147     $this->data = compact('unusedTagCount', 'unusedCategoryCount', 'unusedLocationCount'); 
     140 
     141    $unusedTagCount = count($this->Media->Tag->findAllUnused()); 
     142    $unusedCategoryCount = count($this->Media->Category->findAllUnused()); 
     143    $unusedLocationCount = count($this->Media->Location->findAllUnused()); 
     144 
     145    $this->request->data = compact('unusedTagCount', 'unusedCategoryCount', 'unusedLocationCount'); 
    148146  } 
    149147} 
  • Controller/UsersController.php

    re449ecc0 ree4c2b7f  
    3333    parent::beforeFilter(); 
    3434    $this->subMenu = array( 
    35       'index' => __("List User", true), 
     35      'index' => __("List User"), 
    3636      ); 
    3737    if ($this->hasRole(ROLE_SYSOP)) { 
    3838      $this->subMenu = am($this->subMenu, array( 
    39         array('action' => 'add', 'title' => __("Add User", true), 'admin' => true), 
    40         array('action' => 'register', 'title' => __("Registration", true), 'admin' => true), 
     39        array('action' => 'add', 'title' => __("Add User"), 'admin' => true), 
     40        array('action' => 'register', 'title' => __("Registration"), 'admin' => true), 
    4141        )); 
    4242    } 
     
    9090  function index() { 
    9191    $this->set('isAdmin', $this->hasRole(ROLE_SYSOP)); 
    92     $this->data = $this->User->findVisibleUsers($this->getUser()); 
     92    $this->request->data = $this->User->findVisibleUsers($this->getUser()); 
    9393  } 
    9494 
    9595  function view($name) { 
    96     $this->data = $this->User->findVisibleUsers($this->getUser(), $name); 
    97     if (!$this->data) { 
     96    $this->request->data = $this->User->findVisibleUsers($this->getUser(), $name); 
     97    if (!$this->request->data) { 
    9898      $this->redirect('index'); 
    9999    } 
    100     $userId = $this->data['User']['id']; 
    101     $this->data['Media']['count'] = $this->Media->find('count', array('conditions' => array('Media.user_id' => $userId), 'recursive' => -1)); 
    102     $this->data['File']['count'] = $this->MyFile->find('count', array('conditions' => array('File.user_id' => $userId), 'recursive' => -1)); 
     100    $userId = $this->request->data['User']['id']; 
     101    $this->request->data['Media']['count'] = $this->Media->find('count', array('conditions' => array('Media.user_id' => $userId), 'recursive' => -1)); 
     102    $this->request->data['File']['count'] = $this->MyFile->find('count', array('conditions' => array('File.user_id' => $userId), 'recursive' => -1)); 
    103103    $bytes = $this->MyFile->find('all', array('conditions' => array("File.user_id" => $userId), 'recursive' => -1, 'fields' => 'SUM(File.size) AS Bytes')); 
    104     $this->data['File']['bytes'] = $bytes[0][0]['Bytes']; 
     104    $this->request->data['File']['bytes'] = $bytes[0][0]['Bytes']; 
    105105 
    106106    $groupUserIds = Set::extract('/Group/user_id'); 
    107107    $this->set('users', $this->User->find('all', array('condition' => array('User.id' => $groupUserIds), 'recursive' => -1))); 
    108108 
    109     $this->Search->setUser($this->data['User']['username']); 
     109    $this->Search->setUser($this->request->data['User']['username']); 
    110110    $this->Search->setShow(6); 
    111111    $this->set('media', $this->Search->paginate()); 
     
    115115   * set the user is forwarded to this given address on successful login. */ 
    116116  function login() { 
    117     $failedText = __("Sorry. Wrong password or unknown username!", true); 
    118     if (!empty($this->data) && !$this->RequestHandler->isPost()) { 
     117    $failedText = __("Sorry. Wrong password or unknown username!"); 
     118    if (!empty($this->request->data) && !$this->RequestHandler->isPost()) { 
    119119      Logger::warn("Authentication failed: Request was not HTTP POST"); 
    120120      $this->Session->setFlash($failedText); 
    121       $this->data = null; 
    122     } 
    123     if (empty($this->data['User']['username']) xor empty($this->data['User']['password'])) { 
     121      $this->request->data = null; 
     122    } 
     123    if (empty($this->request->data['User']['username']) xor empty($this->request->data['User']['password'])) { 
    124124      Logger::warn("Authentication failed: Username or password are not set"); 
    125       $this->Session->setFlash(__("Please enter username and password!", true)); 
    126       $this->data = null;  
    127     } 
    128  
    129     if (!empty($this->data)) { 
    130       $user = $this->User->findByUsername($this->data['User']['username']); 
     125      $this->Session->setFlash(__("Please enter username and password!")); 
     126      $this->request->data = null;  
     127    } 
     128 
     129    if (!empty($this->request->data)) { 
     130      $user = $this->User->findByUsername($this->request->data['User']['username']); 
    131131 
    132132      if (!$user) { 
    133         Logger::warn("Authentication failed: Unknown username '{$this->data['User']['username']}'!"); 
     133        Logger::warn("Authentication failed: Unknown username '{$this->request->data['User']['username']}'!"); 
    134134        $this->Session->setFlash($failedText); 
    135135      } elseif ($this->User->isExpired($user)) { 
    136136        Logger::warn("User account of '{$user['User']['username']}' (id {$user['User']['id']}) is expired!"); 
    137         $this->Session->setFlash(__("Sorry. Your account is expired!", true)); 
     137        $this->Session->setFlash(__("Sorry. Your account is expired!")); 
    138138      } else { 
    139139        $user = $this->User->decrypt(&$user); 
    140         if ($user['User']['password'] == $this->data['User']['password']) { 
     140        if ($user['User']['password'] == $this->request->data['User']['password']) { 
    141141          $this->Session->renew(); 
    142           $this->Session->activate(); 
    143142          if (!$this->Session->check('User.id') || $this->Session->read('User.id') != $user['User']['id']) { 
    144143            Logger::info("Start new session for '{$user['User']['username']}' (id {$user['User']['id']})"); 
     
    158157          } else { 
    159158            Logger::err("Could not write session information of user '{$user['User']['username']}' ({$user['User']['id']})"); 
    160             $this->Session->setFlash(__("Sorry. Internal login procedure failed!", true)); 
     159            $this->Session->setFlash(__("Sorry. Internal login procedure failed!")); 
    161160          } 
    162161        } else { 
    163           Logger::warn("Authentication failed: Incorrect password of username '{$this->data['User']['username']}'!"); 
     162          Logger::warn("Authentication failed: Incorrect password of username '{$this->request->data['User']['username']}'!"); 
    164163          $this->Session->setFlash($failedText); 
    165164        } 
    166165      } 
    167       unset($this->data['User']['password']); 
     166      unset($this->request->data['User']['password']); 
    168167    } 
    169168    $this->set('register', $this->Option->getValue($this->getUser(), 'user.register.enable', 0)); 
     
    186185    $this->requireRole(ROLE_SYSOP, array('loginRedirect' => '/admin/users')); 
    187186 
    188     $this->data = $this->paginate('User', array('User.role>='.ROLE_USER)); 
     187    $this->request->data = $this->paginate('User', array('User.role>='.ROLE_USER)); 
    189188  } 
    190189 
     
    195194    $userId = $this->getUserId(); 
    196195    $userRole = $this->getUserRole(); 
    197     if ($userId == $id && $userRole == ROLE_ADMIN && $this->data['User']['role'] < ROLE_ADMIN) { 
     196    if ($userId == $id && $userRole == ROLE_ADMIN && $this->request->data['User']['role'] < ROLE_ADMIN) { 
    198197      $count = $this->User->find('count', array('conditions' => array('User.role >= '.ROLE_ADMIN))); 
    199198      if ($count == 1) { 
    200199        Logger::warn('Can not degrade last admin'); 
    201         $this->Session->setFlash(__('Can not degrade last admin', true)); 
     200        $this->Session->setFlash(__('Can not degrade last admin')); 
    202201        return false; 
    203202      } 
     
    209208  function _addAdminEditMenu($userId) { 
    210209    $subActions = array( 
    211       'password' => __("Password", true), 
    212       'path' => __("Local Paths", true)); 
    213     $subItems = array('url' => array('admin' => true, 'action' => 'edit', $userId), 'title' => __('Edit', true), 'active' => true); 
     210      'password' => __("Password"), 
     211      'path' => __("Local Paths")); 
     212    $subItems = array('url' => array('admin' => true, 'action' => 'edit', $userId), 'title' => __('Edit'), 'active' => true); 
    214213    foreach ($subActions as $action => $title) { 
    215214      $subItems[] = array('url' => array('admin' => true, 'action' => $action, $userId), 'title' => $title, 'active' => ('admin_'.$action == $this->action)); 
     
    223222 
    224223    $id = intval($id); 
    225     if (!empty($this->data) && $this->_lastAdminCheck($id)) { 
    226       $this->data['User']['id'] = $id; 
    227  
    228       if ($this->User->save($this->data, true, array('email', 'expires', 'quota', 'firstname', 'lastname', 'role'))) { 
    229         Logger::debug("Data of user {$this->data['User']['id']} was updated"); 
    230         $this->Session->setFlash(__('User data was updated', true)); 
     224    if (!empty($this->request->data) && $this->_lastAdminCheck($id)) { 
     225      $this->request->data['User']['id'] = $id; 
     226 
     227      if ($this->User->save($this->request->data, true, array('email', 'expires', 'quota', 'firstname', 'lastname', 'role'))) { 
     228        Logger::debug("Data of user {$this->request->data['User']['id']} was updated"); 
     229        $this->Session->setFlash(__('User data was updated')); 
    231230      } else { 
    232231        Logger::err("Could not save user data"); 
    233232        Logger::debug($this->User->validationErrors); 
    234         $this->Session->setFlash(__('Could not be updated', true)); 
    235       } 
    236     } 
    237  
    238     $this->data = $this->User->findById($id); 
     233        $this->Session->setFlash(__('Could not be updated')); 
     234      } 
     235    } 
     236 
     237    $this->request->data = $this->User->findById($id); 
    239238    $this->set('allowAdminRole', ($this->getUserRole() == ROLE_ADMIN) ? true : false); 
    240239 
     
    246245 
    247246    $id = intval($id); 
    248     if (!empty($this->data)) { 
    249       $this->data['User']['id'] = $id; 
    250  
    251       if ($this->User->save($this->data, true, array('password'))) { 
    252         Logger::debug("Data of user {$this->data['User']['id']} was updated"); 
    253         $this->Session->setFlash(__('User data was updated', true)); 
     247    if (!empty($this->request->data)) { 
     248      $this->request->data['User']['id'] = $id; 
     249 
     250      if ($this->User->save($this->request->data, true, array('password'))) { 
     251        Logger::debug("Data of user {$this->request->data['User']['id']} was updated"); 
     252        $this->Session->setFlash(__('User data was updated')); 
    254253      } else { 
    255254        Logger::err("Could not save user data"); 
    256255        Logger::debug($this->User->validationErrors); 
    257         $this->Session->setFlash(__('Could not be updated', true)); 
    258       } 
    259     } 
    260  
    261     $this->data = $this->User->findById($id); 
    262     unset($this->data['User']['password']); 
     256        $this->Session->setFlash(__('Could not be updated')); 
     257      } 
     258    } 
     259 
     260    $this->request->data = $this->User->findById($id); 
     261    unset($this->request->data['User']['password']); 
    263262 
    264263    $this->_addAdminEditMenu($id); 
     
    269268 
    270269    $id = intval($id); 
    271     if (!empty($this->data)) { 
    272       $this->data['User']['id'] = $id; 
    273  
    274       $this->User->set($this->data); 
    275  
    276       if (!empty($this->data['Option']['path']['fspath'])) { 
    277         $fsroot = $this->data['Option']['path']['fspath']; 
     270    if (!empty($this->request->data)) { 
     271      $this->request->data['User']['id'] = $id; 
     272 
     273      $this->User->set($this->request->data); 
     274 
     275      if (!empty($this->request->data['Option']['path']['fspath'])) { 
     276        $fsroot = $this->request->data['Option']['path']['fspath']; 
    278277        $fsroot = Folder::slashTerm($fsroot); 
    279278 
    280279        if (is_dir($fsroot) && is_readable($fsroot)) { 
    281280          $this->Option->addValue('path.fsroot[]', $fsroot, $id); 
    282           $this->Session->setFlash(sprintf(__("Directory '%s' was added", true), $fsroot)); 
     281          $this->Session->setFlash(__("Directory '%s' was added", $fsroot)); 
    283282          Logger::info("Add external directory '$fsroot' to user $id"); 
    284283        } else { 
    285           $this->Session->setFlash(sprintf(__("Directory '%s' could not be read", true), $fsroot)); 
     284          $this->Session->setFlash(__("Directory '%s' could not be read", $fsroot)); 
    286285          Logger::err("Directory '$fsroot' could not be read"); 
    287286        } 
     
    289288    } 
    290289 
    291     $this->data = $this->User->findById($id); 
    292     unset($this->data['User']['password']); 
    293  
    294     $this->set('fsroots', $this->Option->buildTree($this->data, 'path.fsroot')); 
     290    $this->request->data = $this->User->findById($id); 
     291    unset($this->request->data['User']['password']); 
     292 
     293    $this->set('fsroots', $this->Option->buildTree($this->request->data, 'path.fsroot')); 
    295294    $this->_addAdminEditMenu($id); 
    296295  } 
     
    299298    $this->requireRole(ROLE_SYSOP, array('loginRedirect' => '/admin/users')); 
    300299 
    301     if (!empty($this->data)) { 
    302       if ($this->User->hasAny(array('User.username' => $this->data['User']['username']))) { 
    303         $this->Session->setFlash(__('Username already exists, please choose a different name!', true)); 
     300    if (!empty($this->request->data)) { 
     301      if ($this->User->hasAny(array('User.username' => $this->request->data['User']['username']))) { 
     302        $this->Session->setFlash(__('Username already exists, please choose a different name!')); 
    304303      } else { 
    305         $this->data['User']['role'] = ROLE_USER; 
    306         if ($this->User->save($this->data, true, array('username', 'password', 'role', 'email'))) { 
    307           Logger::info("New user {$this->data['User']['username']} was created"); 
    308           $this->Session->setFlash(__('User was created', true)); 
     304        $this->request->data['User']['role'] = ROLE_USER; 
     305        if ($this->User->save($this->request->data, true, array('username', 'password', 'role', 'email'))) { 
     306          Logger::info("New user {$this->request->data['User']['username']} was created"); 
     307          $this->Session->setFlash(__('User was created')); 
    309308          $this->redirect('/admin/users/edit/'.$this->User->id); 
    310309        } else { 
    311           Logger::warn("Creation of user {$this->data['User']['username']} failed"); 
    312           $this->Session->setFlash(__('Could not create user!', true)); 
     310          Logger::warn("Creation of user {$this->request->data['User']['username']} failed"); 
     311          $this->Session->setFlash(__('Could not create user!')); 
    313312        } 
    314313      } 
     
    322321    $user = $this->User->findById($id); 
    323322    if (!$user) { 
    324       $this->Session->setFlash(__("Could not delete user: user not found!", true)); 
     323      $this->Session->setFlash(__("Could not delete user: user not found!")); 
    325324      $this->redirect('index'); 
    326325    } else { 
    327326      $this->User->delete($id); 
    328327      Logger::notice("All data of user '{$user['User']['username']}' ($id) deleted"); 
    329       $this->Session->setFlash(sprintf(__("User %s was deleted", true), $user['User']['username'])); 
     328      $this->Session->setFlash(__("User %s was deleted", $user['User']['username'])); 
    330329      $this->redirect('index'); 
    331330    } 
     
    346345    $this->Option->delValue('path.fsroot[]', $fsroot, $id); 
    347346    Logger::info("Deleted external directory '$fsroot' from user $id"); 
    348     $this->Session->setFlash(sprintf(__("Deleted external directory '%s'", true), $fsroot)); 
     347    $this->Session->setFlash(__("Deleted external directory '%s'", $fsroot)); 
    349348    $this->redirect("path/$id"); 
    350349  } 
     
    353352    $this->requireRole(ROLE_SYSOP, array('loginRedirect' => '/admin/users')); 
    354353 
    355     if (!empty($this->data)) { 
    356       if ($this->data['user']['register']['enable']) { 
     354    if (!empty($this->request->data)) { 
     355      if ($this->request->data['user']['register']['enable']) { 
    357356        $this->Option->setValue('user.register.enable', 1, 0); 
    358357      } else { 
    359358        $this->Option->setValue('user.register.enable', 0, 0); 
    360359      } 
    361       $quota = $this->__fromReadableSize($this->data['user']['register']['quota']); 
     360      $quota = $this->__fromReadableSize($this->request->data['user']['register']['quota']); 
    362361      $this->Option->setValue('user.register.quota', $quota, 0);  
    363       $this->Session->setFlash(__("Options saved!", true)); 
    364     } 
    365     $this->data = $this->Option->getTree($this->getUserId()); 
     362      $this->Session->setFlash(__("Options saved!")); 
     363    } 
     364    $this->request->data = $this->Option->getTree($this->getUserId()); 
    366365 
    367366    // add default values 
    368     if (!isset($this->data['user']['register']['enable'])) { 
    369       $this->data['user']['register']['enable'] = 0; 
    370     } 
    371     if (!isset($this->data['user']['register']['quota'])) { 
    372       $this->data['user']['register']['quota'] = (float)100*1024*1024; 
     367    if (!isset($this->request->data['user']['register']['enable'])) { 
     368      $this->request->data['user']['register']['enable'] = 0; 
     369    } 
     370    if (!isset($this->request->data['user']['register']['quota'])) { 
     371      $this->request->data['user']['register']['quota'] = (float)100*1024*1024; 
    373372    } 
    374373     
     
    377376  /** Password recovery */ 
    378377  function password() { 
    379     if (!empty($this->data)) { 
    380       $user = $this->User->find(array( 
    381           'username' => $this->data['User']['username'],  
    382           'email' => $this->data['User']['email'])); 
     378    if (!empty($this->request->data)) { 
     379      $user = $this->User->find('first', array('conditions' => array( 
     380          'username' => $this->request->data['User']['username'],  
     381          'email' => $this->request->data['User']['email']))); 
    383382      if (empty($user)) { 
    384         $this->Session->setFlash(__('No user with this email was found', true)); 
     383        $this->Session->setFlash(__('No user with this email was found')); 
    385384        Logger::warn(sprintf("No user '%s' with email %s was found", 
    386             $this->data['User']['username'], $this->data['User']['email'])); 
     385            $this->request->data['User']['username'], $this->request->data['User']['email'])); 
    387386      } else { 
    388387        $this->Email->to = sprintf("%s %s <%s>",  
     
    402401            $user['User']['id'], 
    403402            $user['User']['email'])); 
    404           $this->Session->setFlash(__('Mail was sent!', true)); 
     403          $this->Session->setFlash(__('Mail was sent!')); 
    405404        } else { 
    406405          Logger::err(sprintf("Could not send password mail to user '%s' (id %d) with address '%s'", 
     
    408407            $user['User']['id'], 
    409408            $user['User']['email'])); 
    410           $this->Session->setFlash(__('Mail could not be sent: unknown error!', true)); 
     409          $this->Session->setFlash(__('Mail could not be sent: unknown error!')); 
    411410        } 
    412411      } 
     
    423422    } 
    424423 
    425     if (!empty($this->data)) { 
    426       if ($this->data['Captcha']['verification'] != $this->Session->read('user.register.captcha')) { 
    427         $this->Session->setFlash(__('Captcha verification failed', true)); 
     424    if (!empty($this->request->data)) { 
     425      if ($this->request->data['Captcha']['verification'] != $this->Session->read('user.register.captcha')) { 
     426        $this->Session->setFlash(__('Captcha verification failed')); 
    428427        Logger::verbose("Captcha verification failed"); 
    429       } elseif ($this->User->hasAny(array('User.username' => $this->data['User']['username']))) { 
    430         $this->Session->setFlash(__('Username already exists, please choose different name!', true)); 
    431         Logger::info("Username already exists: {$this->data['User']['username']}"); 
     428      } elseif ($this->User->hasAny(array('User.username' => $this->request->data['User']['username']))) { 
     429        $this->Session->setFlash(__('Username already exists, please choose different name!')); 
     430        Logger::info("Username already exists: {$this->request->data['User']['username']}"); 
    432431      } else { 
    433         $user = $this->User->create($this->data); 
     432        $user = $this->User->create($this->request->data); 
    434433        if ($this->User->save($user['User'], true, array('id', 'username', 'password', 'email'))) { 
    435           Logger::info("New user {$this->data['User']['username']} was created"); 
     434          Logger::info("New user {$this->request->data['User']['username']} was created"); 
    436435          $this->_initRegisteredUser($this->User->getLastInsertID()); 
    437436        } else { 
    438           Logger::err("Creation of user {$this->data['User']['username']} failed"); 
    439           $this->Session->setFlash(__('Could not create user', true)); 
     437          Logger::err("Creation of user {$this->request->data['User']['username']} failed"); 
     438          $this->Session->setFlash(__('Could not create user')); 
    440439        } 
    441440      } 
    442441    } 
    443     unset($this->data['User']['password']); 
    444     unset($this->data['User']['confirm']); 
    445     unset($this->data['Captcha']['verification']); 
     442    unset($this->request->data['User']['password']); 
     443    unset($this->request->data['User']['confirm']); 
     444    unset($this->request->data['Captcha']['verification']); 
    446445    $this->layout = 'default'; 
    447446  } 
     
    474473    // send confimation email 
    475474    if (!$this->_sendConfirmationEmail($user, $key)) { 
    476       $this->Session->setFlash(__("Could not send the confirmation email. Please contact the admin.", true)); 
    477       return false; 
    478     } 
    479     $this->Session->setFlash(__("A confirmation email was sent to your email address", true)); 
     475      $this->Session->setFlash(__("Could not send the confirmation email. Please contact the admin.")); 
     476      return false; 
     477    } 
     478    $this->Session->setFlash(__("A confirmation email was sent to your email address")); 
    480479    $this->redirect("/users/confirm"); 
    481480  } 
     
    489488    } 
    490489 
    491     if (!$key && !empty($this->data)) { 
     490    if (!$key && !empty($this->request->data)) { 
    492491      // check user input 
    493       if (empty($this->data['User']['key'])) { 
    494         $this->Session->setFlash(__("Please enter the confirmation key", true)); 
     492      if (empty($this->request->data['User']['key'])) { 
     493        $this->Session->setFlash(__("Please enter the confirmation key")); 
    495494      } else {  
    496         $key = $this->data['User']['key'];  
     495        $key = $this->request->data['User']['key'];  
    497496      } 
    498497    } 
     
    507506  function _checkConfirmation($key) { 
    508507    // check key. Option [belongsTo] User: The user is bound to option 
    509     $user = $this->Option->find(array("Option.value" => $key)); 
     508    $user = $this->Option->find('first', array('conditions' => array("Option.value" => $key))); 
    510509    if (!$user) { 
    511510      Logger::trace("Could not find confirmation key"); 
    512       $this->Session->setFlash(__("Could not find confirmation key", true)); 
     511      $this->Session->setFlash(__("Could not find confirmation key")); 
    513512      return false; 
    514513    }  
     
    516515    if (!isset($user['User']['id'])) { 
    517516      Logger::err("Could not find the user for register confirmation"); 
    518       $this->Session->setFlash(__("Internal error occured", true)); 
     517      $this->Session->setFlash(__("Internal error occured")); 
    519518      return false; 
    520519    } 
     
    525524    $expires = strtotime($user['User']['expires']); 
    526525    if ($now - $expires > (14 * 24 * 3600 + 3600)) { 
    527       $this->Session->setFlash(__("Could not find confirmation key", true)); 
     526      $this->Session->setFlash(__("Could not find confirmation key")); 
    528527      Logger::err("Registration confirmation is expired."); 
    529528      $this->User->delete($user['User']['id']); 
  • Model/AppModel.php

    rbbc826a ree4c2b7f  
    232232    if ($this->data) { 
    233233      $data = $this->stripAlias(); 
    234       $name = Inflector::underscore($name); 
    235       if (isset($data[$name])) { 
    236         return $data[$name]; 
     234      $unserscore = Inflector::underscore($name); 
     235      if (isset($data[$unserscore])) { 
     236        return $data[$unserscore]; 
    237237      } 
    238238    } 
  • Model/MyFile.php

    re449ecc0 ree4c2b7f  
    126126    $path = Folder::slashTerm(dirname($filename)); 
    127127 
    128     return $this->find(array("path" => $path, "file" => $file)); 
     128    return $this->find('first', array('conditions' => array("path" => $path, "file" => $file))); 
    129129  } 
    130130 
  • View/Browser/folder.ctp

    r0fb8d7c ree4c2b7f  
    33<?php echo $this->Session->flash(); ?> 
    44 
    5 <p><?php echo __("Location %s", $fileList->location($path)); ?></p> 
     5<p><?php echo __("Location %s", $this->FileList->location($path)); ?></p> 
    66 
    77<?php echo $this->Form->create(false, array('action' => 'folder/'.$path)); ?> 
  • View/Browser/sync.ctp

    r0fb8d7c ree4c2b7f  
    77<p><?php echo __("Note:  In case you are using phTagr with external paths it is recommended to synchronize your images to store this important information within the media file.  After the synchronization these mata data could be read by other image programs or desktop search engines."); ?> 
    88 
    9 <?php if ($this->data['action'] != 'run' && $this->data['unsynced'] > 0): ?> 
    10 <p><?php echo __("You have %d unsynchronized media. Click %s to start the synchronization (this might take some time)", $this->data['unsynced'], $this->Html->link(__("sync"), 'sync/run')); ?></p> 
     9<?php if ($this->request->data['action'] != 'run' && $this->request->data['unsynced'] > 0): ?> 
     10<p><?php echo __("You have %d unsynchronized media. Click %s to start the synchronization (this might take some time)", $this->request->data['unsynced'], $this->Html->link(__("sync"), 'sync/run')); ?></p> 
    1111<?php endif; ?> 
    1212 
    13 <?php if ($this->data['unsynced'] == 0): ?> 
     13<?php if ($this->request->data['unsynced'] == 0): ?> 
    1414<div class="info"><?php echo __("All media are synchronized"); ?></div> 
    1515<?php endif; ?> 
    1616 
    17 <?php if (count($this->data['errors'])): ?> 
     17<?php if (count($this->request->data['errors'])): ?> 
    1818<div class="error"><?php echo __("Some files could not be updated with new metadata. Mainly this happens if the files are write protected. Please have a look to the log files for details."); ?></div> 
    1919<?php endif; ?> 
    2020 
    21 <?php if ($this->data['action'] == 'run'): ?> 
     21<?php if ($this->request->data['action'] == 'run'): ?> 
    2222<p><?php  
    23   echo __("Synchronized %d media.", count($this->data['synced'])); 
    24   if ($this->data['unsynced']) { 
    25     echo __(" %d media remains unsynced. Click %s to synchronize again", $this->data['unsynced'], $this->Html->link(__('sync', 'sync/run')));  
     23  echo __("Synchronized %d media.", count($this->request->data['synced'])); 
     24  if ($this->request->data['unsynced']) { 
     25    echo __(" %d media remains unsynced. Click %s to synchronize again", $this->request->data['unsynced'], $this->Html->link(__('sync', 'sync/run')));  
    2626  } 
    2727?></p> 
  • View/Browser/upload.ctp

    r0fb8d7c ree4c2b7f  
    44 
    55<?php if ($free > 0): ?> 
    6 <p><?php echo __("You upload files to folder %s", $fileList->location($path)); ?></p> 
     6<p><?php echo __("You upload files to folder %s", $this->FileList->location($path)); ?></p> 
    77<p><?php echo __("You can upload maximal %s and %s at once", $this->Number->toReadableSize($free), $this->Number->toReadableSize($max)); ?></p> 
    88 
  • View/Comments/index.ctp

    r0fb8d7c ree4c2b7f  
    44<?php if ($comments): ?> 
    55<div class="paginator"><div class="subpaginator"> 
    6 <?php echo $paginator->prev().' '.$paginator->numbers().' '.$paginator->next(); ?> 
     6<?php echo $this->Paginator->prev().' '.$this->Paginator->numbers().' '.$this->Paginator->next(); ?> 
    77</div></div> 
    88 
     
    1313<div class="meta"> 
    1414<span class="from"><?php echo $comment['Comment']['name'] ?></span> said  
    15 <span class="date"><?php echo $time->relativeTime($comment['Comment']['date']); ?></span> 
     15<span class="date"><?php echo $this->Time->timeAgoInWords($comment['Comment']['date']); ?></span> 
    1616</div><!-- comment meta --> 
    1717 
     
    2121  $link = '/images/view/'.$comment['Media']['id']; 
    2222  echo '<div class="image">'.$this->Html->link($img, $link, array('escape' => false)).'</div>';?> 
    23 <?php echo preg_replace('/\n/', '<br />', $text->truncate($comment['Comment']['text'], 220, array('ending' => '...', 'exact' => false, 'html' => false))); ?> 
     23<?php echo preg_replace('/\n/', '<br />', $this->Text->truncate($comment['Comment']['text'], 220, array('ending' => '...', 'exact' => false, 'html' => false))); ?> 
    2424</div> 
    2525</div><!-- comment --> 
     
    2828 
    2929<div class="paginator"><div class="subpaginator"> 
    30 <?php echo $paginator->prev().' '.$paginator->numbers().' '.$paginator->next(); ?> 
     30<?php echo $this->Paginator->prev().' '.$this->Paginator->numbers().' '.$this->Paginator->next(); ?> 
    3131</div></div> 
    3232 
  • View/Comments/rss.ctp

    r1a41cea ree4c2b7f  
    1010} 
    1111 
    12 echo $rss->items($this->data, 'getItem'); 
     12echo $rss->items($this->request->data, 'getItem'); 
    1313?> 
  • View/Elements/Explorer/description.ctp

    r0fb8d7c ree4c2b7f  
    11<?php  
    22  $this->Search->initialize();  
    3   echo $this->element('explorer/date', array('media' => $media)); 
     3  echo $this->element('Explorer/date', array('media' => $media)); 
    44  if (count($media['Tag'])) { 
    55    echo $this->Html->tag('p',  
  • View/Elements/Explorer/media.ctp

    r0fb8d7c ree4c2b7f  
    6262</div> 
    6363<div class="p-explorer-media-description" id="<?php echo 'description-'.$media['Media']['id']; ?>"> 
    64 <?php echo $this->element('explorer/description', array('media' => $media)); ?> 
     64<?php echo $this->element('Explorer/description', array('media' => $media)); ?> 
    6565</div> 
  • View/Elements/Explorer/menu.ctp

    r0fb8d7c ree4c2b7f  
    11<?php 
    22  $canWriteTag = $canWriteMeta = $canWriteCaption = $canWriteAcl = 0; 
    3   if (count($this->data)) { 
    4     $canWriteTag = max(Set::extract('/Media/canWriteTag', $this->data)); 
    5     $canWriteMeta = max(Set::extract('/Media/canWriteMeta', $this->data)); 
    6     $canWriteCaption = max(Set::extract('/Media/canWriteCaption', $this->data)); 
    7     $canWriteAcl = max(Set::extract('/Media/canWriteAcl', $this->data)); 
     3  if (count($this->request->data)) { 
     4    $canWriteTag = max(Set::extract('/Media/canWriteTag', $this->request->data)); 
     5    $canWriteMeta = max(Set::extract('/Media/canWriteMeta', $this->request->data)); 
     6    $canWriteCaption = max(Set::extract('/Media/canWriteCaption', $this->request->data)); 
     7    $canWriteAcl = max(Set::extract('/Media/canWriteAcl', $this->request->data)); 
    88  } 
    99?> 
     
    3434<?php 
    3535  $user = $this->Search->getUser(); 
    36   $tagUrls = $this->ImageData->getAllExtendSearchUrls($crumbs, $user, 'tag', array_unique(Set::extract('/Tag/name', $this->data))); 
     36  $tagUrls = $this->ImageData->getAllExtendSearchUrls($crumbs, $user, 'tag', array_unique(Set::extract('/Tag/name', $this->request->data))); 
    3737  ksort($tagUrls); 
    38   $categoryUrls = $this->ImageData->getAllExtendSearchUrls($crumbs, $user, 'category', array_unique(Set::extract('/Category/name', $this->data))); 
     38  $categoryUrls = $this->ImageData->getAllExtendSearchUrls($crumbs, $user, 'category', array_unique(Set::extract('/Category/name', $this->request->data))); 
    3939  ksort($categoryUrls); 
    40   $locationUrls = $this->ImageData->getAllExtendSearchUrls($crumbs, $user, 'location', array_unique(Set::extract('/Location/name', $this->data))); 
     40  $locationUrls = $this->ImageData->getAllExtendSearchUrls($crumbs, $user, 'location', array_unique(Set::extract('/Location/name', $this->request->data))); 
    4141  ksort($locationUrls); 
    4242 
     
    6565<p><?php echo __('Users') . " "; ?> 
    6666<?php 
    67   $userUrls = $this->ImageData->getAllExtendSearchUrls($crumbs, false, 'user', array_unique(Set::extract('/User/username', $this->data))); 
     67  $userUrls = $this->ImageData->getAllExtendSearchUrls($crumbs, false, 'user', array_unique(Set::extract('/User/username', $this->request->data))); 
    6868  foreach ($userUrls as $name => $urls) { 
    6969    echo $this->ImageData->getExtendSearchLinks($urls, $name, ($name == $user)) . ' '; 
     
    9999  if ($canWriteTag) { 
    100100    echo $this->Form->input('Tag.names', array('label' => __('Tags'), 'after' => $this->Html->tag('div', __('E.g. newtag, -oldtag'), array('class' => 'description')))); 
    101     echo $autocomplete->autoComplete('Tag.names', 'autocomplete/tag', array('split' => true)); 
     101    echo $this->Autocomplete->autoComplete('Tag.names', 'autocomplete/tag', array('split' => true)); 
    102102  } 
    103103  if ($canWriteMeta) { 
    104104    echo $this->Form->input('Category.names', array('label' => __('Categories'))); 
    105     echo $autocomplete->autoComplete('Category.names', 'autocomplete/category', array('split' => true)); 
     105    echo $this->Autocomplete->autoComplete('Category.names', 'autocomplete/category', array('split' => true)); 
    106106    echo $this->Form->input('Location.city', array('label' => __('City'))); 
    107     echo $autocomplete->autoComplete('Location.city', 'autocomplete/city'); 
     107    echo $this->Autocomplete->autoComplete('Location.city', 'autocomplete/city'); 
    108108    echo $this->Form->input('Location.sublocation', array('label' => __('Sublocation'))); 
    109     echo $autocomplete->autoComplete('Location.sublocation', 'autocomplete/sublocation'); 
     109    echo $this->Autocomplete->autoComplete('Location.sublocation', 'autocomplete/sublocation'); 
    110110    echo $this->Form->input('Location.state', array('label' => __('State'))); 
    111     echo $autocomplete->autoComplete('Location.state', 'autocomplete/state'); 
     111    echo $this->Autocomplete->autoComplete('Location.state', 'autocomplete/state'); 
    112112    echo $this->Form->input('Location.country', array('label' => __('Country'))); 
    113     echo $autocomplete->autoComplete('Location.country', 'autocomplete/country'); 
     113    echo $this->Autocomplete->autoComplete('Location.country', 'autocomplete/country'); 
    114114    echo $this->Form->input('Media.geo', array('label' => __('Geo data'), 'maxlength' => 32, 'after' => $this->Html->tag('div', __('latitude, longitude'), array('class' => 'description')))); 
    115115  } 
  • View/Elements/comment.ctp

    r0fb8d7c ree4c2b7f  
    44?> 
    55<div id="comments"> 
    6 <?php if (count($this->data['Comment'])): ?> 
     6<?php if (count($this->request->data['Comment'])): ?> 
    77<h3><?php echo __('Comments'); ?></h3> 
    88<?php $count = 0; ?> 
    9 <?php foreach ($this->data['Comment'] as $key => $comment): ?> 
     9<?php foreach ($this->request->data['Comment'] as $key => $comment): ?> 
    1010<?php if (!is_numeric($key)) continue; ?> 
    1111<div class="comment <?php echo ($count++%2)?'even':'odd'; ?>"> 
     
    1616    $name = $this->Html->link($comment['name'], $comment['url']); 
    1717  }   
    18   $time = $this->Html->tag('span', $this->Time->relativeTime($comment['date']), array('class' => 'date')); 
    19   __("%s said %s", $name, $time); 
     18  $this->Time = $this->Html->tag('span', $this->Time->timeAgoInWords($comment['date']), array('class' => 'date')); 
     19  __("%s said %s", $name, $this->Time); 
    2020?> 
    2121<?php 
    22   if ($this->data['Media']['isOwner'] || $comment['user_id'] == $userId) { 
     22  if ($this->request->data['Media']['isOwner'] || $comment['user_id'] == $userId) { 
    2323    echo $this->Html->link(__('(delete)'), '/comments/delete/'.$comment['id'].'/'.$this->SearchParams); 
    2424  } 
     
    3737<fieldset> 
    3838<?php 
    39   echo $this->Form->hidden('Media.id', array('value' => $this->data['Media']['id'])); 
     39  echo $this->Form->hidden('Media.id', array('value' => $this->request->data['Media']['id'])); 
    4040?> 
    4141<?php  
  • View/Elements/footer.ctp

    r0fb8d7c ree4c2b7f  
    11<?php  
    22global $TIME_START;  
    3 $time = microtime(true) - $TIME_START; 
    4 __("%s Social Web Gallery %s in %.3fs. Layout based on %s, Icons by %s", '&copy; 2006-2010',  $this->Html->link('phtagr.org', 'http://www.phtagr.org'),  $time, $this->Html->link('YAML', 'http://www.yaml.de'), $this->Html->link('FamFamFam', 'http://www.famfamfam.com'));  
     3$this->Time = microtime(true) - $TIME_START; 
     4__("%s Social Web Gallery %s in %.3fs. Layout based on %s, Icons by %s", '&copy; 2006-2010',  $this->Html->link('phtagr.org', 'http://www.phtagr.org'),  $this->Time, $this->Html->link('YAML', 'http://www.yaml.de'), $this->Html->link('FamFamFam', 'http://www.famfamfam.com'));  
    55?> 
  • View/Elements/single_acl_form.ctp

    r0fb8d7c ree4c2b7f  
    11<?php 
    2   echo $this->ImageData->acl2select('Media.readPreview', $this->data, ACL_READ_PREVIEW, ACL_READ_MASK, array('label' => __("Who can view image?"))); 
    3   echo $this->ImageData->acl2select('Media.readOriginal', $this->data, ACL_READ_ORIGINAL, ACL_READ_MASK, array('label' => __("Who can download the image?"))); 
    4   echo $this->ImageData->acl2select('Media.writeTag', $this->data, ACL_WRITE_TAG, ACL_WRITE_MASK, array('label' => __("Who can edit the tags?"))); 
    5   echo $this->ImageData->acl2select('Media.writeMeta', $this->data, ACL_WRITE_META, ACL_WRITE_MASK, array('label' => __("Who can edit all meta data?"))); 
    6   echo $this->Form->input('Group.id', array('type' => 'select', 'options' => $groups, 'selected' => $this->data['Media']['group_id'], 'label' => __('Group'))); 
     2  echo $this->ImageData->acl2select('Media.readPreview', $this->request->data, ACL_READ_PREVIEW, ACL_READ_MASK, array('label' => __("Who can view image?"))); 
     3  echo $this->ImageData->acl2select('Media.readOriginal', $this->request->data, ACL_READ_ORIGINAL, ACL_READ_MASK, array('label' => __("Who can download the image?"))); 
     4  echo $this->ImageData->acl2select('Media.writeTag', $this->request->data, ACL_WRITE_TAG, ACL_WRITE_MASK, array('label' => __("Who can edit the tags?"))); 
     5  echo $this->ImageData->acl2select('Media.writeMeta', $this->request->data, ACL_WRITE_META, ACL_WRITE_MASK, array('label' => __("Who can edit all meta data?"))); 
     6  echo $this->Form->input('Group.id', array('type' => 'select', 'options' => $groups, 'selected' => $this->request->data['Media']['group_id'], 'label' => __('Group'))); 
    77?> 
  • View/Elements/single_meta_form.ctp

    r0fb8d7c ree4c2b7f  
    11<?php 
    2   if ($this->data['Media']['canWriteTag']) { 
    3     echo $this->Form->input('Tag.names', array('label' => __('Tags'), 'value' => join(', ', Set::extract('/Tag/name', $this->data)))); 
    4     echo $autocomplete->autoComplete('Tag.names', '/explorer/autocomplete/tag', array('split' => true)); 
     2  if ($this->request->data['Media']['canWriteTag']) { 
     3    echo $this->Form->input('Tag.names', array('label' => __('Tags'), 'value' => join(', ', Set::extract('/Tag/name', $this->request->data)))); 
     4    echo $this->Autocomplete->autoComplete('Tag.names', '/explorer/autocomplete/tag', array('split' => true)); 
    55  } 
    6   if ($this->data['Media']['canWriteMeta']) { 
    7     echo $this->Form->input('Category.names', array('label' => __('Categories'), 'value' => join(', ', Set::extract('/Category/name', $this->data)))); 
    8     echo $autocomplete->autoComplete('Category.names', '/explorer/autocomplete/category', array('split' => true)); 
    9     echo $this->Form->input('Location.city', array('label' => __('City'), 'value' => join('', Set::extract('/Location[type='.LOCATION_CITY.']/name', $this->data)))); 
    10     echo $autocomplete->autoComplete('Locations.city', '/explorer/autocomplete/city'); 
    11     echo $this->Form->input('Location.sublocation', array('label' => __('Sublocation'), 'value' => join('', Set::extract('/Location[type='.LOCATION_SUBLOCATION.']/name', $this->data)))); 
    12     echo $autocomplete->autoComplete('Location.sublocation', '/explorer/autocomplete/sublocation'); 
    13     echo $this->Form->input('Location.state', array('label' => __('State'), 'value' => join('', Set::extract('/Location[type='.LOCATION_STATE.']/name', $this->data)))); 
    14     echo $autocomplete->autoComplete('Location.state', '/explorer/autocomplete/state'); 
    15     echo $this->Form->input('Location.country', array('label' => __('Country'), 'value' => join('', Set::extract('/Location[type='.LOCATION_COUNTRY.']/name', $this->data)))); 
    16     echo $autocomplete->autoComplete('Location.country', '/explorer/autocomplete/country'); 
     6  if ($this->request->data['Media']['canWriteMeta']) { 
     7    echo $this->Form->input('Category.names', array('label' => __('Categories'), 'value' => join(', ', Set::extract('/Category/name', $this->request->data)))); 
     8    echo $this->Autocomplete->autoComplete('Category.names', '/explorer/autocomplete/category', array('split' => true)); 
     9    echo $this->Form->input('Location.city', array('label' => __('City'), 'value' => join('', Set::extract('/Location[type='.LOCATION_CITY.']/name', $this->request->data)))); 
     10    echo $this->Autocomplete->autoComplete('Locations.city', '/explorer/autocomplete/city'); 
     11    echo $this->Form->input('Location.sublocation', array('label' => __('Sublocation'), 'value' => join('', Set::extract('/Location[type='.LOCATION_SUBLOCATION.']/name', $this->request->data)))); 
     12    echo $this->Autocomplete->autoComplete('Location.sublocation', '/explorer/autocomplete/sublocation'); 
     13    echo $this->Form->input('Location.state', array('label' => __('State'), 'value' => join('', Set::extract('/Location[type='.LOCATION_STATE.']/name', $this->request->data)))); 
     14    echo $this->Autocomplete->autoComplete('Location.state', '/explorer/autocomplete/state'); 
     15    echo $this->Form->input('Location.country', array('label' => __('Country'), 'value' => join('', Set::extract('/Location[type='.LOCATION_COUNTRY.']/name', $this->request->data)))); 
     16    echo $this->Autocomplete->autoComplete('Location.country', '/explorer/autocomplete/country'); 
    1717    $geo = ""; 
    18     if (isset($this->data['Media']['latitude']) && isset($this->data['Media']['longitude'])) { 
    19       $geo = $this->data['Media']['latitude'] . ', ' . $this->data['Media']['longitude']; 
     18    if (isset($this->request->data['Media']['latitude']) && isset($this->request->data['Media']['longitude'])) { 
     19      $geo = $this->request->data['Media']['latitude'] . ', ' . $this->request->data['Media']['longitude']; 
    2020    } 
    2121    echo $this->Form->input('Media.geo', array('label' => __('Geo data'), 'value' => $geo, 'maxlength' => 32)); 
    2222  } 
    23   if ($this->data['Media']['canWriteCaption']) { 
     23  if ($this->request->data['Media']['canWriteCaption']) { 
    2424  echo $this->Form->input('Media.date', array('type' => 'text', 'after' => $this->Html->tag('div', __('E.g. 2008-08-07 15:30'), array('class' => 'description')))); 
    2525  echo $this->Form->input('Media.name', array('type' => 'text')); 
  • View/Explorer/autocomplete.ctp

    r1a41cea ree4c2b7f  
    11<ul> 
    2 <?php foreach($this->data as $name): ?> 
     2<?php foreach($this->request->data as $name): ?> 
    33  <li><?php echo h($name); ?></li> 
    44<?php endforeach; ?> 
  • View/Explorer/editacl.ctp

    r0fb8d7c ree4c2b7f  
    11<?php  
    2   $mediaId = $this->data['Media']['id']; 
     2  $mediaId = $this->request->data['Media']['id']; 
    33  $crumbUrl = '/'.$this->Breadcrumb->params($crumbs); 
    44  echo $this->Form->create(null, array('url' => 'saveacl/'.$mediaId.$crumbUrl, 'id' => 'form-acl-'.$mediaId)); 
  • View/Explorer/editmeta.ctp

    r0fb8d7c ree4c2b7f  
    11<?php  
    2   $mediaId = $this->data['Media']['id']; 
     2  $mediaId = $this->request->data['Media']['id']; 
    33  $crumbUrl = '/'.$this->Breadcrumb->params($crumbs); 
    44  echo $this->Form->create(null, array('url' => 'savemeta/'.$mediaId.$crumbUrl, 'id' => 'form-meta-'.$mediaId));  
  • View/Explorer/index.ctp

    r0fb8d7c ree4c2b7f  
    3232            buttons: { 
    3333              ':SAVE': function() { 
    34                 var $this->Form = $('#form-meta-' + id); 
    35                 $.post($this->Form.attr('action'), $this->Form.serialize(), function(data) { 
     34                var $form = $('#form-meta-' + id); 
     35                $.post($form.attr('action'), $form.serialize(), function(data) { 
    3636                  $('#media-' + id).html(data); 
    3737                  $('#media-' + id).mediaAction(); 
     
    5959            buttons: { 
    6060              ':SAVE': function() { 
    61                 var $this->Form = $('#form-acl-' + id); 
    62                 $.post($this->Form.attr('action'), $this->Form.serialize(), function(data) { 
     61                var $form = $('#form-acl-' + id); 
     62                $.post($form.attr('action'), $form.serialize(), function(data) { 
    6363                  $('#media-' + id).html(data); 
    6464                  $('#media-' + id).mediaAction(); 
     
    178178<div class="p-explorer-media-list"> 
    179179<?php 
    180 $canWriteTag = count($this->data) ? max(Set::extract('/Media/canWriteTag', $this->data)) : 0; 
     180$canWriteTag = count($this->request->data) ? max(Set::extract('/Media/canWriteTag', $this->request->data)) : 0; 
    181181$index = 0; 
    182182$pos = ($this->Search->getPage(1)-1) * $this->Search->getShow(12) + 1; 
    183183 
    184184echo '<div class="row">'; 
    185 foreach ($this->data as $media) { 
     185foreach ($this->request->data as $media) { 
    186186  $editable = $media['Media']['canWriteTag'] ? 'editable' : ''; 
    187187  $cell = "cell" . ($index %4); 
  • View/Explorer/media.ctp

    r0fb8d7c ree4c2b7f  
    2121?> 
    2222  <atom:link rel="self" href="<?php echo Router::url($this->Search->getUri(), true); ?>" /> 
    23 <?php if ($navigator->hasPrev()): ?> 
     23<?php if ($this->Navigator->hasPrev()): ?> 
    2424  <atom:link rel="previous" href="<?php echo Router::url($this->Search->getUri(false, array('page' => $this->Search->getPage(1) - 1)), true); ?>" /> 
    2525<?php endif; ?> 
    26 <?php if ($navigator->hasNext()): ?> 
     26<?php if ($this->Navigator->hasNext()): ?> 
    2727  <atom:link rel="next" href="<?php echo Router::url($this->Search->getUri(false, array('page' => $this->Search->getPage(1) + 1)), true); ?>" /> 
    2828<?php endif; ?> 
    2929<?php  
    3030  $offset = $this->Search->getShow() * ($this->Search->getPage(1) - 1) + 1; 
    31   foreach ($this->data as $media): ?> 
     31  foreach ($this->request->data as $media): ?> 
    3232  <item> 
    3333    <title><?php echo $media['Media']['name']." by ".$media['User']['username']; ?></title> 
  • View/Explorer/points.ctp

    r1a41cea ree4c2b7f  
    11<markers> 
    2 <?php foreach ($this->data as $media): ?> 
     2<?php foreach ($this->request->data as $media): ?> 
    33  <marker id="<?php echo $media['Media']['id']; ?>" lat="<?php echo $media['Media']['latitude']; ?>" lng="<?php echo $media['Media']['longitude']; ?>" > 
    44    <name><?php echo h($media['Media']['name']); ?></name> 
  • View/Explorer/quicksearch.ctp

    r0fb8d7c ree4c2b7f  
    77$cell=0; 
    88 
    9 if (!count($this->data)): ?> 
     9if (!count($this->request->data)): ?> 
    1010<div class="info"> 
    1111<?php echo __("Sorry, nothing was found for %s", h($quicksearch)); ?> 
     
    2020 
    2121<?php  
    22   foreach($this->data as $media) { 
     22  foreach($this->request->data as $media) { 
    2323    echo $this->ImageData->mediaLink($media, 'mini').' '; 
    2424  } 
     
    2727 
    2828<?php 
    29   $tags = Set::extract('/Tag/name', $this->data); 
     29  $tags = Set::extract('/Tag/name', $this->request->data); 
    3030  if (count($tags)) { 
    3131    echo '<p>' . __('See more results of tag') .  ': '; 
     
    3838  } 
    3939 
    40   $categories = Set::extract('/Category/name', $this->data); 
     40  $categories = Set::extract('/Category/name', $this->request->data); 
    4141  if (count($categories)) { 
    4242    echo '<p>' . __('See more results of category') .  ': '; 
     
    4949  } 
    5050 
    51   $locations = Set::extract('/Location/name', $this->data); 
     51  $locations = Set::extract('/Location/name', $this->request->data); 
    5252  if (count($locations)) { 
    5353    echo '<p>' . __('See more results of location') .  ': '; 
  • View/Explorer/rss.ctp

    r1a41cea ree4c2b7f  
    1010} 
    1111 
    12 echo $rss->items($this->data, 'getItem'); 
     12echo $rss->items($this->request->data, 'getItem'); 
    1313?> 
  • View/Explorer/updatemeta.ctp

    r0fb8d7c ree4c2b7f  
    33  $pos = $this->Search->getPos(); 
    44  $index = 0; 
    5   echo $this->element('explorer/media', array('media' => $this->data, 'index' => $index, 'pos' => $pos));  
     5  echo $this->element('explorer/media', array('media' => $this->request->data, 'index' => $index, 'pos' => $pos));  
    66?> 
  • View/Groups/autocomplete.ctp

    r1a41cea ree4c2b7f  
    1 <?php debug($this->data); ?> 
     1<?php debug($this->request->data); ?> 
    22<ul> 
    3 <?php foreach($this->data as $user): ?> 
     3<?php foreach($this->request->data as $user): ?> 
    44  <li><?php echo $user['User']['username']; ?></li> 
    55<?php endforeach; ?> 
  • View/Groups/create.ctp

    r0fb8d7c ree4c2b7f  
    88<?php 
    99  echo $this->Form->input('Group.name', array('label' => __('Name'))); 
    10   echo $this->Form->input('Group.description', array('label' => __('Description'), 'type' => 'blob')); 
     10  echo $this->Form->input('Group.description', array('label' => __('Description'), 'type' => 'text')); 
    1111  echo $this->Form->input('Group.is_hidden', array('label' => __('This group is hidden'), 'type' => 'checkbox')); 
    1212  echo $this->Form->input('Group.is_moderated', array('label' => __('New group members are moderated'), 'type' => 'checkbox')); 
  • View/Groups/dashboard_create.ctp

    r0fb8d7c ree4c2b7f  
    1616 
    1717<?php 
    18 debug($this->data); 
     18debug($this->request->data); 
    1919 
    2020?> 
     
    3636 
    3737<?php 
    38 debug($this->data); 
     38debug($this->request->data); 
    3939 
    4040?> 
     
    5656 
    5757<?php 
    58 debug($this->data); 
     58debug($this->request->data); 
    5959 
    6060?> 
     
    7676 
    7777<?php 
    78 debug($this->data); 
     78debug($this->request->data); 
    7979 
    8080?> 
     
    9696 
    9797<?php 
    98 debug($this->data); 
     98debug($this->request->data); 
    9999 
    100100?> 
     
    116116 
    117117<?php 
    118 debug($this->data); 
     118debug($this->request->data); 
    119119 
    120120?> 
  • View/Groups/dashboard_index.ctp

    r0fb8d7c ree4c2b7f  
    44 
    55<?php 
    6 debug($this->data); 
     6debug($this->request->data); 
    77 
    88?> 
     
    1212 
    1313<?php 
    14 debug($this->data); 
     14debug($this->request->data); 
    1515 
    1616?> 
     
    2020 
    2121<?php 
    22 debug($this->data); 
     22debug($this->request->data); 
    2323 
    2424?> 
     
    2828 
    2929<?php 
    30 debug($this->data); 
     30debug($this->request->data); 
    3131 
    3232?> 
     
    3636 
    3737<?php 
    38 debug($this->data); 
     38debug($this->request->data); 
    3939 
    4040?> 
     
    4444 
    4545<?php 
    46 debug($this->data); 
     46debug($this->request->data); 
    4747 
    4848?> 
  • View/Groups/dashboard_manage.ctp

    r0fb8d7c ree4c2b7f  
    1313 
    1414<?php  
    15 $allgroup_names = Set::extract('/Member/name', $this->data); 
     15$allgroup_names = Set::extract('/Member/name', $this->request->data); 
    1616sort($allgroup_names); 
    1717$cells = array(); 
     
    2828 
    2929<?php 
    30 debug($this->data); 
     30debug($this->request->data); 
    3131 
    3232?> 
     
    4545 
    4646<?php  
    47 $allgroup_names = Set::extract('/Member/name', $this->data); 
     47$allgroup_names = Set::extract('/Member/name', $this->request->data); 
    4848sort($allgroup_names); 
    4949$cells = array(); 
     
    6060 
    6161<?php 
    62 debug($this->data); 
     62debug($this->request->data); 
    6363 
    6464?> 
     
    7777 
    7878<?php  
    79 $allgroup_names = Set::extract('/Member/name', $this->data); 
     79$allgroup_names = Set::extract('/Member/name', $this->request->data); 
    8080sort($allgroup_names); 
    8181$cells = array(); 
     
    9292 
    9393<?php 
    94 debug($this->data); 
     94debug($this->request->data); 
    9595 
    9696?> 
     
    109109 
    110110<?php  
    111 $allgroup_names = Set::extract('/Member/name', $this->data); 
     111$allgroup_names = Set::extract('/Member/name', $this->request->data); 
    112112sort($allgroup_names); 
    113113$cells = array(); 
     
    124124 
    125125<?php 
    126 debug($this->data); 
     126debug($this->request->data); 
    127127 
    128128?> 
     
    141141 
    142142<?php  
    143 $allgroup_names = Set::extract('/Member/name', $this->data); 
     143$allgroup_names = Set::extract('/Member/name', $this->request->data); 
    144144sort($allgroup_names); 
    145145$cells = array(); 
     
    156156 
    157157<?php 
    158 debug($this->data); 
     158debug($this->request->data); 
    159159 
    160160?> 
     
    173173 
    174174<?php  
    175 $allgroup_names = Set::extract('/Member/name', $this->data); 
     175$allgroup_names = Set::extract('/Member/name', $this->request->data); 
    176176sort($allgroup_names); 
    177177$cells = array(); 
     
    188188 
    189189<?php 
    190 debug($this->data); 
     190debug($this->request->data); 
    191191 
    192192?> 
  • View/Groups/dashboard_search.ctp

    r0fb8d7c ree4c2b7f  
    2424</ul> 
    2525<?php 
    26 debug($this->data); 
     26debug($this->request->data); 
    2727 
    2828?> 
     
    5252</ul> 
    5353<?php 
    54 debug($this->data); 
     54debug($this->request->data); 
    5555 
    5656?> 
     
    8080</ul> 
    8181<?php 
    82 debug($this->data); 
     82debug($this->request->data); 
    8383 
    8484?> 
     
    108108</ul> 
    109109<?php 
    110 debug($this->data); 
     110debug($this->request->data); 
    111111 
    112112?> 
     
    136136</ul> 
    137137<?php 
    138 debug($this->data); 
     138debug($this->request->data); 
    139139 
    140140?> 
     
    164164</ul> 
    165165<?php 
    166 debug($this->data); 
     166debug($this->request->data); 
    167167 
    168168?> 
  • View/Groups/edit.ctp

    r0fb8d7c ree4c2b7f  
    1 <h1><?php echo __('Group: %s', $this->data['Group']['name']); ?></h1> 
     1<h1><?php echo __('Group: %s', $this->request->data['Group']['name']); ?></h1> 
    22 
    33<?php echo $this->Session->flash() ?> 
    44 
    5 <?php echo $this->Form->create(null, array('action' => "edit/{$this->data['Group']['name']}")); ?> 
     5<?php echo $this->Form->create(null, array('action' => "edit/{$this->request->data['Group']['name']}")); ?> 
    66 
    77<fieldset><legend><?php echo __('Edit Group'); ?></legend> 
  • View/Groups/index.ctp

    r0fb8d7c ree4c2b7f  
    33<?php echo $this->Session->flash(); ?> 
    44 
    5 <?php if (!empty($this->data)): ?> 
     5<?php if (!empty($this->request->data)): ?> 
    66<table class="default"> 
    77<thead> 
     
    2424  $isAdmin = $currentUser['User']['role'] >= ROLE_ADMIN; 
    2525 
    26   foreach($this->data as $group) { 
     26  foreach($this->request->data as $group) { 
    2727    $actions = array(); 
    2828    if ($currentUser['User']['id'] != $group['Group']['user_id']) { 
     
    5050      $this->Html->link($group['Group']['name'], "view/{$group['Group']['name']}", array('title' => $group['Group']['description'])), 
    5151      $this->Html->link($group['User']['username'], "/users/view/{$group['User']['username']}"), 
    52       $text->truncate($group['Group']['description'], 30, array('ending' => '...', 'exact' => false, 'html' => false)), 
     52      $this->Text->truncate($group['Group']['description'], 30, array('ending' => '...', 'exact' => false, 'html' => false)), 
    5353      count($group['Member']), 
    5454      $this->Html->tag('div', implode(' ', $actions), array('class' => 'actionlist')) 
  • View/Groups/listmembers.ctp

    r0fb8d7c ree4c2b7f  
    1 <h1><?php echo __('Group %s', $this->data['Group']['name']); ?></h1> 
     1<h1><?php echo __('Group %s', $this->request->data['Group']['name']); ?></h1> 
    22 
    33<?php echo $this->Session->flash() ?> 
     
    1010    __('Member'), 
    1111    ); 
    12   if ($this->data['Group']['is_admin']) { 
     12  if ($this->request->data['Group']['is_admin']) { 
    1313    $headers[] = __('Action'); 
    1414  } 
     
    2020<?php  
    2121  $cells = array(); 
    22   foreach ($this->data['Member'] as $member) { 
     22  foreach ($this->request->data['Member'] as $member) { 
    2323    $actions = array(); 
    24     if ($this->data['Group']['is_admin']) { 
     24    if ($this->request->data['Group']['is_admin']) { 
    2525      $actions[] = $this->Html->link( 
    2626        $this->Html->image('icons/delete.png',  
     
    2929            'title' => __("Unsubscribe '%s'", $member['username']) 
    3030          ) 
    31         ), "deleteMember/{$this->data['Group']['name']}/{$member['username']}", array('escape' => false)); 
     31        ), "deleteMember/{$this->request->data['Group']['name']}/{$member['username']}", array('escape' => false)); 
    3232    } 
    3333    $row = array( 
  • View/Groups/view.ctp

    r0fb8d7c ree4c2b7f  
    1 <h1><?php echo __('Group %s', $this->data['Group']['name']); ?></h1> 
     1<h1><?php echo __('Group %s', $this->request->data['Group']['name']); ?></h1> 
    22 
    33<?php echo $this->Session->flash() ?> 
     
    88 
    99<p><?php  
    10   if (empty($this->data['Group']['description'])) { 
     10  if (empty($this->request->data['Group']['description'])) { 
    1111    __("This group has no description"); 
    1212  } else { 
    13     echo h($this->data['Group']['description']);  
     13    echo h($this->request->data['Group']['description']);  
    1414  } ?></p> 
    1515<p><?php 
    16   __("The group is owned by user %s and has %d media in total.", $this->Html->link($this->data['User']['username'], "/users/view/{$this->data['User']['username']}"), $mediaCount); 
    17   if ($this->data['Group']['is_admin']) { 
    18     echo ' ' . $this->Html->link(__('Edit'), "edit/{$this->data['Group']['name']}"); 
     16  __("The group is owned by user %s and has %d media in total.", $this->Html->link($this->request->data['User']['username'], "/users/view/{$this->request->data['User']['username']}"), $mediaCount); 
     17  if ($this->request->data['Group']['is_admin']) { 
     18    echo ' ' . $this->Html->link(__('Edit'), "edit/{$this->request->data['Group']['name']}"); 
    1919  } 
    2020?></p> 
     
    2424  $iconYes = $this->Html->image('icons/accept.png', array('alt' => '+', 'title' => '+')) . ' '; 
    2525  $iconNo = $this->Html->image('icons/delete.png', array('alt' => '-', 'title' => '-')) . ' '; 
    26   if ($this->data['Group']['is_hidden']) { 
     26  if ($this->request->data['Group']['is_hidden']) { 
    2727    echo $this->Html->tag('li', $iconNo . __("The group is hidden")); 
    2828  } else { 
    2929    echo $this->Html->tag('li', $iconYes . __("The group is shown with the media")); 
    3030  } 
    31   if ($this->data['Group']['is_moderated']) { 
     31  if ($this->request->data['Group']['is_moderated']) { 
    3232    echo $this->Html->tag('li', $iconNo . __("The group subscription requires a confirmation")); 
    3333  } else { 
    3434    echo $this->Html->tag('li', $iconYes . __("The group subscription is free and does not need a confirmation")); 
    3535  } 
    36   if ($this->data['Group']['is_shared']) { 
     36  if ($this->request->data['Group']['is_shared']) { 
    3737    echo $this->Html->tag('li', $iconYes . __("This group is shared and can be used by other members")); 
    3838  } else { 
     
    4949    __('Member'), 
    5050    ); 
    51   if ($this->data['Group']['is_admin']) { 
     51  if ($this->request->data['Group']['is_admin']) { 
    5252    $headers[] = __('Action'); 
    5353  } 
     
    5959<?php  
    6060  $cells = array(); 
    61   foreach ($this->data['Member'] as $member) { 
     61  foreach ($this->request->data['Member'] as $member) { 
    6262    $actions = array(); 
    63     if ($this->data['Group']['is_admin']) { 
     63    if ($this->request->data['Group']['is_admin']) { 
    6464      $actions[] = $this->Html->link( 
    6565        $this->Html->image('icons/delete.png',  
     
    6868            'title' => __("Unsubscribe '%s'", $member['username']) 
    6969          ) 
    70         ), "deleteMember/{$this->data['Group']['name']}/{$member['username']}", array('escape' => false)); 
     70        ), "deleteMember/{$this->request->data['Group']['name']}/{$member['username']}", array('escape' => false)); 
    7171    } 
    7272    $row = array( 
     
    8484 
    8585<?php  
    86   if ($this->data['Group']['is_admin']) { 
     86  if ($this->request->data['Group']['is_admin']) { 
    8787    echo $this->Form->create('Group', array('action' => 'addMember')); 
    8888    echo "<fieldset><legend>" . __("Add user") . "</legend>"; 
     
    9595  } else { 
    9696    $userId = $this->Session->read('User.id'); 
    97     $memberIds = Set::extract('/Member/id', $this->data); 
     97    $memberIds = Set::extract('/Member/id', $this->request->data); 
    9898    if (in_array($userId, $memberIds)) { 
    99       echo $this->Html->link(__('Unsubscribe'), "unsubscribe/{$this->data['Group']['name']}");  
     99      echo $this->Html->link(__('Unsubscribe'), "unsubscribe/{$this->request->data['Group']['name']}");  
    100100    } else { 
    101       echo $this->Html->link(__('Subscribe'), "subscribe/{$this->data['Group']['name']}");  
     101      echo $this->Html->link(__('Subscribe'), "subscribe/{$this->request->data['Group']['name']}");  
    102102    } 
    103103  } 
     
    111111  } 
    112112?></p> 
    113 <p><?php echo __('See all media of the group %s', $this->Html->link($this->data['Group']['name'], "/explorer/group/{$this->data['Group']['name']}")); ?></p> 
     113<p><?php echo __('See all media of the group %s', $this->Html->link($this->request->data['Group']['name'], "/explorer/group/{$this->request->data['Group']['name']}")); ?></p> 
    114114<?php endif; ?> 
  • View/Guests/autocomplete.ctp

    r1a41cea ree4c2b7f  
    11<ul> 
    2 <?php foreach($this->data as $group): ?> 
     2<?php foreach($this->request->data as $group): ?> 
    33  <li><?php echo $group['Group']['name']; ?></li> 
    44<?php endforeach; ?> 
  • View/Guests/edit.ctp

    r0fb8d7c ree4c2b7f  
    1 <h1><?php echo __('Guest: %s', $this->data['Guest']['username']); ?></h1> 
     1<h1><?php echo __('Guest: %s', $this->request->data['Guest']['username']); ?></h1> 
    22 
    33<?php echo $this->Session->flash(); ?> 
    44 
    5 <?php echo $this->Form->create(null, array('action' => 'edit/'.$this->data['Guest']['id']));?> 
     5<?php echo $this->Form->create(null, array('action' => 'edit/'.$this->request->data['Guest']['id']));?> 
    66<fieldset><legend><?php echo __('Guest'); ?></legend> 
    77<?php 
    88  echo $this->Form->input('Guest.email', array('label' => __('Email'))); 
    99  echo $this->Form->input('Guest.expires', array('type' => 'text', 'label' => __('Expires'))); 
    10   echo $this->Form->input('Guest.webdav', array('type' => 'checkbox', 'checked' => ($this->data['Guest']['quota'] > 0 ? 'checked' : ''), 'label' => __('Enable WebDAV access'))); 
     10  echo $this->Form->input('Guest.webdav', array('type' => 'checkbox', 'checked' => ($this->request->data['Guest']['quota'] > 0 ? 'checked' : ''), 'label' => __('Enable WebDAV access'))); 
    1111?> 
    1212</fieldset> 
     
    2424    3 => __('Name and captcha')  
    2525    ); 
    26   $select = $this->data['Comment']['auth']; 
     26  $select = $this->request->data['Comment']['auth']; 
    2727  echo '<div class="input select">'; 
    2828  echo $this->Form->label(null, __('Authentication')); 
    29   echo $this->Form->select('Comment.auth', $options, $select, array('empty' => false)); 
     29  echo $this->Form->select('Comment.auth', $options, array('empty' => false, 'value' => $select)); 
    3030  echo '</div>'; 
    3131?> 
     
    3434</form> 
    3535 
    36 <?php if(count($this->data['Member'])): ?> 
     36<?php if(count($this->request->data['Member'])): ?> 
    3737<h2><?php echo __('Group List'); ?></h2> 
    3838<table class="default"> 
     
    5050<?php  
    5151  $cells = array(); 
    52   foreach($this->data['Member'] as $group) { 
    53     $delConfirm = __("Do you really want to delete the group '%s' from this guest '%s'?", $group['name'], $this->data['Guest']['username']); 
     52  foreach($this->request->data['Member'] as $group) { 
     53    $delConfirm = __("Do you really want to delete the group '%s' from this guest '%s'?", $group['name'], $this->request->data['Guest']['username']); 
    5454    $cells[] = array( 
    5555      $this->Html->link($group['name'], '/groups/view/'.$group['name']), 
    5656      $this->Html->link(  
    5757        $this->Html->image('icons/delete.png', array('alt' => 'Delete', 'title' => 'Delete')),  
    58         '/guests/deleteGroup/'.$this->data['Guest']['id'].'/'.$group['id'], array('escape' => false), $delConfirm) 
     58        '/guests/deleteGroup/'.$this->request->data['Guest']['id'].'/'.$group['id'], array('escape' => false), $delConfirm) 
    5959    ); 
    6060  } 
     
    6767<?php endif; ?> 
    6868 
    69 <?php echo $this->Form->create(null, array('action' => 'addGroup/'.$this->data['Guest']['id']));?> 
     69<?php echo $this->Form->create(null, array('action' => 'addGroup/'.$this->request->data['Guest']['id']));?> 
    7070<fieldset><legend><?php echo __('Group Assignements'); ?></legend> 
    71 <div class="input"><label><?php echo __('Group'); ?></label> 
    72 <?php echo $ajax->autocomplete('Group.name', '/guests/autocomplete'); ?></div> 
     71  <?php echo $this->Form->input('Group.name'); ?> 
     72  <?php echo $this->Autocomplete->autoComplete('Group.name', '/guests/autocomplete'); ?> 
    7373</fieldset> 
    7474<?php echo $this->Form->submit(__('Add Group')); ?> 
  • View/Guests/index.ctp

    r0fb8d7c ree4c2b7f  
    33<?php echo $this->Session->flash(); ?> 
    44 
    5 <?php if (!empty($this->data)): ?> 
     5<?php if (!empty($this->request->data)): ?> 
    66<table class="default"> 
    77<thead> 
     
    1414 
    1515<tbody> 
    16 <?php $row=0; foreach($this->data as $guest): ?> 
     16<?php $row=0; foreach($this->request->data as $guest): ?> 
    1717  <tr class="<?php echo ($row++%2)?"even":"odd";?>"> 
    1818    <td><?php echo $this->Html->link($guest['Guest']['username'], 'edit/'.$guest['Guest']['id']); ?></td> 
     
    3838 
    3939<?php 
    40 //debug($this->data); 
     40//debug($this->request->data); 
    4141?> 
  • View/Guests/links.ctp

    r0fb8d7c ree4c2b7f  
    1212 
    1313<?php 
    14   $myMedia = Router::url('/explorer/user/'.$this->data['Guest']['username'].'/key:'.$this->data['Guest']['key'], true); 
     14  $myMedia = Router::url('/explorer/user/'.$this->request->data['Guest']['username'].'/key:'.$this->request->data['Guest']['key'], true); 
    1515?> 
    1616<ul> 
    17   <li><?php echo __('My Media of Guest %s (Link %s)', $this->Html->link($this->data['Guest']['username'], $myMedia, '<code>' . $myMedia . '</code>'); ?></li> 
     17  <li><?php echo __('My Media of Guest %s (Link %s)', $this->Html->link($this->request->data['Guest']['username'], $myMedia), '<code>'. $myMedia . '</code>'); ?></li> 
    1818</ul> 
    1919 
     
    2323<p><?php echo __('Following links provide a authenticated RSS and Media RSS links.'); ?></p> 
    2424<?php 
    25   $recentMedia = Router::url('/explorer/rss/key:'.$this->data['Guest']['key'], true); 
    26   $recentComments = Router::url('/comments/rss/key:'.$this->data['Guest']['key'], true); 
    27   $mediaRss = Router::url('/explorer/media/key:'.$this->data['Guest']['key'].'/media.rss', true); 
    28   $myMediaMediaRss = Router::url('/explorer/media/user:'.$this->data['Guest']['username'].'/key:'.$this->data['Guest']['key'].'/media.rss', true); 
     25  $recentMedia = Router::url('/explorer/rss/key:'.$this->request->data['Guest']['key'], true); 
     26  $recentComments = Router::url('/comments/rss/key:'.$this->request->data['Guest']['key'], true); 
     27  $mediaRss = Router::url('/explorer/media/key:'.$this->request->data['Guest']['key'].'/media.rss', true); 
     28  $myMediaMediaRss = Router::url('/explorer/media/user:'.$this->request->data['Guest']['username'].'/key:'.$this->request->data['Guest']['key'].'/media.rss', true); 
    2929?> 
    3030<ul> 
     
    3535</ul> 
    3636 
    37 <p><?php echo __('Click %s to renew the authentication key. All previous links become invalid.', $this->Html->link(__('renew key'), 'links/'.$this->data['Guest']['id'].'/renew')); ?></p> 
     37<p><?php echo __('Click %s to renew the authentication key. All previous links become invalid.', $this->Html->link(__('renew key'), 'links/'.$this->request->data['Guest']['id'].'/renew')); ?></p> 
  • View/Helper/ExplorerMenuHelper.php

    r0fb8d7c ree4c2b7f  
    3333  function _countAssociation($association) { 
    3434    $result = array(); 
    35     if (isset($this->data['Media'])) { 
    36       $data = array($this->data); 
     35    if (isset($this->request->data['Media'])) { 
     36      $data = array($this->request->data); 
    3737    } else { 
    38       $data =& $this->data; 
     38      $data =& $this->request->data; 
    3939    } 
    4040    if (!$data) { 
     
    199199  function getMainMenu() { 
    200200    $out = ''; 
    201     $data = $this->data; 
     201    $data = $this->request->data; 
    202202    $this->Search->initialize(); 
    203203    $items = array(); 
  • View/Helper/FlowplayerHelper.php

    r1a41cea ree4c2b7f  
    3535  /** Creates the link container for the flowplayer */ 
    3636  function link($media) { 
    37     list($width, $height) = $this->ImageData->getimagesize($this->data, OUTPUT_SIZE_VIDEO); 
     37    list($width, $height) = $this->ImageData->getimagesize($this->request->data, OUTPUT_SIZE_VIDEO); 
    3838    $height += 24; 
    3939    $id = $media['Media']['id']; 
  • View/Helper/ImageDataHelper.php

    r0fb8d7c ree4c2b7f  
    2626class ImageDataHelper extends AppHelper { 
    2727 
    28   var $helpers = array('Session', 'Ajax', 'Html', 'Form', 'Search', 'Option', 'Breadcrumb'); 
     28  var $helpers = array('Session', 'Html', 'Form', 'Search', 'Option', 'Breadcrumb'); 
    2929 
    3030  var $Sanitize = null; 
     
    538538    } 
    539539 
     540    /* 
    540541    if ($data['Media']['canWriteTag']) { 
    541542      $output .= ' '.$this->Ajax->link( 
     
    552553      } 
    553554    } 
     555    */ 
    554556    return $cells; 
    555557  } 
  • View/Helper/SearchHelper.php

    r3605ef4 ree4c2b7f  
    152152    $this->_addParams(&$data, $add); 
    153153    $this->_delParams(&$data, $del); 
     154    if (!$data) { 
     155      return ''; 
     156    } 
    154157    ksort($data); 
    155158 
  • View/Images/view.ctp

    r0fb8d7c ree4c2b7f  
    55<span></span> 
    66<?php  
    7   if (($this->data['Media']['type'] & MEDIA_TYPE_VIDEO) > 0) { 
    8     echo $flowplayer->video($this->data); 
     7  if (($this->request->data['Media']['type'] & MEDIA_TYPE_VIDEO) > 0) { 
     8    echo $flowplayer->video($this->request->data); 
    99  } else { 
    10     //$size = $this->ImageData->getimagesize($this->data, OUTPUT_SIZE_PREVIEW); 
    11     $size = $this->ImageData->getimagesize($this->data, 960); 
    12     $src = Router::url("/media/preview/".$this->data['Media']['id']); 
    13     $img = $this->Html->tag('img', null, array('src' => $src, 'width' => $size[0], 'height' => $size[1], 'alt' => $this->data['Media']['name'])); 
    14     if ($navigator->hasNextMedia()) { 
    15       echo $this->Html->link($img, $navigator->getNextMediaUrl(), array('escape' => false)); 
     10    //$size = $this->ImageData->getimagesize($this->request->data, OUTPUT_SIZE_PREVIEW); 
     11    $size = $this->ImageData->getimagesize($this->request->data, 960); 
     12    $src = Router::url("/media/preview/".$this->request->data['Media']['id']); 
     13    $img = $this->Html->tag('img', null, array('src' => $src, 'width' => $size[0], 'height' => $size[1], 'alt' => $this->request->data['Media']['name'])); 
     14    if ($this->Navigator->hasNextMedia()) { 
     15      echo $this->Html->link($img, $this->Navigator->getNextMediaUrl(), array('escape' => false)); 
    1616    } else { 
    1717      echo $img; 
     
    2121</div> 
    2222<div class="navigator"> 
    23 <div class="up"><div class="sub"><?php echo $navigator->up(); ?></div></div> 
    24 <?php if ($navigator->hasPrevMedia()): ?> 
    25 <div class="prev"><div class="sub"><?php echo $navigator->prevMedia(); ?></div></div> 
     23<div class="up"><div class="sub"><?php echo $this->Navigator->up(); ?></div></div> 
     24<?php if ($this->Navigator->hasPrevMedia()): ?> 
     25<div class="prev"><div class="sub"><?php echo $this->Navigator->prevMedia(); ?></div></div> 
    2626<?php endif; ?> 
    27 <?php if ($navigator->hasNextMedia()): ?> 
    28 <div class="next"><div class="sub"><?php echo $navigator->nextMedia(); ?></div></div> 
     27<?php if ($this->Navigator->hasNextMedia()): ?> 
     28<div class="next"><div class="sub"><?php echo $this->Navigator->nextMedia(); ?></div></div> 
    2929<?php endif; ?> 
    3030</div> 
     
    3434<?php 
    3535  $items = array(__("General"), __("Media Details")); 
    36   if ($map->hasApi() && $map->hasMediaGeo($this->data)) { 
     36  if ($this->Map->hasApi() && $this->Map->hasMediaGeo($this->request->data)) { 
    3737    $items['map'] = __("Map"); 
    3838  } 
    39   if ($this->data['Media']['canWriteTag']) { 
     39  if ($this->request->data['Media']['canWriteTag']) { 
    4040    $items['edit'] = __("Edit"); 
    4141  } 
    42   if ($this->data['Media']['canWriteAcl']) { 
     42  if ($this->request->data['Media']['canWriteAcl']) { 
    4343    $items['acl'] = __("Access Right"); 
    4444  } 
    45   echo $tab->menu($items); 
     45  echo $this->Tab->menu($items); 
    4646?> 
    47 <?php echo $tab->open(0); ?> 
     47<?php echo $this->Tab->open(0); ?> 
    4848<div class="meta"> 
    49 <div id="meta-<?php echo $this->data['Media']['id']; ?>"> 
     49<div id="meta-<?php echo $this->request->data['Media']['id']; ?>"> 
    5050<table class="bare">  
    51   <?php echo $this->Html->tableCells($this->ImageData->metaTable(&$this->data)); ?> 
     51  <?php echo $this->Html->tableCells($this->ImageData->metaTable(&$this->request->data)); ?> 
    5252</table> 
    5353</div> 
    5454</div><!-- meta --> 
    55 <?php echo $tab->close(); ?> 
     55<?php echo $this->Tab->close(); ?> 
    5656 
    57 <?php echo $tab->open(1); ?> 
     57<?php echo $this->Tab->open(1); ?> 
    5858<div class="meta"> 
    5959<table class="bare">  
    6060<?php  
    6161  $cells = array(); 
    62   $cells[] = array(__("User"), $this->Html->link($this->data['User']['username'], '/explorer/user/'.$this->data['User']['username'])); 
    63   if ($this->data['Media']['isOwner']) { 
     62  $cells[] = array(__("User"), $this->Html->link($this->request->data['User']['username'], '/explorer/user/'.$this->request->data['User']['username'])); 
     63  if ($this->request->data['Media']['isOwner']) { 
    6464    $files = array(); 
    65     foreach ($this->data['File'] as $file) { 
     65    foreach ($this->request->data['File'] as $file) { 
    6666      $link = $this->ImageData->getPathLink($file); 
    6767      $files[] = $this->Html->link($file['file'], $link).' ('.$this->Number->toReadableSize($file['size']).')'; 
     
    6969    $cells[] = array(__("File(s)"), implode(', ', $files)); 
    7070  } 
    71   $folders = $this->ImageData->getFolderLinks($this->data); 
     71  $folders = $this->ImageData->getFolderLinks($this->request->data); 
    7272  if ($folders) { 
    7373    $cells[] = array(__("Folder"), implode(' / ', $folders)); 
    7474  } 
    75   $cells[] = array(__("View Count"), $this->data['Media']['clicks']); 
    76   $cells[] = array(__("Created"), $time->relativeTime($this->data['Media']['created'])); 
    77   $cells[] = array(__("Last modified"), $time->relativeTime($this->data['Media']['modified'])); 
    78   $cells[] = array(__("Size"), $this->data['Media']['width'].'px * '.$this->data['Media']['height'].'px'); 
     75  $cells[] = array(__("View Count"), $this->request->data['Media']['clicks']); 
     76  $cells[] = array(__("Created"), $this->Time->timeAgoInWords($this->request->data['Media']['created'])); 
     77  $cells[] = array(__("Last modified"), $this->Time->timeAgoInWords($this->request->data['Media']['modified'])); 
     78  $cells[] = array(__("Size"), $this->request->data['Media']['width'].'px * '.$this->request->data['Media']['height'].'px'); 
    7979 
    80   if ($this->data['Media']['model']) { 
    81     $cells[] = array(__("Model"), $this->data['Media']['model']); 
     80  if ($this->request->data['Media']['model']) { 
     81    $cells[] = array(__("Model"), $this->request->data['Media']['model']); 
    8282  } 
    83   if ($this->data['Media']['duration'] > 0) { 
    84     $cells[] = array(__("Duration"), $this->data['Media']['duration'].'s'); 
     83  if ($this->request->data['Media']['duration'] > 0) { 
     84    $cells[] = array(__("Duration"), $this->request->data['Media']['duration'].'s'); 
    8585  } else { 
    86     if ($this->data['Media']['aperture'] > 0) { 
    87       $cells[] = array(__("Aperture"), $this->data['Media']['aperture']); 
     86    if ($this->request->data['Media']['aperture'] > 0) { 
     87      $cells[] = array(__("Aperture"), $this->request->data['Media']['aperture']); 
    8888    } 
    89     if ($this->data['Media']['shutter'] > 0) { 
    90       $cells[] = array(__("Shutter"), $this->ImageData->niceShutter($this->data['Media']['shutter'])); 
     89    if ($this->request->data['Media']['shutter'] > 0) { 
     90      $cells[] = array(__("Shutter"), $this->ImageData->niceShutter($this->request->data['Media']['shutter'])); 
    9191    } 
    92     if ($this->data['Media']['iso'] > 0) { 
    93       $cells[] = array(__("ISO"), $this->data['Media']['iso']); 
     92    if ($this->request->data['Media']['iso'] > 0) { 
     93      $cells[] = array(__("ISO"), $this->request->data['Media']['iso']); 
    9494    } 
    9595  } 
     
    9898</table> 
    9999</div> 
    100 <?php echo $tab->close(); ?> 
     100<?php echo $this->Tab->close(); ?> 
    101101<?php  
    102   if ($map->hasApi() && $map->hasMediaGeo($this->data)) { 
    103     echo $tab->open('map'); 
    104     echo $map->container(); 
    105     echo $map->script(); 
    106     echo $tab->close();  
     102  if ($this->Map->hasApi() && $this->Map->hasMediaGeo($this->request->data)) { 
     103    echo $this->Tab->open('map'); 
     104    echo $this->Map->container(); 
     105    echo $this->Map->script(); 
     106    echo $this->Tab->close();  
    107107  } 
    108   if ($this->data['Media']['canWriteTag']) { 
    109     echo $tab->open('edit'); 
    110     echo $this->Form->create(null, array('url' => 'update/'.$this->data['Media']['id'].'/'.join('/', $crumbs), 'id' => 'edit')); 
     108  if ($this->request->data['Media']['canWriteTag']) { 
     109    echo $this->Tab->open('edit'); 
     110    echo $this->Form->create(null, array('url' => 'update/'.$this->request->data['Media']['id'].'/'.join('/', $crumbs), 'id' => 'edit')); 
    111111    echo "<fieldset>"; 
    112112    echo View::element('single_meta_form'); 
    113113    echo "</fieldset>"; 
    114114    echo $this->Form->end(__('Save')); 
    115     echo $tab->close();  
     115    echo $this->Tab->close();  
    116116  } 
    117   if ($this->data['Media']['canWriteAcl']) { 
    118     echo $tab->open('acl'); 
    119     echo $this->Form->create(null, array('url' => 'updateAcl/'.$this->data['Media']['id'].'/'.join('/', $crumbs), 'id' => 'acl')); 
     117  if ($this->request->data['Media']['canWriteAcl']) { 
     118    echo $this->Tab->open('acl'); 
     119    echo $this->Form->create(null, array('url' => 'updateAcl/'.$this->request->data['Media']['id'].'/'.join('/', $crumbs), 'id' => 'acl')); 
    120120    echo "<fieldset>"; 
    121121    echo View::element('single_acl_form'); 
    122122    echo "</fieldset>"; 
    123123    echo $this->Form->end(__('Save')); 
    124     echo $tab->close();  
     124    echo $this->Tab->close();  
    125125  } 
    126126?> 
     
    182182JS; 
    183183  $vars = array( 
    184     'ID' => $this->data['Media']['id'], 
    185     'LATITUDE' => ($this->data['Media']['latitude'] ? $this->data['Media']['latitude'] : 0), 
    186     'LONGITUDE' => ($this->data['Media']['longitude'] ? $this->data['Media']['longitude'] : 0)); 
     184    'ID' => $this->request->data['Media']['id'], 
     185    'LATITUDE' => ($this->request->data['Media']['latitude'] ? $this->request->data['Media']['latitude'] : 0), 
     186    'LONGITUDE' => ($this->request->data['Media']['longitude'] ? $this->request->data['Media']['longitude'] : 0)); 
    187187  foreach ($vars as $name => $value) { 
    188188    $script = preg_replace("/:$name/", $value, $script); 
  • View/Options/rss.ctp

    r0fb8d7c ree4c2b7f  
    88 
    99<?php 
    10   $recentMedia = Router::url('/explorer/rss/key:'.$this->data['User']['key'], true); 
    11   $recentComments = Router::url('/comments/rss/key:'.$this->data['User']['key'], true); 
    12   $mediaRss = Router::url('/explorer/media/key:'.$this->data['User']['key'].'/media.rss', true); 
    13   $myMediaMediaRss = Router::url('/explorer/media/user:'.$this->data['User']['username'].'/key:'.$this->data['User']['key'].'/media.rss', true); 
     10  $recentMedia = Router::url('/explorer/rss/key:'.$this->request->data['User']['key'], true); 
     11  $recentComments = Router::url('/comments/rss/key:'.$this->request->data['User']['key'], true); 
     12  $mediaRss = Router::url('/explorer/media/key:'.$this->request->data['User']['key'].'/media.rss', true); 
     13  $myMediaMediaRss = Router::url('/explorer/media/user:'.$this->request->data['User']['username'].'/key:'.$this->request->data['User']['key'].'/media.rss', true); 
    1414?> 
    1515<ul> 
  • View/System/delete_unused_meta_data.ctp

    r0fb8d7c ree4c2b7f  
    11<h1><?php echo __("Delete Unused Metadata"); ?></h1> 
    22<?php echo $this->Session->flash(); ?> 
    3 <p><?php echo __("Delete all unused meta data from database: %d tags, %d categories, %d locations.", $this->data['unusedTagCount'], $this->data['unusedCategoryCount'], $this->data['unusedLocationCount']); ?> 
     3<p><?php echo __("Delete all unused meta data from database: %d tags, %d categories, %d locations.", $this->request->data['unusedTagCount'], $this->request->data['unusedCategoryCount'], $this->request->data['unusedLocationCount']); ?> 
    44</p><?php echo $this->Html->link(__('Delete'), 'deleteUnusedMetaData/delete', array('class' => 'button')); ?></p> 
  • View/Users/admin_edit.ctp

    r0fb8d7c ree4c2b7f  
    1 <h1><?php echo __(" User: %s", $this->data['User']['username']); ?></h1> 
     1<h1><?php echo __(" User: %s", $this->request->data['User']['username']); ?></h1> 
    22 
    33<?php echo $this->Session->flash(); ?> 
    44 
    5 <?php echo $this->Form->create(null, array('action' => 'edit/'.$this->data['User']['id'])); ?> 
     5<?php echo $this->Form->create(null, array('action' => 'edit/'.$this->request->data['User']['id'])); ?> 
    66<fieldset><legend><?php echo __('General'); ?></legend> 
    77<?php 
     
    1313    $roles[ROLE_ADMIN] = __('Admin'); 
    1414  } 
    15   echo $this->Form->input('User.role', array('type' => 'select', 'options' => $roles, 'selected' => $this->data['User']['role'])); 
     15  echo $this->Form->input('User.role', array('type' => 'select', 'options' => $roles, 'selected' => $this->request->data['User']['role'])); 
    1616?> 
    1717</fieldset> 
     
    2020<?php 
    2121  echo $this->Form->input('User.expires', array('label' => __('Expire date'), 'type' => 'text')); 
    22   echo $this->Form->input('User.quota', array('type' => 'text', 'label' => __('Upload Quota'), 'value' => $this->Number->toReadableSize($this->data['User']['quota']))); 
     22  echo $this->Form->input('User.quota', array('type' => 'text', 'label' => __('Upload Quota'), 'value' => $this->Number->toReadableSize($this->request->data['User']['quota']))); 
    2323?> 
    2424</fieldset> 
  • View/Users/admin_index.ctp

    r0fb8d7c ree4c2b7f  
    22<?php echo $this->Session->flash(); ?> 
    33 
    4 <?php $paginator->options(array('update' => 'main_content', 'indicator' => 'spinner'));?> 
     4<?php $this->Paginator->options(array('update' => 'main_content', 'indicator' => 'spinner'));?> 
    55 
    6 <?php echo $paginator->prev(__('Prev'), null, null, array('class' => 'disabled')); ?> 
    7 <?php echo " | "; echo $paginator->numbers(); ?> 
    8 <?php echo $paginator->next(__('Next'), null, null, array('class' => 'disabled')); ?> 
     6<?php echo $this->Paginator->prev(__('Prev'), null, null, array('class' => 'disabled')); ?> 
     7<?php echo " | "; echo $this->Paginator->numbers(); ?> 
     8<?php echo $this->Paginator->next(__('Next'), null, null, array('class' => 'disabled')); ?> 
    99 
    10 Page <?php echo $paginator->counter() ?> 
     10Page <?php echo $this->Paginator->counter() ?> 
    1111 
    1212<table class="default"> 
    1313<thead> 
    1414<tr> 
    15   <td><?php echo $paginator->sort(__('Username'), 'username'); ?></td> 
    16   <td><?php echo $paginator->sort(__('Firstname'), 'firstname'); ?></td> 
    17   <td><?php echo $paginator->sort(__('Lastname'), 'lastname'); ?></td> 
     15  <td><?php echo $this->Paginator->sort(__('Username'), 'username'); ?></td> 
     16  <td><?php echo $this->Paginator->sort(__('Firstname'), 'firstname'); ?></td> 
     17  <td><?php echo $this->Paginator->sort(__('Lastname'), 'lastname'); ?></td> 
    1818  <td><?php echo __('Guests'); ?></td> 
    19   <td><?php echo $paginator->sort(__('User role'), 'role'); ?></td> 
     19  <td><?php echo $this->Paginator->sort(__('User role'), 'role'); ?></td> 
    2020  <td><?php echo __('Actions'); ?></td> 
    2121</tr> 
     
    2323 
    2424<tbody> 
    25 <?php $row=0; foreach($this->data as $user): ?> 
     25<?php $row=0; foreach($this->request->data as $user): ?> 
    2626<tr class="<?php echo ($row++%2)?"even":"odd";?>"> 
    2727  <td><?php echo $this->Html->link($user['User']['username'], '/admin/users/edit/'.$user['User']['id']);?></td> 
  • View/Users/admin_password.ctp

    r0fb8d7c ree4c2b7f  
    1 <h1><?php echo __(" User: %s", $this->data['User']['username']); ?></h1> 
     1<h1><?php echo __(" User: %s", $this->request->data['User']['username']); ?></h1> 
    22 
    33<?php echo $this->Session->flash(); ?> 
    44 
    5 <?php echo $this->Form->create(null, array('action' => 'password/'.$this->data['User']['id'])); ?> 
     5<?php echo $this->Form->create(null, array('action' => 'password/'.$this->request->data['User']['id'])); ?> 
    66<fieldset><legend>Password</legend> 
    77<?php 
  • View/Users/admin_path.ctp

    r0fb8d7c ree4c2b7f  
    1 <h1><?php echo __(" User: %s", $this->data['User']['username']); ?></h1> 
     1<h1><?php echo __(" User: %s", $this->request->data['User']['username']); ?></h1> 
    22 
    33<?php echo $this->Session->flash(); ?> 
     
    1919    <td><?php  echo "$root"; ?></td> 
    2020    <td><?php 
    21       $delConfirm = __("Do you really want to detete the path '%s' of '%s'?", $root, $this->data['User']['username']); 
     21      $delConfirm = __("Do you really want to detete the path '%s' of '%s'?", $root, $this->request->data['User']['username']); 
    2222      echo $this->Html->link($this->Html->image('icons/delete.png', array('alt' => __('Delete'), 'title' => __("Delete path '%s'", $root))), 
    23     '/admin/users/delpath/'.$this->data['User']['id'].'/'.$root, array('escape' => false), $delConfirm);?></td> 
     23    '/admin/users/delpath/'.$this->request->data['User']['id'].'/'.$root, array('escape' => false), $delConfirm);?></td> 
    2424  </tr> 
    2525<?php endforeach; ?> 
     
    3535<?php endif; ?> 
    3636 
    37 <?php echo $this->Form->create(null, array('action' => 'path/'.$this->data['User']['id'])); ?> 
     37<?php echo $this->Form->create(null, array('action' => 'path/'.$this->request->data['User']['id'])); ?> 
    3838<fieldset><legend><?php echo __('Add Directory'); ?></legend> 
    3939<?php echo $this->Form->input('Option.path.fspath', array('label' => __('Directory'))); ?> 
  • View/Users/admin_register.ctp

    r0fb8d7c ree4c2b7f  
    55<fieldset><legend><?php echo __('Registration'); ?></legend> 
    66<?php echo $this->Form->input('user.register.enable', array('label' => __('Allow anonymous registration'), 'type' => 'checkbox')); ?> 
    7 <?php echo $this->Form->input('user.register.quota', array('label' => __('Initial quota limit'), 'type' => 'text', 'value' => $this->Number->toReadableSize($this->data['user']['register']['quota']))); ?> 
     7<?php echo $this->Form->input('user.register.quota', array('label' => __('Initial quota limit'), 'type' => 'text', 'value' => $this->Number->toReadableSize($this->request->data['user']['register']['quota']))); ?> 
    88</fieldset> 
    99<?php echo $this->Form->end(__('Save')); ?> 
  • View/Users/index.ctp

    r0fb8d7c ree4c2b7f  
    88<?php echo $this->Session->flash(); ?> 
    99 
    10 <?php if (!empty($this->data)): ?> 
     10<?php if (!empty($this->request->data)): ?> 
    1111<table class="default"> 
    1212<thead> 
     
    2424  $cells = array(); 
    2525 
    26   foreach($this->data as $user) { 
     26  foreach($this->request->data as $user) { 
    2727    $row = array( 
    2828      $this->Html->link($user['User']['username'], "view/{$user['User']['username']}"), 
    29       $time->relativeTime($user['User']['created']), 
     29      $this->Time->timeAgoInWords($user['User']['created']), 
    3030      ); 
    3131    $cells[] = $row; 
  • View/Users/view.ctp

    r0fb8d7c ree4c2b7f  
    11<h1><?php  
    2   __('User %s', $this->data['User']['username']);   
     2  __('User %s', $this->request->data['User']['username']);   
    33  if ($currentUser['User']['role'] >= ROLE_SYSOP) { 
    4     echo " " . $this->Html->link(__("Edit"), array('action' => 'edit', 'admin' => true, $this->data['User']['id'])); 
     4    echo " " . $this->Html->link(__("Edit"), array('action' => 'edit', 'admin' => true, $this->request->data['User']['id'])); 
    55  } 
    66?></h1> 
     
    2424<?php  
    2525  $cells = array(); 
    26   $cells[] = array(__("Member since"), $this->Time->relativeTime($this->data['User']['created'])); 
    27   $cells[] = array(__("Count of media"), $this->data['Media']['count']); 
    28   $cells[] = array(__("Count of files"), $this->data['File']['count']); 
    29   $cells[] = array(__("Size of files"), $this->Number->toReadableSize($this->data['File']['bytes'])); 
     26  $cells[] = array(__("Member since"), $this->Time->timeAgoInWords($this->request->data['User']['created'])); 
     27  $cells[] = array(__("Count of media"), $this->request->data['Media']['count']); 
     28  $cells[] = array(__("Count of files"), $this->request->data['File']['count']); 
     29  $cells[] = array(__("Size of files"), $this->Number->toReadableSize($this->request->data['File']['bytes'])); 
    3030  echo $this->Html->tableCells($cells, array('class' => 'odd'), array('class' => 'even')); 
    3131?>  
     
    5050<?php  
    5151  $cells = array(); 
    52   $groupIds = Set::extract('/Group/id', $this->data); 
    53   foreach ($this->data['Group'] as $group) { 
     52  $groupIds = Set::extract('/Group/id', $this->request->data); 
     53  foreach ($this->request->data['Group'] as $group) { 
    5454    $username = implode('', Set::extract("/User[id={$group['user_id']}]/username", $users)); 
    5555    $cells[] = array( 
    5656      $this->Html->link($group['name'], "/groups/view/{$group['name']}"), 
    5757      $this->Html->link($username, "/user/view/$username"), 
    58       $text->truncate($group['description'], 30, array('ending' => '...', 'exact' => false, 'html' => false)), 
     58      $this->Text->truncate($group['description'], 30, array('ending' => '...', 'exact' => false, 'html' => false)), 
    5959      $this->Html->link("View media", "/explorer/group/{$group['name']}") 
    6060      ); 
    6161  } 
    62   foreach ($this->data['Member'] as $group) { 
     62  foreach ($this->request->data['Member'] as $group) { 
    6363    if (in_array($group['id'], $groupIds)) { 
    6464      continue; 
     
    6868      $this->Html->link($group['name'], "/groups/view/{$group['name']}"), 
    6969      $this->Html->link($username, "/users/view/$username"), 
    70       $text->truncate($group['description'], 30, array('ending' => '...', 'exact' => false, 'html' => false)), 
     70      $this->Text->truncate($group['description'], 30, array('ending' => '...', 'exact' => false, 'html' => false)), 
    7171      $this->Html->link("View media", "/explorer/group/{$group['name']}") 
    7272      ); 
     
    9595  }  
    9696?></p> 
    97 <p><?php echo __('See all media of user %s', $this->Html->link($this->data['User']['username'], "/explorer/user/{$this->data['User']['username']}")); ?></p> 
     97<p><?php echo __('See all media of user %s', $this->Html->link($this->request->data['User']['username'], "/explorer/user/{$this->request->data['User']['username']}")); ?></p> 
    9898<?php endif; ?> 
  • View/home/index.ctp

    r0fb8d7c ree4c2b7f  
    4949<div class="meta"> 
    5050<span class="from"><?php echo $comment['Comment']['name'] ?></span> said  
    51 <span class="date"><?php echo $time->relativeTime($comment['Comment']['date']); ?>:</span> 
     51<span class="date"><?php echo $this->Time->timeAgoInWords($comment['Comment']['date']); ?>:</span> 
    5252</div><!-- comment meta --> 
    5353 
    5454<div class="text"> 
    55 <?php echo preg_replace('/\n/', '<br />', $text->truncate($comment['Comment']['text'], 220, array('ending' => '...', 'exact' => false, 'html' => false))); ?> 
     55<?php echo preg_replace('/\n/', '<br />', $this->Text->truncate($comment['Comment']['text'], 220, array('ending' => '...', 'exact' => false, 'html' => false))); ?> 
    5656</div> 
    5757</div><!-- comment -->