Esempio n. 1
0
 public function escape(array $item)
 {
     foreach (array('title', 'description', 'keywords') as $name) {
         $item[$name] = tcontentfilter::escape(tcontentfilter::unescape($item[$name]));
     }
     return $item;
 }
 public function edit($id, $title, $description, $keywords, $content)
 {
     if (!$this->itemexists($id)) {
         return false;
     }
     $filter = tcontentfilter::i();
     $item = $this->items[$id];
     $this->items[$id] = array('idurl' => $item['idurl'], 'url' => $item['url'], 'title' => $title, 'filtered' => $filter->filter($content), 'rawcontent' => $content, 'description' => tcontentfilter::escape($description), 'keywords' => tcontentfilter::escape($keywords), 'idview' => $item['idview']);
     $this->save();
     litepublisher::$urlmap->clearcache();
 }
 public function settagnames($names)
 {
     $names = trim($names);
     if ($names == '') {
         $this->tags = array();
         return;
     }
     $parent = $this->getparenttag();
     $tags = ttags::i();
     $items = array();
     $list = explode(',', trim($names));
     foreach ($list as $title) {
         $title = tcontentfilter::escape($title);
         if ($title == '') {
             continue;
         }
         $items[] = $tags->add($parent, $title);
     }
     $this->tags = $items;
 }
Esempio n. 4
0
 public function settitle($title)
 {
     $this->data['title'] = tcontentfilter::escape(tcontentfilter::unescape($title));
 }
 public function createnames($list)
 {
     if (is_string($list)) {
         $list = explode(',', trim($list));
     }
     $result = array();
     $this->lock();
     foreach ($list as $title) {
         $title = tcontentfilter::escape($title);
         if ($title == '') {
             continue;
         }
         $result[] = $this->add(0, $title);
     }
     $this->unlock();
     return $result;
 }
Esempio n. 6
0
 public function files_setprops(array $args)
 {
     if (!litepublisher::$options->hasgroup('author')) {
         return $this->forbidden();
     }
     $id = (int) $args['idfile'];
     $files = tfiles::i();
     if (!$files->itemexists($id)) {
         return $this->forbidden();
     }
     $item = $files->getitem($id);
     $item['title'] = tcontentfilter::escape(tcontentfilter::unescape($args['title']));
     $item['description'] = tcontentfilter::escape(tcontentfilter::unescape($args['description']));
     $item['keywords'] = tcontentfilter::escape(tcontentfilter::unescape($args['keywords']));
     $this->callevent('onprops', array(&$item));
     $item = $files->escape($item);
     $files->db->updateassoc($item);
     return array('item' => $item);
 }
 public function processcomuser(array &$values)
 {
     $lang = tlocal::i('comment');
     if (empty($values['name'])) {
         return $this->geterrorcontent($lang->emptyname);
     }
     $values['name'] = tcontentfilter::escape($values['name']);
     $values['email'] = isset($values['email']) ? strtolower(trim($values['email'])) : '';
     if (!tcontentfilter::ValidateEmail($values['email'])) {
         return $this->geterrorcontent($lang->invalidemail);
     }
     $values['url'] = isset($values['url']) ? tcontentfilter::escape(tcontentfilter::clean_website($values['url'])) : '';
     $values['subscribe'] = isset($values['subscribe']);
 }
 public function addtml()
 {
     $type = $_POST['type'];
     $name = tcontentfilter::escape($_POST['name']);
     $title = tcontentfilter::escape($_POST['title']);
     $items = strtoarray(str_replace(array("\r\n", "\r"), "\n", trim($_POST['newitems'])));
     $items = array_unique($items);
     array_delete_value($items, '');
     if (count($items) == 0) {
         return false;
     }
     return tpolls::i()->add_tml($type, $name, $title, $items);
 }