Example #1
0
 public function tagdeleted($idtag)
 {
     foreach ($this->items as &$item) {
         array_delete_value($item['cats'], $idtag);
     }
     $this->save();
 }
Example #2
0
 public function setgroups($id, array $idgroups)
 {
     $idgroups = array_unique($idgroups);
     array_delete_value($idgroups, '');
     array_delete_value($idgroups, false);
     array_delete_value($idgroups, null);
     $this->items[$id]['idgroups'] = $idgroups;
     $db = $this->getdb($this->grouptable);
     $db->delete("iduser = {$id}");
     foreach ($idgroups as $idgroup) {
         $db->add(array('iduser' => $id, 'idgroup' => $idgroup));
     }
 }
 public function beforecat(&$result)
 {
     $cats = $this->cats;
     $idcat = $cats->id;
     if (!$idcat) {
         return;
     }
     $result .= $this->getbread($idcat);
     if ($this->showsimilar) {
         $idposts = $cats->getidposts($idcat);
         $list = array();
         foreach ($idposts as $idpost) {
             $list = array_merge($list, tpost::i($idpost)->categories);
         }
         array_clean($list);
         array_delete_value($list, $idcat);
         $result .= $this->getsimilar($list);
     }
     return $result;
 }
 public function setblacklist(array $a)
 {
     $a = array_unique($a);
     array_delete_value($a, '');
     $this->data['blacklist'] = $a;
     $this->save();
     $dblist = array();
     foreach ($a as $s) {
         if ($s == '') {
             continue;
         }
         $dblist[] = dbquote($s);
     }
     if (count($dblist) > 0) {
         $db = $this->db;
         $db->delete("item in (select id from {$db->users} where email in (" . implode(',', $dblist) . '))');
     }
 }
 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);
 }
Example #6
0
 protected function set_post(tpost $post)
 {
     extract($_POST, EXTR_SKIP);
     $post->title = $title;
     $cats = self::processcategories();
     $cats = array_unique($cats);
     array_delete_value($cats, 0);
     array_delete_value($cats, '');
     array_delete_value($cats, false);
     array_delete_value($cats, null);
     $post->categories = $cats;
     if ($post->id == 0 && litepublisher::$options->user > 1) {
         $post->author = litepublisher::$options->user;
     }
     if (isset($tags)) {
         $post->tagnames = $tags;
     }
     if (isset($icon)) {
         $post->icon = (int) $icon;
     }
     if (isset($idview)) {
         $post->idview = $idview;
     }
     if (isset($files)) {
         $files = trim($files, ', ');
         $post->files = tdatabase::str2array($files);
     }
     if (isset($date) && $date) {
         $post->posted = tadminhtml::getdatetime('date');
     }
     if (isset($status)) {
         $post->status = $status == 'draft' ? 'draft' : 'published';
         $post->comstatus = $comstatus;
         $post->pingenabled = isset($pingenabled);
         $post->idperm = (int) $idperm;
         if ($password != '') {
             $post->password = $password;
         }
     }
     if (isset($url)) {
         $post->url = $url;
         $post->title2 = $title2;
         $post->keywords = $keywords;
         $post->description = $description;
         $post->rawhead = $head;
     }
     $post->content = $raw;
     if (isset($excerpt)) {
         $post->excerpt = $excerpt;
     }
     if (isset($rss)) {
         $post->rss = $rss;
     }
     if (isset($more)) {
         $post->moretitle = $more;
     }
     if (isset($filtered)) {
         $post->filtered = $filtered;
     }
     if (isset($upd)) {
         $update = sprintf($this->lang->updateformat, tlocal::date(time()), $upd);
         $post->content = $post->rawcontent . "\n\n" . $update;
     }
 }
 public function delete_event($name)
 {
     if (isset($this->events[$name])) {
         unset($this->events[$name]);
         array_delete_value($this->eventnames, $name);
         $this->save();
     }
 }