Show
Ignore:
Timestamp:
12/22/09 22:02:05 (3 years ago)
Author:
d0nut
Message:

possibly finished tagging version 0.8.2 - testing will follow

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • taggingreloaded/files/lib/action/TaggingReloadedSaveAction.class.php

    r1087 r1091  
    1212 */ 
    1313class TaggingReloadedSaveAction extends AbstractAction { 
    14         protected $taggableID = 0; 
     14        protected $taggable = ''; 
    1515        protected $className = ''; 
     16        protected $classPath = ''; 
    1617        protected $entryKey = 'entryID'; 
    17         protected $entryID = 0; 
     18        protected $objectID = 0; 
    1819        protected $languageID = 0; 
    1920 
     
    2425                parent::readParameters(); 
    2526                 
    26                 $this->taggableID = intval($_REQUEST['taggableID']); 
    2727                $this->className = $_REQUEST['className']; 
    28                 $this->entryID = intval($_REQUEST['entryID']); 
     28                $this->classPath = $_REQUEST['classPath']; 
     29                $this->objectID = intval($_REQUEST['objectID']); 
    2930                 
    30                 if(isset($_REQUEST['entryKey']) $this->entryKey = $_REQUEST['entryKey']; 
    31                 if(isset($_REQUEST['languageID']) $this->languageID = intval($_REQUEST['languageID']); 
     31                if(isset($_REQUEST['entryKey'])) $this->entryKey = $_REQUEST['entryKey']; 
     32                if(isset($_REQUEST['languageID'])) $this->languageID = intval($_REQUEST['languageID']); 
     33                if(isset($_REQUEST['taggable'])) $this->taggable = $_REQUEST['taggable']; 
     34                 
     35                $this->tags3 = TaggingReloadedUtil::readFormParameters(); 
    3236        } 
    3337         
     
    3842                parent::execute(); 
    3943                 
    40                 $tagged = new $this->className(array( 
    41                         $this->entryKey => $this->entryID, 
     44                if(!preg_match('/^Tagged/', $this->className) || preg_match('/\./', $this->className)) { 
     45                        throw new PermissionDeniedException(); 
     46                } 
     47                 
     48                $classPath = WCF_DIR.'lib/data/'.$this->classPath.'/'.$this->className.'.class.php'; 
     49                 
     50                if(preg_match('/\./', $this->classPath) || !file_exists($classPath)) { 
     51                        throw new PermissionDeniedException(); 
     52                } 
     53                 
     54                require_once $classPath; 
     55                 
     56                $tagged = new $this->className(null, array( 
     57                        $this->entryKey => $this->objectID, 
    4258                        'taggable' => TagEngine::getInstance()->getTaggable($this->taggable) 
    4359                )); 
     
    4763                } 
    4864                 
    49                 TaggingUtil::save($userid. $tags, $tagged, $this->languageID); 
     65                $userID = WCF::getUser()->userID; 
     66                 
     67                $existingTagsUser = TaggingReloadedUtil::getTagsByObject($userID, $tagged, $this->languageID, true); 
     68                $existingTagsObject = TaggingReloadedUtil::getTagsByObject($userID, $tagged, $this->languageID, false); 
     69                TaggingReloadedUtil::tagging3save($userID, $tagged, $this->languageID, $this->tags3, $existingTagsUser, $existingTagsObject); 
    5070                 
    5171                $this->executed();