/** * content chooser, loaded via AJAX */ function action($item) { $list = Page::getPages(true); echo "<input type='text' style='width:98%;' placeholder='" . L("Search") . "' onkeyup='pe.wyswyg.search(this,this.nextSibling);'>"; echo "<div class='wyswyg_content wyswyg_scroll'>\n"; foreach ($list as $content) { echo "<a href='/" . ($content['id'] == "index" ? "" : $content['id']) . "'>" . $content['name'] . "</a>\n"; } die("</div>"); }
/** * default action */ function action($item) { //! page history enabled? $this->revert = Core::lib("CMS")->revert; //! delete a page with all versions if (!empty($_REQUEST['pagedel'])) { Page::delete($_REQUEST['pagedel']); unset($_SESSION['cms_url']); Http::redirect(); } //! publicate a page if (isset($_REQUEST['publish']) && $this->revert) { $this->ispublish = true; $publish = array_keys(Core::req2arr('publish')); if (!empty($publish)) { Page::publish($publish); Http::redirect("cms/pages"); } } //! load languages $this->langs[''] = "*"; foreach (!empty($_SESSION['pe_ls']) ? $_SESSION['pe_ls'] : ['en' => 1] as $l => $v) { $this->langs[$l] = $l . " " . L($l); } //! unlock old pages for this user if any Page::unLock(Core::$user->id); //! get list of pages $pages = Page::getPages(intval(@$_REQUEST['order'])); $needcleanup = false; foreach ($pages as $p) { if ($this->ispublish && ($p['publishid'] != 0 || $p['ownerid'] != 0)) { continue; } if ($this->revert && $p['publishid'] == 0) { $this->needpublish = true; } if (!$this->revert && $p['versions'] > 1) { $needcleanup = true; } $this->pages[empty($_REQUEST['order']) ? 0 : (empty($p['template']) ? $p['tid'] : $p['template'])][] = $p; } //! this is required once after page history turned off if ($needcleanup) { Page::cleanUp($pages); } }
function edit() { $t = !empty($this->args[0]) ? $this->args[0] : []; if (is_string($t)) { if ($t[0] == '{' || $t[0] == '[') { $t = json_decode($t, true); } else { $t = explode(",", $t); } } if (!is_array($t)) { $t = []; } $this->args[0] = 0; $this->args[1] = 0; $this->args[2] = 'lang,tid:template'; $this->args[3] = "<img src='images/lang_%lang%.png' alt='%lang%' style=''> %name%"; $this->args[4] = L("Edit Page List"); $this->attrs[0] = Page::getPages(0, $t); $this->attrs[1] = "setsel_boxw"; return parent::edit(); }