public function sendexceptions() { $filename = litepublisher::$paths->data . 'logs' . DIRECTORY_SEPARATOR . 'exceptionsmail.log'; if (!file_exists($filename)) { return; } $time = @filectime($filename); if ($time === false || $time + 3600 > time()) { return; } $s = file_get_contents($filename); tfilestorage::delete($filename); tmailer::SendAttachmentToAdmin('[error] ' . litepublisher::$site->name, 'See attachment', 'errors.txt', $s); sleep(2); }
public function getcontent() { $result = ''; $polls = tpolls::i(); $html = tadminhtml::i(); $lang = tlocal::admin('polls'); $args = new targs(); $dir = litepublisher::$paths->data . 'polls'; $adminurl = $this->adminurl; if ($action = $this->action) { $id = $this->idget(); switch ($action) { case 'delete': $man = tpollsman::i(); if ($id == $man->pollpost) { return $html->h4->deletepullpost; } if ($this->confirmed) { tfilestorage::delete($dir . DIRECTORY_SEPARATOR . "{$id}.php"); tfilestorage::delete($dir . DIRECTORY_SEPARATOR . "{$id}.bak.php"); unset($polls->tml_items[$id]); $polls->db->update('id_tml = ' . $man->pollpost, "id_tml = {$id}"); $result .= $html->h4->deleted; } else { $result .= $html->confirmdelete($id, $adminurl, $lang->confirmdelete); } break; case 'edit': if ($tml = $polls->get_tml($id)) { $args->add($tml); $args->id = $id; $args->name = tcontentfilter::unescape($tml['name']); $args->title = tcontentfilter::unescape($tml['title']); //$args->items = implode("\n", $tml['items']); $tabs = new tuitabs(); //$tabs->add($lang->pollitems, "[editor=items]"); $tabs->add($lang->opened, "[editor=opened]"); $tabs->add($lang->closed, "[editor=closed]"); $args->formtitle = $lang->edittemplate; $result .= $html->adminform(' [text=name] [text=title]' . $tabs->get(), $args); } break; case 'add': $types = array_keys(tpolltypes::i()->items); $args->type = tadminhtml::array2combo(array_combine($types, $types), $types[0]); $args->name = ''; $args->title = ''; $args->newitems = ''; $args->formtitle = $lang->newtemplate; $result .= $html->adminform('[text=name] [text=title] [combo=type] [editor=newitems]', $args); break; } } $result .= $html->h3("<a href='{$adminurl}=0&action=add'>{$lang->addtemplate}</a>"); $result .= $html->h4->alltemplates; $args->adminurl = $adminurl; $table = ''; $tr = '<tr> <td><a href="$adminurl=$id&action=edit">$name</a></td> <td><a href="$adminurl=$id&action=delete">$lang.delete</a></td> </tr>'; $polls->loadall_tml(); foreach ($polls->tml_items as $id => $tml) { $args->id = $id; $args->name = $tml['name']; $args->title = $tml['title']; $table .= $html->parsearg($tr, $args); } $head = "<tr>\n <th>{$lang->edit}</th>\n <th>{$lang->delete}</th>\n </tr>"; $result .= $html->gettable($head, $table); return $result; }
public function delete($name) { if (!isset($this->items[$name])) { return false; } $item = $this->items[$name]; unset($this->items[$name]); $this->save(); $datafile = false; if (class_exists($item['class'])) { $plugin = getinstance($item['class']); if ($plugin instanceof tplugin) { $datafile = litepublisher::$paths->data . $plugin->getbasename(); } } litepublisher::$classes->lock(); if (!empty($item['adminclass'])) { litepublisher::$classes->delete($item['adminclass']); } litepublisher::$classes->delete($item['class']); litepublisher::$classes->unlock(); if ($datafile) { tfilestorage::delete($datafile . '.php'); tfilestorage::delete($datafile . '.bak.php'); } $this->deleted($name); }
public function delete_tml($id_tml) { $this->db->update("id_tml = 1", "id_tml = {$id_tml}"); $filename = $this->getfilename($id_tml); tfilestorage::delete($filename . '.php'); tfilestorage::delete($filename . '.bak.php'); }
public function delete($id) { if (!$this->itemexists($id)) { return false; } if ($id == $this->idhome) { return false; } if ($this->haschilds($id)) { return false; } if ($this->items[$id]['idurl'] > 0) { litepublisher::$urlmap->delete($this->items[$id]['url']); } $this->lock(); unset($this->items[$id]); $this->sort(); $this->unlock(); $this->deleted($id); tfilestorage::delete($this->dir . $id . '.php'); tfilestorage::delete($this->dir . $id . '.bak.php'); litepublisher::$urlmap->clearcache(); return true; }