protected static function getsubcategories($parent, array $postitems, $exclude = false)
 {
     $result = '';
     $categories = tcategories::i();
     $html = tadminhtml::getinstance('editor');
     $tml = str_replace('$checkbox', $html->getinput('checkbox', 'category-$id', 'value="$id" $checked', '$title'), $html->category);
     $args = new targs();
     foreach ($categories->items as $id => $item) {
         if ($parent != $item['parent']) {
             continue;
         }
         if ($exclude && in_array($id, $exclude)) {
             continue;
         }
         $args->add($item);
         $args->checked = in_array($item['id'], $postitems);
         $args->subcount = '';
         $args->subitems = self::getsubcategories($id, $postitems);
         $result .= $html->parsearg($tml, $args);
     }
     if ($result == '') {
         return '';
     }
     return sprintf($html->categories(), $result);
 }
 public function getcontent()
 {
     if (!($id = $this->getidfile())) {
         return $this->notfound;
     }
     $result = '';
     $files = tfiles::i();
     $html = $this->html;
     $lang = tlocal::admin();
     $args = new targs();
     $item = $files->getitem($id);
     $idpreview = $item['preview'];
     if ($idpreview > 0) {
         $args->add($files->getitem($idpreview));
         $form = new adminform($args);
         $form->action = "{$this->adminurl}={$id}";
         $form->inline = true;
         $form->items = $html->p('<img src="$site.files/files/$filename" alt="thumbnail" />' . $lang->wantdelete);
         $form->submit = 'delete';
         $result .= $form->get();
     }
     $form = new adminform($args);
     $form->upload = true;
     $form->action = "{$this->adminurl}={$id}";
     $form->title = $lang->changethumb;
     $form->items = '[upload=filename]
 [checkbox=noresize]';
     $result .= $form->get();
     return $result;
 }
 public function getsortedcontent(array $tml, $parent, $sortname, $count, $showcount)
 {
     $sorted = $this->getsorted($parent, $sortname, $count);
     if (count($sorted) == 0) {
         return '';
     }
     $result = '';
     $iconenabled = !litepublisher::$options->icondisabled;
     $theme = ttheme::i();
     $args = new targs();
     $args->rel = $this->PermalinkIndex;
     $args->parent = $parent;
     foreach ($sorted as $id) {
         $item = $this->getitem($id);
         $args->add($item);
         $args->icon = $iconenabled ? $this->geticonlink($id) : '';
         $args->subcount = $showcount ? $theme->parsearg($tml['subcount'], $args) : '';
         $args->subitems = $tml['subitems'] ? $this->getsortedcontent($tml, $id, $sortname, $count, $showcount) : '';
         $result .= $theme->parsearg($tml['item'], $args);
     }
     if ($parent == 0) {
         return $result;
     }
     $args->parent = $parent;
     $args->item = $result;
     return $theme->parsearg($tml['subitems'], $args);
 }
 public function getcontent()
 {
     $type = tadminhtml::getparam('type', 'tags') == 'tags' ? 'tags' : 'categories';
     $tags = $type == 'tags' ? ttags::i() : tcategories::i();
     if ($err = self::auth()) {
         return $err;
     }
     $id = tadminhtml::idparam();
     if ($id > 0 && !$tags->itemexists($id)) {
         return self::error403();
     }
     $theme = tview::i(tviews::i()->defaults['admin'])->theme;
     $html = tadminhtml::i();
     $html->section = 'tags';
     $lang = tlocal::i('tags');
     if ($id == 0) {
         $views = tviews::i();
         $name = $type == 'tags' ? 'tag' : 'category';
         $item = array('title' => '', 'idview' => isset($views->defaults[$name]) ? $views->defaults[$name] : 1, 'idperm' => 0, 'icon' => 0, 'includechilds' => $tags->includechilds, 'includeparents' => $tags->includeparents, 'invertorder' => false, 'lite' => $tags->lite, 'liteperpage' => 1000, 'url' => '', 'keywords' => '', 'description' => '', 'head' => '');
     } else {
         $item = $tags->getitem($id);
     }
     switch ($_GET['get']) {
         case 'view':
             if ($id > 0) {
                 foreach (array('includechilds', 'includeparents', 'invertorder', 'lite') as $prop) {
                     $item[$prop] = (int) $item[$prop] > 0;
                 }
             }
             $args = new targs();
             $args->add($item);
             $result = $html->parsearg('[checkbox=includechilds] [checkbox=includeparents] [checkbox=invertorder] [checkbox=lite] [text=liteperpage]', $args);
             $result .= $this->getviewicon($item['idview'], $item['icon']);
             $result .= tadminperms::getcombo($item['idperm']);
             break;
         case 'seo':
             $args = targs::i();
             if ($id == 0) {
                 $args->url = '';
                 $args->keywords = '';
                 $args->description = '';
                 $args->head = '';
             } else {
                 $args->add($tags->contents->getitem($id));
                 $args->url = $tags->items[$id]['url'];
             }
             $result = $html->parsearg('[text=url] [text=description] [text=keywords] [editor=head]', $args);
             break;
         case 'text':
             $result = $this->geteditor('raw', $id == 0 ? '' : $tags->contents->getcontent($id), true);
             $result .= $this->gethead();
             break;
         default:
             $result = var_export($_GET, true);
     }
     return turlmap::htmlheader(false) . $result;
 }
 public static function getgroups(array $idgroups)
 {
     $result = '';
     $groups = tusergroups::i();
     $tml = '<li><input type="checkbox" name="idgroup-$id" id="checkbox-idgroup-$id" value="$id" $checked />
 <label for="checkbox-idgroup-$id"><strong>$title</strong></label></li>';
     $theme = ttheme::i();
     $args = new targs();
     foreach ($groups->items as $id => $item) {
         $args->add($item);
         $args->id = $id;
         $args->checked = in_array($id, $idgroups);
         $result .= strtr($tml, $args->data);
     }
     return sprintf('<ul>%s</ul>', $result);
 }
 public static function getcontent($holder, $menu)
 {
     $result = '';
     $html = $menu->html;
     $lang = tlocal::admin();
     $id = (int) tadminhtml::getparam('id', 0);
     $args = new targs();
     $args->id = $id;
     $args->adminurl = $menu->adminurl;
     if (isset($_GET['action']) && $_GET['action'] == 'delete' && $tags->itemexists($id)) {
         if (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 1) {
             $holder->delete($id);
             $result .= $html->h4->deleted;
         } else {
             return $html->confirmdelete($id, $menu->adminurl, $lang->confirmdelete);
         }
     }
     if ($id == 0) {
         $item = $menu->defaultitem;
     } elseif ($holder->itemexists($id)) {
         $item = $holder->getitem($id);
     } else {
         $item = false;
     }
     if ($item) {
         $args->add($item);
         $menu->editargs($item, $args);
         $result .= $html->adminform($menu->editform, $args);
     }
     //table
     $perpage = 20;
     $count = $holder->count;
     $from = $menu->getfrom($perpage, $count);
     $items = $holder->select($menu->where, " order by id desc limit {$from}, {$perpage}");
     if (!$items) {
         $items = array();
     }
     $result .= $html->buildtable($items, $menu->table);
     $result = $html->fixquote($result);
     $theme = ttheme::i();
     $result .= $theme->getpages($menu->url, litepublisher::$urlmap->page, ceil($count / $perpage));
     return $result;
 }
 public function getcontent()
 {
     $result = parent::getcontent();
     $db = litepublisher::$db;
     $items = $db->res2items($db->query("select id, class from {$db->prefix}codedoc order by class"));
     if (count($items) == 0) {
         return $result;
     }
     tposts::i()->loaditems(array_keys($items));
     $theme = tview::getview($this)->theme;
     $args = new targs();
     $result .= '<ul class="doc_classes">';
     $tml = '<li id="doc-class-$id"><a href="#">$class</a> $post.excerptcontent</li>';
     foreach ($items as $id => $item) {
         $args->add($item);
         ttheme::$vars['post'] = tpost::i($id);
         $result .= $theme->parsearg($tml, $args);
     }
     $result .= '</ul>';
     return $result;
 }
 public function getcontent()
 {
     $plugin = catbread::i();
     $lang = tplugins::getnamelang('catbread');
     $html = tadminhtml::i();
     $args = new targs();
     $args->add($plugin->tml);
     $args->showhome = $plugin->showhome;
     $args->showchilds = $plugin->showchilds;
     $args->showsimilar = $plugin->showsimilar;
     $lang->addsearch('sortnametags');
     $sort = array('title' => $lang->title, 'itemscount' => $lang->count, 'customorder' => $lang->customorder);
     $args->sort = tadminhtml::array2combo($sort, $plugin->childsortname);
     $pos = array('top' => $lang->top, 'before' => $lang->before, 'after' => $lang->after);
     $args->breadpos = tadminhtml::array2combo($pos, $plugin->breadpos);
     $args->similarpos = tadminhtml::array2combo($pos, $plugin->similarpos);
     $args->formtitle = $lang->formtitle;
     return $html->adminform('
 [checkbox=showhome]
 
 [combo=breadpos]
 [text=item]
 [text=active]
 [text=child]
 [editor=items]
 [editor=container]
 
 [checkbox=showchilds]
 [combo=sort]
 [text=childitem]
 [text=childsubitems]
 [editor=childitems]
 
 [checkbox=showsimilar]
 [combo=similarpos]
 [text=similaritem]
 [text=similaritems]
 ', $args);
 }
 public function getcontent()
 {
     $result = $this->getpluginsmenu();
     $html = $this->html;
     $plugins = tplugins::i();
     if (empty($_GET['plugin'])) {
         $result .= $html->formhead();
         $args = new targs();
         $lang = $this->lang;
         list($head, $tml) = $html->tablestruct(array(array('center', ' ', '<input type="checkbox" name="$name" id="$name" $checked />'), array('left', $lang->name, '$short'), array('right', $lang->version, '$version'), array('left', $lang->author, '<a target="_blank" href="$url">$author</a>'), array('left', $lang->description, '$description')));
         $body = '';
         foreach ($this->names as $name) {
             if (in_array($name, $plugins->deprecated)) {
                 continue;
             }
             $about = tplugins::getabout($name);
             $args->add($about);
             $args->name = $name;
             $args->checked = isset($plugins->items[$name]);
             $args->short = $about['name'];
             $body .= $html->parsearg($tml, $args);
         }
         $args->tablehead = $head;
         $args->tablebody = $body;
         //$table = $html->parsearg($html->ini['common']['table'], $args);
         $args->formtitle = $lang->formhead;
         $result .= $html->adminform($html->ini['common']['table'], $args);
         $result = $html->fixquote($result);
     } else {
         $name = $_GET['plugin'];
         if (!in_array($name, $this->names)) {
             return $this->notfound;
         }
         if ($admin = $this->getadminplugin($name)) {
             $result .= $admin->getcontent();
         }
     }
     return $result;
 }
 public function getcontent()
 {
     $result = '';
     $users = tusers::i();
     $html = $this->gethtml('users');
     $lang = tlocal::admin('users');
     $args = new targs();
     if (!($id = $this->getiduser())) {
         if (litepublisher::$options->ingroup('admin')) {
             return $this->getuserlist();
         }
         return $this->notfound;
     }
     $pages = tuserpages::i();
     $item = tusers::i()->getitem($id) + $pages->getitem($id);
     if (!isset($item['url'])) {
         $item['url'] = $item['idurl'] ? litepublisher::$urlmap->getidurl($item['idurl']) : '';
     }
     $args->add($item);
     $args->formtitle = sprintf('<a href="$site.url%s">%s</a>', $item['url'], $item['name']);
     $tabs = new tuitabs();
     $tabs->add($lang->title, '[text=name] [text=website]');
     if ('admin' == litepublisher::$options->group) {
         $tabs->add($lang->view, tadminviews::getcomboview($item['idview']));
         $tabs->add('SEO', '[text=url] [text=keywords] [text=description] [editor=head]');
     }
     $tabs->add($lang->text, '[editor=rawcontent]');
     $opt = tuseroptions::i()->getitem($id);
     $args->subscribe = $opt['subscribe'] == 'enabled';
     $args->authorpost_subscribe = $opt['authorpost_subscribe'] == 'enabled';
     $tabs->add($lang->options, '
 [checkbox=subscribe]
 [checkbox=authorpost_subscribe]
 ');
     return $html->adminform($tabs->get(), $args);
 }
Esempio n. 11
0
 public function getcontent()
 {
     $result = '';
     $istags = $this->name == 'tags' || $this->name == 'addtag';
     $tags = $istags ? litepublisher::$classes->tags : litepublisher::$classes->categories;
     if (dbversion) {
         $tags->loadall();
     }
     $parents = array(0 => '-----');
     foreach ($tags->items as $id => $item) {
         $parents[$id] = $item['title'];
     }
     $this->basename = 'tags';
     $html = $this->html;
     $lang = tlocal::i('tags');
     $id = $this->idget();
     $args = new targs();
     $args->id = $id;
     $args->adminurl = $this->adminurl;
     $ajax = tadminhtml::getadminlink('/admin/ajaxtageditor.htm', sprintf('id=%d&type=%s&get', $id, $istags ? 'tags' : 'categories'));
     $args->ajax = $ajax;
     if (isset($_GET['action']) && $_GET['action'] == 'delete' && $tags->itemexists($id)) {
         if ($this->confirmed) {
             $tags->delete($id);
             $result .= $html->h4->successdeleted;
         } else {
             return $html->confirmdelete($id, $this->adminurl, $lang->confirmdelete);
         }
     }
     $result .= $html->h4(tadminhtml::getlink('/admin/posts/' . ($istags ? 'addtag' : 'addcat') . '/', $lang->add));
     $item = false;
     if ($id && $tags->itemexists($id)) {
         $item = $tags->getitem($id);
         $args->formtitle = $lang->edit;
     } elseif ($this->name == 'addcat' || $this->name == 'addtag') {
         $id = 0;
         $item = array('id' => 0, 'title' => '', 'parent' => 0, 'customorder' => 0);
         $args->formtitle = $lang->add;
     }
     if ($item) {
         $args->add($item);
         $args->parent = tadminhtml::array2combo($parents, $item['parent']);
         $args->order = tadminhtml::array2combo(array_combine(range(0, 9), range(1, 10)), $item['customorder']);
         $tabs = new tuitabs();
         $tabs->add($lang->title, '
   [text=title]
   [combo=parent]
   [combo=order]
   [hidden=id]' . $html->p->ordernote);
         $tabs->ajax($lang->text, "{$ajax}=text");
         $tabs->ajax($lang->view, "{$ajax}=view");
         $tabs->ajax('SEO', "{$ajax}=seo");
         $form = new adminform($args);
         $result .= $html->adminform($tabs->get(), $args) . tuitabs::gethead();
     }
     //table
     $perpage = 20;
     $count = $tags->count;
     $from = $this->getfrom($perpage, $count);
     if ($tags->dbversion) {
         $iditems = $tags->db->idselect("id > 0 order by parent asc, title asc limit {$from}, {$perpage}");
     } else {
         $iditems = array_slice(array_keys($tags->items), $from, $perpage);
     }
     $items = array();
     foreach ($iditems as $id) {
         $item = $tags->items[$id];
         $item['parentname'] = $parents[$item['parent']];
         $items[] = $item;
     }
     $result .= $html->buildtable($items, array(array('right', $lang->count2, '$itemscount'), array('left', $lang->title, '<a href="$link" title="$title">$title</a>'), array('left', $lang->parent, '$parentname'), array('center', $lang->edit, "<a href=\"{$this->adminurl}=\$id\">{$lang->edit}</a>"), array('center', $lang->delete, "<a class=\"confirm-delete-link\" href=\"{$this->adminurl}=\$id&action=delete\">{$lang->delete}</a>")));
     $result = $html->fixquote($result);
     $theme = ttheme::i();
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($count / $perpage));
     return $result;
 }
 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&amp;action=add'>{$lang->addtemplate}</a>");
     $result .= $html->h4->alltemplates;
     $args->adminurl = $adminurl;
     $table = '';
     $tr = '<tr>
 <td><a href="$adminurl=$id&amp;action=edit">$name</a></td>
 <td><a href="$adminurl=$id&amp;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 restore($email)
 {
     $lang = tlocal::admin('password');
     $email = strtolower(trim($email));
     if (empty($email)) {
         return $this->error($lang->error);
     }
     $id = $this->getiduser($email);
     if (!$id) {
         return $this->error($lang->error);
     }
     $args = new targs();
     tsession::start('password-restore-' . md5(litepublisher::$options->hash($email)));
     if (!isset($_SESSION['count'])) {
         $_SESSION['count'] = 1;
     } else {
         if ($_SESSION['count']++ > 3) {
             return $this->error($lang->outofcount);
         }
     }
     $_SESSION['email'] = $email;
     $password = md5uniq();
     $_SESSION['password'] = $password;
     $_SESSION['confirm'] = md5rand();
     $args->confirm = $_SESSION['confirm'];
     session_write_close();
     $args->email = urlencode($email);
     if ($id == 1) {
         $name = litepublisher::$site->author;
     } else {
         $item = tusers::i()->getitem($id);
         $args->add($item);
         $name = $item['name'];
     }
     $args->password = $password;
     tlocal::usefile('mail');
     $lang = tlocal::i('mailpassword');
     $theme = ttheme::i();
     $subject = $theme->parsearg($lang->subject, $args);
     $body = $theme->parsearg($lang->body, $args);
     tmailer::sendmail(litepublisher::$site->name, litepublisher::$options->fromemail, $name, $email, $subject, $body);
     return true;
 }
Esempio n. 14
0
 public function items2table($owner, array $items, array $struct)
 {
     $head = '';
     $body = '';
     $tml = '<tr>';
     foreach ($struct as $elem) {
         $head .= sprintf('<th align="%s">%s</th>', $elem[0], $elem[1]);
         $tml .= sprintf('<td align="%s">%s</td>', $elem[0], $elem[2]);
     }
     $tml .= '</tr>';
     $theme = ttheme::i();
     $args = new targs();
     foreach ($items as $id) {
         $item = $owner->getitem($id);
         $args->add($item);
         $args->id = $id;
         $body .= $theme->parsearg($tml, $args);
     }
     $args->tablehead = $head;
     $args->tablebody = $body;
     return $theme->parsearg($this->ini['common']['table'], $args);
 }
Esempio n. 15
0
 public function getcontent()
 {
     $result = parent::getcontent();
     $widget = $this->widget;
     $html = $this->html;
     $args = new targs();
     $id = isset($_GET['idlink']) ? (int) $_GET['idlink'] : 0;
     if (isset($widget->items[$id])) {
         $item = $widget->items[$id];
         $args->mode = 'edit';
     } else {
         $args->mode = 'add';
         $item = array('url' => '', 'linktitle' => '', 'text' => '');
     }
     $args->add($item);
     $args->linktitle = isset($item['title']) ? $item['title'] : (isset($item['linktitle']) ? $item['linktitle'] : '');
     $lang = tlocal::i();
     $args->formtitle = $lang->editlink;
     $result .= $html->adminform('
 [text=url]
 [text=text]
 [text=linktitle]
 [hidden=mode]', $args);
     $adminurl = $this->adminurl . $_GET['idwidget'] . '&idlink';
     $args->table = $html->buildtable($widget->items, array($html->get_table_checkbox('checklink'), array('left', $lang->url, '<a href=\'$url\'>$url</a>'), array('left', $lang->anchor, '$text'), array('left', $lang->description, '$title'), array('center', $lang->edit, "<a href='{$adminurl}=\$id'>{$lang->edit}</a>")));
     $result .= $html->deletetable($args);
     return $result;
 }
Esempio n. 16
0
 public function getcontent()
 {
     $result = '';
     $files = tfiles::i();
     $html = $this->html;
     $lang = $this->lang;
     $args = new targs();
     if (!isset($_GET['action'])) {
         $args->add(array('uploadmode' => 'file', 'downloadurl' => '', 'title' => '', 'description' => '', 'keywords' => ''));
         $form = new adminform($args);
         $form->upload = true;
         $form->title = "<a id='files-source' href='#'>{$lang->switchlink}</a>";
         $form->items = '[upload=filename]
   [hidden=uploadmode]
   [text=downloadurl]
   [text=title]
   [text=description]
   [text=keywords]
   [checkbox=overwrite]';
         if (litepublisher::$options->show_file_perm) {
             $form->items .= tadminperms::getcombo(0, 'idperm');
         }
         $result .= $form->get();
     } else {
         $id = $this->idget();
         if (!$files->itemexists($id)) {
             return $this->notfound;
         }
         switch ($_GET['action']) {
             case 'delete':
                 if ($this->confirmed) {
                     if ('author' == litepublisher::$options->group && ($r = tauthor_rights::i()->candeletefile($id))) {
                         return $r;
                     }
                     $files->delete($id);
                     $result .= $html->h2->deleted;
                 } else {
                     $item = $files->getitem($id);
                     $args->add($item);
                     $args->id = $id;
                     $args->adminurl = $this->adminurl;
                     $args->action = 'delete';
                     $args->confirm = sprintf($this->lang->confirm, $item['filename']);
                     return $html->confirmform($args);
                 }
                 break;
             case 'edit':
                 $item = $files->getitem($id);
                 $args->add($item);
                 $args->title = tcontentfilter::unescape($item['title']);
                 $args->description = tcontentfilter::unescape($item['description']);
                 $args->keywords = tcontentfilter::unescape($item['keywords']);
                 $args->formtitle = $this->lang->editfile;
                 $result .= $html->adminform('[text=title] [text=description] [text=keywords]' . (litepublisher::$options->show_file_perm ? tadminperms::getcombo($item['idperm'], 'idperm') : ''), $args);
                 break;
         }
     }
     $perpage = 20;
     $type = $this->name == 'files' ? '' : $this->name;
     $sql = 'parent =0';
     $sql .= litepublisher::$options->user <= 1 ? '' : ' and author = ' . litepublisher::$options->user;
     $sql .= $type == '' ? " and media<> 'icon'" : " and media = '{$type}'";
     $count = $files->db->getcount($sql);
     $from = $this->getfrom($perpage, $count);
     $list = $files->select($sql, " order by posted desc limit {$from}, {$perpage}");
     if (!$list) {
         $list = array();
     }
     $result .= sprintf($html->h4->countfiles, $count, $from, $from + count($list));
     $args->adminurl = $this->adminurl;
     $result .= $html->buildtable($files->items, array(array('right', 'ID', '$id'), array('right', $lang->filename, '<a href="$site.files/files/$filename">$filename</a>'), array('left', $lang->title, $type != 'icon' ? '$title' : '<img src="$site.files/files/$filename" alt="$filename" />'), array('center', $lang->edit, "<a href=\"{$this->adminurl}=\$id&action=edit\">{$lang->edit}</a>"), array('center', $lang->thumbnail, '<a href="' . tadminhtml::getadminlink('/admin/files/thumbnail/', 'id=') . "\$id\" target=\"_blank\">{$lang->thumbnail}</a>"), array('center', $lang->delete, "<a href=\"{$this->adminurl}=\$id&action=delete\">{$lang->delete}</a>")));
     $theme = ttheme::i();
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($count / $perpage));
     return $result;
 }
Esempio n. 17
0
 public function getlist(array $list, array $tml)
 {
     if (count($list) == 0) {
         return '';
     }
     $this->onlist($list);
     $result = '';
     $this->preload($list);
     //sort by media type
     $items = array();
     foreach ($list as $id) {
         if (!isset($this->items[$id])) {
             continue;
         }
         $item = $this->items[$id];
         $type = $item['media'];
         if (isset($tml[$type])) {
             $items[$type][] = $id;
         } else {
             $items['file'][] = $id;
         }
     }
     $theme = ttheme::i();
     $args = new targs();
     $args->count = count($list);
     $url = litepublisher::$site->files . '/files/';
     $preview = new tarray2prop();
     ttheme::$vars['preview'] = $preview;
     $index = 0;
     foreach ($items as $type => $subitems) {
         $args->subcount = count($subitems);
         $sublist = '';
         foreach ($subitems as $typeindex => $id) {
             $item = $this->items[$id];
             $args->add($item);
             $args->link = $url . $item['filename'];
             $args->id = $id;
             $args->typeindex = $typeindex;
             $args->index = $index++;
             $args->preview = '';
             $preview->array = array();
             if ($item['preview'] > 0) {
                 $preview->array = $this->getitem($item['preview']);
             } elseif ($type == 'image') {
                 $preview->array = $item;
                 $preview->id = $id;
             } elseif ($type == 'video') {
                 $preview->link = litepublisher::$site->url . $this->videoplayer;
                 $args->preview = $theme->parsearg($types['preview'], $args);
                 $preview->array = array();
             }
             if (count($preview->array)) {
                 $preview->link = $url . $preview->filename;
                 $args->preview = $theme->parsearg($tml['preview'], $args);
             }
             unset($item['title'], $item['keywords'], $item['description']);
             $args->json = jsonattr($item);
             $sublist .= $theme->parsearg($tml[$type], $args);
         }
         $args->__set($type, $sublist);
         $result .= $theme->parsearg($tml[$type . 's'], $args);
     }
     unset(ttheme::$vars['preview'], $preview);
     $args->files = $result;
     return $theme->parsearg($tml['all'], $args);
 }
Esempio n. 18
0
 public function getsimilar($list)
 {
     if (!$this->showsimilar || !count($list)) {
         return '';
     }
     $cats = $this->cats;
     $cats->loadall();
     $parents = array();
     foreach ($list as $id) {
         $parents[] = $cats->getvalue($id, 'parent');
     }
     array_clean($parents);
     if (!count($parents)) {
         return '';
     }
     /* without db cant sort
        $similar = array();
        foreach ($cats->items as $id => $item) {
          if (in_array($item['parent'], $parents)) $similar[] = $id;
        }
        */
     $parents = implode(',', $parents);
     $list = implode(',', $list);
     $similar = $cats->db->idselect("parent in ({$parents}) and id not in ({$list}) order by {$this->childsortname} asc");
     array_clean($similar);
     if (!count($similar)) {
         return '';
     }
     $theme = ttheme::i();
     $args = new targs();
     $items = '';
     foreach ($similar as $id) {
         $args->add($cats->getitem($id));
         $items .= $theme->parsearg($this->tml['similaritem'], $args);
     }
     $args->item = $items;
     return $theme->parsearg($this->tml['similaritems'], $args);
 }
Esempio n. 19
0
 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);
 }
 public function getcont()
 {
     $html = tadminhtml::i();
     $lang = tlocal::i('perms');
     $args = new targs();
     $args->add($this->perm->data);
     $args->formtitle = $lang->editperm;
     $form = '[text=name] [hidden=id]';
     $form .= $this->getform($args);
     return $html->adminform($form, $args);
 }
Esempio n. 21
0
 protected function get_taglinks($name, $excerpt)
 {
     $items = $this->__get($name);
     if (!count($items)) {
         return '';
     }
     $theme = $this->theme;
     $tmlpath = $excerpt ? 'content.excerpts.excerpt' : 'content.post';
     $tmlpath .= $name == 'tags' ? '.taglinks' : '.catlinks';
     $tmlitem = $theme->templates[$tmlpath . '.item'];
     $tags = strbegin($name, 'tag') ? $this->factory->tags : $this->factory->categories;
     $tags->loaditems($items);
     $args = new targs();
     $list = array();
     foreach ($items as $id) {
         $item = $tags->getitem($id);
         $args->add($item);
         if ($item['icon'] == 0 || litepublisher::$options->icondisabled) {
             $args->icon = '';
         } else {
             $files = $this->factory->files;
             if ($files->itemexists($item['icon'])) {
                 $args->icon = $files->geticon($item['icon']);
             } else {
                 $args->icon = '';
             }
         }
         $list[] = $theme->parsearg($tmlitem, $args);
     }
     $args->items = ' ' . implode($theme->templates[$tmlpath . '.divider'], $list);
     $result = $theme->parsearg($theme->templates[$tmlpath], $args);
     $this->factory->posts->callevent('ontags', array($tags, $excerpt, &$result));
     return $result;
 }
Esempio n. 22
0
 private function getsubmenu(&$tree, $current, $bootstrap)
 {
     $result = '';
     $theme = ttheme::i();
     $tml_item = $theme->templates['menu.item'];
     $tml_submenu = $theme->templates['menu.item.submenu'];
     $tml_single = $theme->templates['menu.single'];
     $tml_current = $theme->templates['menu.current'];
     $args = new targs();
     foreach ($tree as $id => $items) {
         if ($this->exclude($id)) {
             continue;
         }
         $args->add($this->items[$id]);
         $submenu = '';
         if (count($items)) {
             if ($bootstrap) {
                 $args->submenu = '';
                 $submenu = $theme->parsearg($tml_single, $args);
             }
             $submenu .= $this->getsubmenu($items, $current, $bootstrap);
             $submenu = str_replace('$items', $submenu, $tml_submenu);
         }
         $this->callevent('onsubitems', array($id, &$submenu));
         $args->submenu = $submenu;
         $tml = $current == $id ? $tml_current : ($submenu ? $tml_item : $tml_single);
         $result .= $theme->parsearg($tml, $args);
     }
     return $result;
 }