public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->banned_words)) {
         foreach ($sx->banned_words->banned_word as $p) {
             $bw = BannedWord::add(str_rot13($p));
         }
     }
 }
 public function get()
 {
     $r = parent::get(0, 0);
     $bannedwords = array();
     foreach ($r as $row) {
         $bannedwords[] = BannedWord::getByID($row['bwID']);
     }
     return $bannedwords;
 }
 public function get($itemsToGet = 0, $offset = 0)
 {
     $r = parent::get($itemsToGet, $offset);
     $bannedwords = array();
     foreach ($r as $row) {
         $bannedwords[] = BannedWord::getByID($row['bwID']);
     }
     return $bannedwords;
 }
 public function save()
 {
     $db = Loader::db();
     $db->execute("TRUNCATE TABLE BannedWords");
     $db->execute("ALTER TABLE BannedWords AUTO_INCREMENT=0");
     foreach ($this->post('banned_word') as $bw) {
         BannedWord::add($bw);
     }
     Config::save('conversation.banned_words', !!$this->post('banned_list_enabled'));
     $this->view();
     $this->redirect('dashboard/system/conversations/bannedwords/success');
 }
 public function execute(Batch $batch)
 {
     $words = $batch->getObjectCollection('banned_word');
     if (!$words) {
         return;
     }
     foreach ($words->getWords() as $word) {
         if (!$word->getPublisherValidator()->skipItem()) {
             BannedWord::add(str_rot13($word->getWord()));
         }
     }
 }
Exemple #6
0
 public function save()
 {
     $this->view();
     /** @var Token $token */
     $token = \Core::make('token');
     if (!$token->validate("update_banned_words")) {
         $this->error->add('Invalid Token.');
         return;
     }
     $db = Loader::db();
     $db->execute("TRUNCATE TABLE BannedWords");
     $db->execute("ALTER TABLE BannedWords AUTO_INCREMENT=0");
     if (count($this->post('banned_word'))) {
         foreach ($this->post('banned_word') as $bw) {
             BannedWord::add($bw);
         }
     }
     Config::save('conversations.banned_words', !!$this->post('banned_list_enabled'));
     $this->redirect('dashboard/system/conversations/bannedwords/success');
 }
 public function skipItem()
 {
     $word = BannedWord::getByWord(str_rot13($this->object->getWord()));
     return is_object($word);
 }