public function getposteditor($post, $args) { $args->data['$lang.sourceurl'] = tlocal::admin()->get('usernews', 'sourceurl'); if ($this->insertsource) { $args->sourceurl = isset($post->meta->sourceurl) ? $post->meta->sourceurl : ''; } $form = tfilestorage::getfile(litepublisher::$paths->plugins . $this->dir . DIRECTORY_SEPARATOR . $this->editorfile); $args->raw = $post->rawcontent; $html = tadminhtml::i(); $result = $post->id == 0 ? '' : $html->h2->formhead . $post->bookmark; $result .= $html->parsearg($form, $args); unset(ttheme::$vars['post']); return $html->fixquote($result); }
public function sendfile() { $themename = isset($_POST['themename']) ? trim($_POST['themename']) : ''; if ($themename != '') { $themename = tlinkgenerator::i()->filterfilename($themename); } if ($themename == '') { $themename = time(); } $path = "themes/generator-{$themename}/"; litepublisher::$classes->include_file(litepublisher::$paths->libinclude . 'zip.lib.php'); $zip = new zipfile(); $themedir = litepublisher::$paths->plugins . 'themegenerator' . DIRECTORY_SEPARATOR . $this->type . DIRECTORY_SEPARATOR; $args = new targs(); $colors = "[themecolors]\nthemename = \"{$themename}\"\n"; foreach ($this->colors as $name => $value) { $colors .= "{$name} = \"{$value}\"\n"; $args->{$name} = $value; } foreach (array('headerurl', 'logourl') as $name) { if (strbegin($this->colors[$name], 'http://')) { $basename = substr($this->colors[$name], strrpos($this->colors[$name], '/') + 1); $filename = litepublisher::$paths->files . 'themegen' . DIRECTORY_SEPARATOR . $basename; $zip->addFile(file_get_contents($filename), $path . 'images/' . $basename); $args->{$name} = 'images/' . $basename; } } $res = $this->res; $css = strtr(tfilestorage::getfile($res . 'scheme.tml'), $args->data); $zip->addFile($colors, $path . 'colors.ini'); $filelist = tfiler::getfiles($themedir); foreach ($filelist as $filename) { $content = tfilestorage::getfile($themedir . $filename); switch ($filename) { case 'style.css': $content .= $css; break; case 'about.ini': $content = str_replace('name = generator', "name = generator-{$themename}", $content); break; } $zip->addFile($content, $path . $filename); } $result = $zip->file(); if (ob_get_level()) { @ob_end_clean(); } header('HTTP/1.1 200 OK', true, 200); header('Content-type: application/octet-stream'); header('Content-Disposition: attachment; filename=generator.theme.' . $themename . '.zip'); header('Content-Length: ' . strlen($result)); header('Last-Modified: ' . date('r')); Header('Cache-Control: no-cache, must-revalidate'); Header('Pragma: no-cache'); echo $result; exit; }
public function build($body, $buttons) { $args = new targs(); $args->style = $this->style; $args->checkboxes = implode("\n", $this->checkboxes); $args->head = $this->head; $args->body = $body; $args->buttons = $buttons; $tml = tfilestorage::getfile(litepublisher::$paths->languages . 'tablecolumns.ini'); $theme = ttheme::i(); return $theme->parsearg($tml, $args); }