public function getcontent()
 {
     $merger = tlocalmerger::i();
     $tabs = new tuitabs();
     $html = $this->html;
     $lang = tlocal::i('options');
     $args = targs::i();
     foreach ($merger->items as $section => $items) {
         $tab = new tuitabs();
         $tab->add($lang->files, $html->getinput('editor', $section . '_files', tadminhtml::specchars(implode("\n", $items['files'])), $lang->files));
         $tabtext = new tuitabs();
         foreach ($items['texts'] as $key => $text) {
             $tabtext->add($key, $html->getinput('editor', $section . '_text_' . $key, tadminhtml::specchars($text), $key));
         }
         $tab->add($lang->text, $tabtext->get());
         $tabs->add($section, $tab->get());
     }
     $tabs->add('HTML', $html->getinput('editor', 'adminhtml_files', tadminhtml::specchars(implode("\n", $merger->html)), $lang->files));
     $args->formtitle = $lang->optionslocal;
     $args->dateformat = litepublisher::$options->dateformat;
     $dirs = tfiler::getdir(litepublisher::$paths->languages);
     $args->language = tadminhtml::array2combo(array_combine($dirs, $dirs), litepublisher::$options->language);
     $zones = timezone_identifiers_list();
     $args->timezone = tadminhtml::array2combo(array_combine($zones, $zones), litepublisher::$options->timezone);
     return $html->adminform('[text=dateformat]
 [combo=language]
 [combo=timezone]' . $tabs->get(), $args);
 }
 public static function getlist($tml, $selected)
 {
     $result = '';
     if (!is_array($selected)) {
         $selected = array((string) $selected);
     }
     $html = tadminhtml::i();
     $html->section = 'themes';
     $args = targs::i();
     $list = tfiler::getdir(litepublisher::$paths->themes);
     sort($list);
     $args->filesurl = tadminhtml::getadminlink('/admin/views/themefiles/', 'theme');
     $parser = tthemeparser::i();
     foreach ($list as $name) {
         if ($about = $parser->getabout($name)) {
             $about['name'] = $name;
             if (!isset($about['screenshot'])) {
                 $about['screenshot'] = 'screenshot.png';
             }
             $args->add($about);
             $args->checked = in_array($name, $selected);
             $result .= $html->parsearg($tml, $args);
         }
     }
     return $result;
 }
Beispiel #3
0
function auto_convert_themes()
{
    $dir = litepublisher::$paths->home . 'themes4' . DIRECTORY_SEPARATOR;
    @mkdir($dir, 0777);
    @chmod($dir, 0777);
    $list = tfiler::getdir(litepublisher::$paths->themes);
    sort($list);
    echo "<pre>\n";
    foreach ($list as $name) {
        echo "{$name} theme:\n";
        if ($name == 'default') {
            continue;
        }
        $newdir = $dir . $name;
        @mkdir($newdir, 0777);
        @chmod($newdir, 0777);
        $theme = ttheme::getinstance($name);
        tthemeparser::compress($theme, $newdir . DIRECTORY_SEPARATOR);
    }
}
 public function getcontent()
 {
     $result = '';
     $views = tviews::i();
     $html = $this->html;
     $lang = tlocal::i('views');
     $args = new targs();
     switch ($this->name) {
         case 'views':
             $html->addsearch('views');
             $lang->addsearch('views');
             $id = tadminhtml::getparam('idview', 0);
             if (!$id || !$views->itemexists($id)) {
                 $adminurl = $this->adminurl . 'view';
                 return $html->h4($html->getlink($this->url . '/addview/', $lang->add)) . $html->buildtable($views->items, array(array('left', $lang->name, "<a href=\"{$adminurl}=\$id\">\$name</a>"), array('center', $lang->delete, "<a href=\"{$adminurl}=\$id&action=delete\" class=\"confirm-delete-link\">{$lang->delete}</a>")));
             }
             $result = self::getviewform($this->url);
             $tabs = new tuitabs();
             $menuitems = array();
             foreach ($views->items as $itemview) {
                 $class = $itemview['menuclass'];
                 $menuitems[$class] = $class == 'tmenus' ? $lang->stdmenu : ($class == 'tadminmenus' ? $lang->adminmenu : $class);
             }
             $itemview = $views->items[$id];
             $args->add($itemview);
             $tabs->add($lang->widgets, $this->get_view_sidebars($id, $html, $lang, $args));
             $args->menu = tadminhtml::array2combo($menuitems, $itemview['menuclass']);
             $tabs->add($lang->name, '[text=name]' . ($id == 1 ? '' : '[checkbox=customsidebar] [checkbox=disableajax]') . '[checkbox=hovermenu] [combo=menu]');
             $view = tview::i($id);
             $lang->firstsearch('themes');
             $tabs->add($lang->theme, tadminthemes::getlist($html->radiotheme, $view->theme->name));
             if (count($view->custom)) {
                 $tabs->add($lang->custom, $this->get_custom($view));
             }
             $result .= $html->h4->help;
             $form = new adminform($args);
             $form->id = 'admin-view-form';
             $form->title = $lang->edit;
             $form->items = $tabs->get();
             $result .= $form->get();
             $result .= ttemplate::i()->getjavascript(ttemplate::i()->jsmerger_adminviews);
             break;
         case 'addview':
             $args->formtitle = $lang->addview;
             $result .= $html->adminform('[text=name]', $args);
             break;
         case 'spec':
             $tabs = new tuitabs();
             $inputs = '';
             foreach (self::getspecclasses() as $classname) {
                 $obj = getinstance($classname);
                 $args->classname = $classname;
                 $name = substr($classname, 1);
                 $args->title = $lang->{$name};
                 $inputs = self::getcomboview($obj->idview, "idview-{$classname}");
                 if (isset($obj->data['keywords'])) {
                     $inputs .= $html->getedit("keywords-{$classname}", $obj->data['keywords'], $lang->keywords);
                 }
                 if (isset($obj->data['description'])) {
                     $inputs .= $html->getedit("description-{$classname}", $obj->data['description'], $lang->description);
                 }
                 if (isset($obj->data['head'])) {
                     $inputs .= $html->getinput('editor', "head-{$classname}", tadminhtml::specchars($obj->data['head']), $lang->head);
                 }
                 $tabs->add($lang->{$name}, $inputs);
             }
             $args->formtitle = $lang->defaults;
             $result .= tuitabs::gethead() . $html->adminform($tabs->get(), $args);
             break;
         case 'group':
             $args->formtitle = $lang->viewposts;
             $result .= $html->adminform(self::getcomboview($views->defaults['post'], 'postview') . '<input type="hidden" name="action" value="posts" />', $args);
             $args->formtitle = $lang->viewmenus;
             $result .= $html->adminform(self::getcomboview($views->defaults['menu'], 'menuview') . '<input type="hidden" name="action" value="menus" />', $args);
             $args->formtitle = $lang->themeviews;
             $view = tview::i();
             $list = tfiler::getdir(litepublisher::$paths->themes);
             sort($list);
             $themes = array_combine($list, $list);
             $result .= $html->adminform($html->getcombo('themeview', tadminhtml::array2combo($themes, $view->themename), $lang->themename) . '<input type="hidden" name="action" value="themes" />', $args);
             break;
         case 'defaults':
             $items = '';
             $theme = ttheme::i();
             $tml = $theme->templates['content.admin.combo'];
             foreach ($views->defaults as $name => $id) {
                 $args->name = $name;
                 $args->value = self::getcombo($id);
                 $args->data['$lang.$name'] = $lang->{$name};
                 $items .= $theme->parsearg($tml, $args);
             }
             $args->items = $items;
             $args->formtitle = $lang->defaultsform;
             $result .= $theme->parsearg($theme->content->admin->form, $args);
             break;
         case 'headers':
             $tabs = new tuitabs();
             $args->heads = ttemplate::i()->heads;
             $tabs->add($lang->headstitle, '[editor=heads]');
             $args->adminheads = tadminmenus::i()->heads;
             $tabs->add($lang->admin, '[editor=adminheads]');
             $ajax = tajaxposteditor::i();
             $args->ajaxvisual = $ajax->ajaxvisual;
             $args->visual = $ajax->visual;
             $args->show_file_perm = litepublisher::$options->show_file_perm;
             $tabs->add($lang->posteditor, '[checkbox=show_file_perm] [checkbox=ajaxvisual] [text=visual]');
             $args->formtitle = $lang->headstitle;
             $result = $html->adminform($tabs->get(), $args);
             $result .= tuitabs::gethead();
             break;
         case 'admin':
             return $this->adminoptionsform->getform();
     }
     return $html->fixquote($result);
 }
 protected function create()
 {
     parent::create();
     $this->names = tfiler::getdir(litepublisher::$paths->plugins);
     sort($this->names);
 }
 public function update(array $list)
 {
     $add = array_diff($list, array_keys($this->items));
     $delete = array_diff(array_keys($this->items), $list);
     $delete = array_intersect($delete, tfiler::getdir(litepublisher::$paths->plugins));
     $this->lock();
     foreach ($delete as $name) {
         $this->Delete($name);
     }
     foreach ($add as $name) {
         $this->Add($name);
     }
     $this->unlock();
 }