public function processform() { $datadir = litepublisher::$paths->data . 'keywords' . DIRECTORY_SEPARATOR; if (isset($_POST['optionsform'])) { extract($_POST, EXTR_SKIP); $plugin = tkeywordsplugin::i(); $widget = tkeywordswidget::i(); $widgets = twidgets::i(); $idwidget = $widgets->find($widget); $widget->lock(); $widget->settitle($idwidget, $title); $widget->count = (int) $count; $widget->notify = isset($notify); $trace = isset($trace); if ($widget->trace != $trace) { if ($trace) { litepublisher::$urlmap->afterrequest = $plugin->parseref; } else { litepublisher::$urlmap->delete_event_class('afterrequest', get_class($plugin)); } } $widget->trace = $trace; $widget->unlock(); $plugin->blackwords = array(); $words = strtoarray($blackwords); if (litepublisher::$options->language != 'en') { tlocal::usefile('translit'); foreach ($words as $word) { $word = strtr($word, tlocal::$self->ini['translit']); $word = trim($word); if (empty($word)) { continue; } $plugin->blackwords[] = strtolower($word); } } $plugin->save(); return; } if (isset($_GET['filename'])) { $filename = str_replace('_', '.', $_GET['filename']); $content = trim($_POST['content']); if ($content == '') { @unlink($datadir . $filename); } else { file_put_contents($datadir . $filename, $content); } return; } foreach ($_POST as $filename => $value) { $filename = str_replace('_', '.', $filename); if (preg_match('/^\\d+?\\.\\d+?\\.php$/', $filename)) { unlink($datadir . $filename); } } }
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); }
public function downloadreleases() { if (isset($this->releases)) { return $this->releases; } if (($s = http::get('http://litepublisher.com/service/versions.txt')) || ($s = http::get('http://litepublisher.googlecode.com/svn/trunk/lib/install/versions.txt'))) { $this->releases = strtoarray($s); return $this->releases; } return false; }
function installoptions($email, $language) { $options = toptions::i(); $options->lock(); $options->solt = md5uniq(); $usehost = isset($_REQUEST['usehost']) ? $_REQUEST['usehost'] == '1' : false; $options->data['dbconfig'] = array('driver' => 'mysqli', 'host' => $usehost ? $_REQUEST['dbhost'] : 'localhost', 'port' => $usehost ? (int) $_REQUEST['dbport'] : 0, 'dbname' => $_REQUEST['dbname'], 'login' => $_REQUEST['dblogin'], 'password' => '', 'prefix' => $_REQUEST['dbprefix']); $options->setdbpassword($_REQUEST['dbpassword']); try { litepublisher::$db = new tdatabase(); } catch (Exception $e) { die($e->GetMessage()); } if (litepublisher::$debug) { $db = litepublisher::$db; $list = $db->res2array($db->query("show tables from " . $options->dbconfig['dbname'])); foreach ($list as $row) { $table = $row[0]; if (strbegin($table, $db->prefix)) { $db->exec('DROP TABLE IF EXISTS ' . $table); } } } $options->language = $language; $options->email = $email; $options->dateformat = ''; $options->password = ''; $password = md5uniq(); $options->changepassword($password); $options->authenabled = true; $options->cookiehash = ''; $options->cookieexpired = 0; $options->securecookie = false; $options->mailer = ''; $options->data['cache'] = true; $options->expiredcache = 3600; $options->admincache = false; $options->ob_cache = true; $options->compress = false; $options->filetime_offset = tfiler::get_filetime_offset(); $options->data['perpage'] = 10; $options->commentsdisabled = false; $options->comstatus = 'guest'; $options->pingenabled = true; $options->commentpages = true; $options->commentsperpage = 100; $options->comments_invert_order = false; $options->commentspull = false; $versions = strtoarray(file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'versions.txt')); $options->version = $versions[0]; $options->echoexception = true; $options->parsepost = true; $options->hidefilesonpage = false; $options->show_draft_post = false; $options->usersenabled = false; $options->reguser = false; $options->icondisabled = false; $options->crontime = time(); $options->show_file_perm = false; $options->xxxcheck = empty($_SERVER['HTTP_REFERER']) && isset($_POST) && count($_POST) > 0 ? false : true; $options->fromemail = 'litepublisher@' . $_SERVER['HTTP_HOST']; $options->unlock(); return $password; }