/** * Display the content * @see PluginPanel::displayContent() */ protected function displayContent() { echo $this->getStyle(); echo '<div id="schuhe">'; // TODO: Use data from shoe factory $inuse = true; $schuhe = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'shoe` WHERE accountid = ' . SessionAccountHandler::getId() . ' ORDER BY `inuse` DESC, `km` DESC')->fetchAll(); foreach ($schuhe as $schuh) { $Shoe = new Shoe($schuh); if ($inuse && $Shoe->isInUse() == 0) { echo '<div id="hiddenschuhe" style="display:none;">'; $inuse = false; } echo '<p style="position:relative;"> <span class="right">' . $Shoe->getKmString() . '</span> <strong>' . ShoeFactory::getSearchLink($schuh['id']) . '</strong> ' . $this->getShoeUsageImage($Shoe->getKm()) . ' </p>'; } if (empty($schuhe)) { echo HTML::em(__('You don\'t have any shoes')); } if (!$inuse) { echo '</div>'; } echo '</div>'; if (!$inuse) { echo Ajax::toggle('<a class="right" href="#schuhe" name="schuhe">' . __('Show unused shoes') . '</a>', 'hiddenschuhe'); } echo HTML::clearBreak(); }
/** * Display after insert */ public function displayAfterInsert() { if ($this->EditorRequested) { $MultiEditor = new MultiEditor($this->InsertedIDs); $MultiEditor->display(); } else { echo HTML::em(__('The activities have been successfully imported.')); echo Ajax::closeOverlay(); } }
/** * Display the content * @see PluginStat::displayContent() */ protected function displayContent() { if (!$this->dataIsMissing) { $this->displayImages(); } else { echo HTML::em(__('No data available.')); } if ($this->Configuration()->value('show_extreme_times')) { $this->displayTable(); } }
function __date($dbi, $time) { $args =& $this->args; $page_for_date = $args['prefix'] . strftime($args['date_format'], $time); $t = localtime($time, 1); $td = HTML::td(array('align' => 'center')); $mday = $t['tm_mday']; if ($mday == $this->_today) { $mday = HTML::strong($mday); $td->setAttr('class', 'cal-today'); } else { if ($dbi->isWikiPage($page_for_date)) { $this->_links[] = $page_for_date; $td->setAttr('class', 'cal-day'); } } if ($dbi->isWikiPage($page_for_date)) { $this->_links[] = $page_for_date; $date = HTML::a(array('class' => 'cal-day', 'href' => WikiURL($page_for_date), 'title' => $page_for_date), HTML::em($mday)); } else { $date = HTML::a(array('class' => 'cal-hide', 'rel' => 'nofollow', 'href' => WikiURL($page_for_date, array('action' => 'edit')), 'title' => sprintf(_("Edit %s"), $page_for_date)), $mday); } $td->pushContent(HTML::raw(' '), $date, HTML::raw(' ')); return $td; }
/** * @param \Runalyze\Model\EquipmentType\Object $EquipmentType * @param boolean $inuse */ protected function showListFor(Model\EquipmentType\Object $EquipmentType, &$inuse) { $max = 0; $showDistance = $EquipmentType->hasMaxDistance(); $hasMaxDuration = $showDistance || $EquipmentType->hasMaxDuration(); $allEquipment = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'equipment` WHERE `typeid`="' . $EquipmentType->id() . '" AND `accountid`="' . SessionAccountHandler::getId() . '" ORDER BY ISNULL(`date_end`) DESC, `distance` DESC')->fetchAll(); foreach ($allEquipment as $data) { $Object = new Model\Equipment\Object($data); $Distance = new Distance($Object->totalDistance()); $Duration = new Duration($Object->duration()); if ($inuse && !$Object->isInUse()) { echo '<div id="hiddenequipment" style="display:none;">'; $inuse = false; } if ($max == 0) { $max = $Object->duration(); } echo '<p style="position:relative;"> <span class="right">' . ($showDistance ? $Distance->string() : $Duration->string()) . '</span> <strong>' . SearchLink::to('equipmentid', $Object->id(), $Object->name()) . '</strong> ' . $this->getUsageImage($showDistance ? $Object->totalDistance() / $EquipmentType->maxDistance() : $Object->duration() / ($hasMaxDuration ? $EquipmentType->maxDuration() : $max)) . ' </p>'; } if (empty($allEquipment)) { echo HTML::em(__('You don\'t have any equipment')); } if (!$inuse) { echo '</div>'; } }
/** * Display most visited cities */ private function displayCities() { echo '<table style="width:25%;" class="right zebra-style">'; echo '<thead><tr><th colspan="2">' . __('Most frequent places') . '</th></tr></thead>'; echo '<tbody>'; $i = 1; if (empty($this->Cities)) { echo HTML::emptyTD(2, HTML::em(__('There are no routes.'))); } foreach ($this->Cities as $city => $num) { $i++; echo '<tr class="a' . ($i % 2 + 1) . '"> <td>' . $num . 'x</td> <td>' . SearchLink::to('route', $city, $city, 'like') . '</td> </tr>'; if ($i == 11) { break; } } echo '</tbody>'; echo '</table>'; }
function SavePage(&$request, &$pageinfo, $source, $filename) { static $overwite_all = false; $pagedata = $pageinfo['pagedata']; // Page level meta-data. $versiondata = $pageinfo['versiondata']; // Revision level meta-data. if (empty($pageinfo['pagename'])) { PrintXML(HTML::dt(HTML::strong(_("Empty pagename!")))); return; } if (empty($versiondata['author_id'])) { $versiondata['author_id'] = $versiondata['author']; } $pagename = $pageinfo['pagename']; $content = $pageinfo['content']; if ($pagename == _("InterWikiMap")) { $content = _tryinsertInterWikiMap($content); } $dbi =& $request->_dbi; $page = $dbi->getPage($pagename); // Try to merge if updated pgsrc contents are different. This // whole thing is hackish // // TODO: try merge unless: // if (current contents = default contents && pgsrc_version >= // pgsrc_version) then just upgrade this pgsrc $needs_merge = false; $merging = false; // $overwrite = true; $overwrite = true; if ($request->getArg('merge')) { $merging = true; } else { if ($request->getArg('overwrite')) { $overwrite = true; } } $current = $page->getCurrentRevision(); if ($current and !$current->hasDefaultContents() && $current->getPackedContent() != $content && $merging == true) { include_once 'lib/editpage.php'; $request->setArg('pagename', $pagename); $r = $current->getVersion(); $request->setArg('revision', $current->getVersion()); $p = new LoadFileConflictPageEditor($request); $p->_content = $content; $p->_currentVersion = $r - 1; $p->editPage($saveFailed = true); return; //early return } foreach ($pagedata as $key => $value) { if (!empty($value)) { $page->set($key, $value); } } $mesg = HTML::dd(); $skip = false; if ($source) { $mesg->pushContent(' ', fmt("from %s", $source)); } if (!$current) { //FIXME: This should not happen! (empty vdata, corrupt cache or db) $current = $page->getCurrentRevision(); } if ($current->getVersion() == 0) { $mesg->pushContent(' - ', _("New page")); $isnew = true; } else { if (!$current->hasDefaultContents() && $current->getPackedContent() != $content) { if ($overwrite) { $mesg->pushContent(' ', fmt("has edit conflicts - overwriting anyway")); $skip = false; if (substr_count($source, 'pgsrc')) { $versiondata['author'] = _("The PhpWiki programming team"); // but leave authorid as userid who loaded the file } } else { $mesg->pushContent(' ', fmt("has edit conflicts - skipped")); $needs_merge = true; // hackish $skip = true; } } else { if ($current->getPackedContent() == $content && $current->get('author') == $versiondata['author']) { // The page metadata is already changed, we don't need a new revision. // This was called previously "is identical to current version %d - skipped" // which is wrong, since the pagedata was stored, not skipped. $mesg->pushContent(' ', fmt("content is identical to current version %d - no new revision created", $current->getVersion())); $skip = true; } } $isnew = false; } if (!$skip) { // in case of failures print the culprit: if (!isa($request, 'MockRequest')) { PrintXML(HTML::dt(WikiLink($pagename))); flush(); } $new = $page->save($content, WIKIDB_FORCE_CREATE, $versiondata); $dbi->touch(); $mesg->pushContent(' ', fmt("- saved to database as version %d", $new->getVersion())); } if ($needs_merge) { $f = $source; // hackish, $source contains needed path+filename $f = str_replace(sprintf(_("MIME file %s"), ''), '', $f); $f = str_replace(sprintf(_("Serialized file %s"), ''), '', $f); $f = str_replace(sprintf(_("plain file %s"), ''), '', $f); //check if uploaded file? they pass just the content, but the file is gone if (@stat($f)) { global $WikiTheme; $meb = Button(array('action' => 'loadfile', 'merge' => true, 'source' => $f), _("Merge Edit"), _("PhpWikiAdministration"), 'wikiadmin'); $owb = Button(array('action' => 'loadfile', 'overwrite' => true, 'source' => $f), _("Restore Anyway"), _("PhpWikiAdministration"), 'wikiunsafe'); $mesg->pushContent(' ', $meb, " ", $owb); if (!$overwite_all) { $args = $request->getArgs(); $args['overwrite'] = 1; $owb = Button($args, _("Overwrite All"), _("PhpWikiAdministration"), 'wikiunsafe'); $mesg->pushContent(HTML::div(array('class' => 'hint'), $owb)); $overwite_all = true; } } else { $mesg->pushContent(HTML::em(_(" Sorry, cannot merge."))); } } if (!isa($request, 'MockRequest')) { if ($skip) { PrintXML(HTML::dt(HTML::em(WikiLink($pagename))), $mesg); } else { PrintXML($mesg); } flush(); } }
function getFormElements() { global $WikiTheme; $request =& $this->request; $page =& $this->page; $h = array('action' => 'edit', 'pagename' => $page->getName(), 'version' => $this->version, 'edit[pagetype]' => $this->meta['pagetype'], 'edit[current_version]' => $this->_currentVersion); $el['HIDDEN_INPUTS'] = HiddenInputs($h); $el['EDIT_TEXTAREA'] = $this->getTextArea(); if (ENABLE_CAPTCHA) { $el = array_merge($el, $this->Captcha->getFormElements()); } $el['SUMMARY_INPUT'] = HTML::input(array('type' => 'text', 'class' => 'wikitext', 'id' => 'edit[summary]', 'name' => 'edit[summary]', 'size' => 50, 'maxlength' => 256, 'value' => $this->meta['summary'])); $el['MINOR_EDIT_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[minor_edit]', 'id' => 'edit[minor_edit]', 'checked' => (bool) $this->meta['is_minor_edit'])); $el['OLD_MARKUP_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[markup]', 'value' => 'old', 'checked' => $this->meta['markup'] < 2.0, 'id' => 'useOldMarkup', 'onclick' => 'showOldMarkupRules(this.checked)')); $el['OLD_MARKUP_CONVERT'] = $this->meta['markup'] < 2.0 ? Button('submit:edit[edit_convert]', _("Convert"), 'wikiaction') : ''; $el['LOCKED_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[locked]', 'id' => 'edit[locked]', 'disabled' => (bool) (!$this->user->isadmin()), 'checked' => (bool) $this->locked)); $el['PREVIEW_B'] = Button('submit:edit[preview]', _("Preview"), 'wikiaction'); //if (!$this->isConcurrentUpdate() && $this->canEdit()) $el['SAVE_B'] = Button('submit:edit[save]', _("Save"), 'wikiaction'); $el['IS_CURRENT'] = $this->version == $this->current->getVersion(); $el['WIDTH_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editWidth]', 'id' => 'pref[editWidth]', 'value' => $request->getPref('editWidth'), 'onchange' => 'this.form.submit();')); $el['HEIGHT_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editHeight]', 'id' => 'pref[editHeight]', 'value' => $request->getPref('editHeight'), 'onchange' => 'this.form.submit();')); $el['SEP'] = $WikiTheme->getButtonSeparator(); $el['AUTHOR_MESSAGE'] = fmt("Author will be logged as %s.", HTML::em($this->user->getId())); return $el; }
function _showvalue($key, $val, $prefix = '') { if (is_array($val) or is_object($val)) { return $val; } if (in_array($key, $this->hidden_pagemeta)) { return ''; } if ($prefix) { $fullkey = $prefix . '[' . $key . ']'; if (substr($fullkey, 0, 1) == '[') { $meta = "meta" . $fullkey; $fullkey = preg_replace("/\\]\\[/", "[", substr($fullkey, 1), 1); } else { $meta = preg_replace("/^([^\\[]+)\\[/", "meta[\$1][", $fullkey, 1); } } else { $fullkey = $key; $meta = "meta[" . $key . "]"; } //$meta = "meta[".$fullkey."]"; $arr = array('name' => $meta, 'value' => $val); if (strlen($val) > 20) { $arr['size'] = strlen($val); } if (in_array($key, $this->readonly_pagemeta)) { $arr['readonly'] = 'readonly'; return HTML::input($arr); } else { return HTML(HTML::em($fullkey), HTML::br(), HTML::input($arr)); } }
function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); extract($args); if (!$file) { return $this->error(sprintf(_("A required argument '%s' is missing."), 'file')); } if (!$display) { return $this->error(sprintf(_("A required argument '%s' is missing."), 'display')); } if (string_starts_with($file, "Upload:")) { $file = preg_replace("/^Upload:(.*)\$/", getUploadFilePath() . "\\1", $file); $is_Upload = 1; } $dir = getcwd(); if (defined('PHPWIKI_DIR')) { chdir(PHPWIKI_DIR); } if (!file_exists($file)) { if ($quiet) { return HTML::raw(''); } else { return $this->error(sprintf(_("File '%s' not found."), $file)); } } // sanify $file name $realfile = realpath($file); // Hmm, allow ADMIN to check a local file? Only if its locked if (string_starts_with($realfile, realpath(getUploadDataPath()))) { $isuploaded = 1; } else { $page = $dbi->getPage($basepage); $user = $request->getUser(); if ($page->getOwner() != ADMIN_USER or !$page->get('locked')) { // For convenience we warn the admin if ($quiet and $user->isAdmin()) { return HTML::span(array('title' => _("Output suppressed. FileInfoPlugin with local files require a locked page.")), HTML::em(_("page not locked"))); } else { return $this->error("Invalid path \"{$file}\". Only ADMIN can allow local paths, and the page must be locked."); } } } $s = array(); $modes = explode(",", $display); foreach ($modes as $mode) { switch ($mode) { case 'version': $s[] = $this->exeversion($file); break; case 'size': $s[] = filesize($file); break; case 'phonysize': $s[] = $this->phonysize(filesize($file)); break; case 'date': $s[] = strftime("%x %X", filemtime($file)); break; case 'mtime': $s[] = filemtime($file); break; case 'owner': $o = posix_getpwuid(fileowner($file)); $s[] = $o['name']; break; case 'group': $o = posix_getgrgid(filegroup($file)); $s[] = $o['name']; break; case 'name': $s[] = basename($file); break; case 'path': $s[] = $file; break; case 'dirname': $s[] = dirname($file); break; case 'magic': $s[] = $this->magic($file); break; case 'mime-typ': $s[] = $this->mime_type($file); break; case 'link': if ($is_Upload) { $s[] = " [" . $args['file'] . "]"; } elseif ($isuploaded) { // will fail with user uploads $s[] = " [Upload:" . basename($file) . "]"; } else { $s[] = " [" . basename($file) . "] "; } break; default: if (!$quiet) { return $this->error(sprintf(_("Unsupported argument: %s=%s"), 'display', $mode)); } else { return HTML::raw(''); } break; } } chdir($dir); if (!$format) { $format = ''; foreach ($s as $x) { $format .= " %s"; } } array_unshift($s, $format); // $x, array($i,$j) => sprintf($x, $i, $j) $result = call_user_func_array("sprintf", $s); if (in_array('link', $modes)) { require_once "lib/InlineParser.php"; return TransformInline($result, 2, $basepage); } else { return HTML::raw($result); } }
function MacOSX_PH_revision_formatter(&$fmt, &$rev) { $class = 'rc-' . $fmt->importance($rev); return HTML::li(array('class' => $class), $fmt->diffLink($rev), ' ', $fmt->pageLink($rev), ' ', $rev->get('is_minor_edit') ? $fmt->time($rev) : HTML::strong($fmt->time($rev)), ' . . . ', $fmt->summaryAsHTML($rev), ' -- ', $fmt->authorLink($rev), $rev->get('is_minor_edit') ? HTML::em(" (" . _("minor edit") . ")") : ''); }
function getFormElements() { global $WikiTheme; $request =& $this->request; $page =& $this->page; $h = array('action' => 'edit', 'pagename' => $page->getName(), 'version' => $this->version, 'edit[pagetype]' => $this->meta['pagetype'], 'edit[current_version]' => $this->_currentVersion); $el['HIDDEN_INPUTS'] = HiddenInputs($h); $el['EDIT_TEXTAREA'] = $this->getTextArea(); if (ENABLE_CAPTCHA) { $el = array_merge($el, $this->Captcha->getFormElements()); } $el['SUMMARY_INPUT'] = HTML::input(array('type' => 'text', 'class' => 'wikitext', 'id' => 'edit-summary', 'name' => 'edit[summary]', 'size' => 50, 'maxlength' => 256, 'value' => $this->meta['summary'])); $el['MINOR_EDIT_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[minor_edit]', 'id' => 'edit-minor_edit', 'checked' => (bool) $this->meta['is_minor_edit'])); $el['OLD_MARKUP_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[markup]', 'value' => 'old', 'checked' => $this->meta['markup'] < 2.0, 'id' => 'useOldMarkup', 'onclick' => 'showOldMarkupRules(this.checked)')); $el['OLD_MARKUP_CONVERT'] = $this->meta['markup'] < 2.0 ? Button('submit:edit[edit_convert]', _("Convert"), 'wikiaction') : ''; $el['LOCKED_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[locked]', 'id' => 'edit-locked', 'disabled' => (bool) (!$this->user->isAdmin()), 'checked' => (bool) $this->locked)); if (ENABLE_PAGE_PUBLIC) { $el['PUBLIC_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[public]', 'id' => 'edit-public', 'disabled' => (bool) (!$this->user->isAdmin()), 'checked' => (bool) $this->page->get('public'))); } if (ENABLE_EXTERNAL_PAGES) { $el['EXTERNAL_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[external]', 'id' => 'edit-external', 'disabled' => (bool) (!$this->user->isAdmin()), 'checked' => (bool) $this->page->get('external'))); } if (ENABLE_WYSIWYG) { if ($this->version == 0 and $request->getArg('mode') != 'wysiwyg') { $el['WYSIWYG_B'] = Button(array("action" => "edit", "mode" => "wysiwyg"), "Wysiwyg Editor"); } } $el['PREVIEW_B'] = Button('submit:edit[preview]', _("Preview"), 'wikiaction', array('accesskey' => 'p', 'title' => 'Preview the current content [alt-p]')); //if (!$this->isConcurrentUpdate() && $this->canEdit()) $el['SAVE_B'] = Button('submit:edit[save]', _("Save"), 'wikiaction', array('accesskey' => 's', 'title' => 'Save the current content as wikipage [alt-s]')); $el['CHANGES_B'] = Button('submit:edit[diff]', _("Changes"), 'wikiaction', array('accesskey' => 'c', 'title' => 'Preview the current changes as diff [alt-c]')); $el['UPLOAD_B'] = Button('submit:edit[upload]', _("Upload"), 'wikiaction', array('title' => 'Select a local file and press Upload to attach into this page')); $el['SPELLCHECK_B'] = Button('submit:edit[SpellCheck]', _("Spell Check"), 'wikiaction', array('title' => 'Check the spelling')); $el['IS_CURRENT'] = $this->version == $this->current->getVersion(); $el['WIDTH_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editWidth]', 'id' => 'pref-editWidth', 'value' => $request->getPref('editWidth'), 'onchange' => 'this.form.submit();')); $el['HEIGHT_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editHeight]', 'id' => 'pref-editHeight', 'value' => $request->getPref('editHeight'), 'onchange' => 'this.form.submit();')); $el['SEP'] = $WikiTheme->getButtonSeparator(); $el['AUTHOR_MESSAGE'] = fmt("Author will be logged as %s.", HTML::em($this->user->getId())); return $el; }
function run($dbi, $argstr, &$request, $basepage) { extract($this->getArgs($argstr, $request)); // allow plugin-form if (!empty($s)) { $page = $s; } if (!$page) { return ''; } if (!$dbi->isWikiPage($page)) { return fmt("Page %s not found.", WikiLink($page, 'unknown')); } $p = $dbi->getPage($page); include_once "lib/loadsave.php"; $mailified = MailifyPage($p, $format == 'backup' ? 99 : 1); // fixup_headers massages the page dump headers depending on // the 'format' argument, 'normal'(default) or 'forcvs'. // // Normal: Don't add X-Rcs-Id, add unique Message-Id, don't // strip any fields from Content-Type. // // ForCVS: Add empty X-Rcs-Id, strip attributes from // Content-Type field: "author", "version", "lastmodified", // "author_id", "hits". $this->pagename = $page; $this->generateMessageId($mailified); if ($format == 'forcvs') { $this->fixup_headers_forcvs($mailified); } else { // backup or normal $this->fixup_headers($mailified); } if ($download) { // TODO: we need a way to hook into the generated headers, to override // Content-Type, Set-Cookie, Cache-control, ... $request->discardOutput(); // Hijack the http request from PhpWiki. ob_end_clean(); // clean up after hijacking $request //ob_end_flush(); //debugging Header("Content-disposition: attachment; filename=\"" . FilenameForPage($page) . "\""); // Read charset from generated page itself. // Inconsequential at the moment, since loadsave.php // always generates headers $charset = $p->get('charset'); if (!$charset) { $charset = $GLOBALS['charset']; } // We generate 3 Content-Type headers! first in loadsave, // then here and the mimified string $mailified also has it! Header("Content-Type: text/plain; name=\"" . FilenameForPage($page) . "\"; charset=\"" . $charset . "\""); $request->checkValidators(); // let $request provide last modifed & etag Header("Content-Id: <" . $this->MessageId . ">"); // be nice to http keepalive~s // FIXME: he length is wrong BTW. must strip the header. Header("Content-Length: " . strlen($mailified)); // Here comes our prepared mime file echo $mailified; exit; // noreturn! php exits. return; } // We are displaing inline preview in a WikiPage, so wrap the // text if it is too long--unless quoted-printable (TODO). $mailified = safe_wordwrap($mailified, 70); $dlcvs = Button(array('action' => $this->getName(), 'format' => 'forcvs', 'download' => true), _("Download for CVS"), $page); $dl = Button(array('action' => $this->getName(), 'download' => true), _("Download for backup"), $page); $dlall = Button(array('action' => $this->getName(), 'format' => 'backup', 'download' => true), _("Download all revisions for backup"), $page); $h2 = HTML::h2(fmt("Preview: Page dump of %s", WikiLink($page, 'auto'))); global $WikiTheme; if (!($Sep = $WikiTheme->getButtonSeparator())) { $Sep = " "; } if ($format == 'forcvs') { $desc = _("(formatted for PhpWiki developers as pgsrc template, not for backing up)"); $altpreviewbuttons = HTML(Button(array('action' => $this->getName()), _("Preview as normal format"), $page), $Sep, Button(array('action' => $this->getName(), 'format' => 'backup'), _("Preview as backup format"), $page)); } elseif ($format == 'backup') { $desc = _("(formatted for backing up: all revisions)"); // all revisions $altpreviewbuttons = HTML(Button(array('action' => $this->getName(), 'format' => 'forcvs'), _("Preview as developer format"), $page), $Sep, Button(array('action' => $this->getName(), 'format' => ''), _("Preview as normal format"), $page)); } else { $desc = _("(normal formatting: latest revision only)"); $altpreviewbuttons = HTML(Button(array('action' => $this->getName(), 'format' => 'forcvs'), _("Preview as developer format"), $page), $Sep, Button(array('action' => $this->getName(), 'format' => 'backup'), _("Preview as backup format"), $page)); } $warning = HTML(_("Please use one of the downloadable versions rather than copying and pasting from the above preview.") . " " . _("The wordwrap of the preview doesn't take nested markup or list indentation into consideration!") . " ", HTML::em(_("PhpWiki developers should manually inspect the downloaded file for nested markup before rewrapping with emacs and checking into CVS."))); return HTML($h2, HTML::em($desc), HTML::pre($mailified), $altpreviewbuttons, HTML::div(array('class' => 'errors'), HTML::strong(_("Warning:")), " ", $warning), $dl, $Sep, $dlall, $Sep, $dlcvs); }
function _work($pagename, $args, $dbi, &$request) { if (empty($args['s'])) { if ($request->isPost()) { if ($pagename != _("AppendText")) { return HTML($request->redirect(WikiURL($pagename, false, 'absurl'), false)); } } return ''; } $page = $dbi->getPage($pagename); $message = HTML(); if (!$page->exists()) { // We might want to create it? $message->pushContent(sprintf(_("Page could not be updated. %s doesn't exist!\n"), $pagename)); return $message; } $current = $page->getCurrentRevision(); $oldtext = $current->getPackedContent(); $text = $args['s']; // If a "before" or "after" is specified but not found, we simply append text to the end. if (!empty($args['before'])) { $before = preg_quote($args['before'], "/"); // Insert before $newtext = preg_match("/\n{$before}/", $oldtext) ? preg_replace("/(\n{$before})/", "\n" . preg_quote($text, "/") . "\\1", $oldtext) : $this->_fallback($text, $oldtext, $args['before'], $message); } elseif (!empty($args['after'])) { // Insert after $after = preg_quote($args['after'], "/"); $newtext = preg_match("/\n{$after}/", $oldtext) ? preg_replace("/(\n{$after})/", "\\1\n" . preg_quote($text, "/"), $oldtext) : $this->_fallback($text, $oldtext, $args['after'], $message); } else { // Append at the end $newtext = $oldtext . "\n" . $text; } require_once "lib/loadsave.php"; $meta = $current->_data; $meta['summary'] = sprintf(_("AppendText to %s"), $pagename); if ($page->save($newtext, $current->getVersion() + 1, $meta)) { $message->pushContent(_("Page successfully updated."), HTML::br()); } // AppendText has been called from the same page that got modified // so we directly show the page. if ($request->getArg($pagename) == $pagename) { // TODO: Just invalidate the cache, if AppendText didn't // change anything before. // return $request->redirect(WikiURL($pagename, false, 'absurl'), false); // The user asked to be redirected to the modified page } elseif ($args['redirect']) { return $request->redirect(WikiURL($pagename, false, 'absurl'), false); } else { $link = HTML::em(WikiLink($pagename)); $message->pushContent(HTML::Raw(sprintf(_("Go to %s."), $link->asXml()))); } return $message; }
function run($dbi, $argstr, &$request, $basepage) { // no action=replace support yet if ($request->getArg('action') != 'browse') { return $this->disabled("(action != 'browse')"); } $args = $this->getArgs($argstr, $request); $this->_args = $args; //TODO: support p from <!plugin-list !> $this->preSelectS($args, $request); $p = $request->getArg('p'); if (!$p) { $p = $this->_list; } $post_args = $request->getArg('admin_replace'); $next_action = 'select'; $pages = array(); if ($p && !$request->isPost()) { $pages = $p; } if ($p && $request->isPost() && empty($post_args['cancel'])) { // without individual PagePermissions: if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } if ($post_args['action'] == 'verify' and !empty($post_args['from'])) { // Real action return $this->searchReplacePages($dbi, $request, array_keys($p), $post_args['from'], $post_args['to']); } if ($post_args['action'] == 'select') { if (!empty($post_args['from'])) { $next_action = 'verify'; } foreach ($p as $name => $c) { $pages[$name] = 1; } } } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. //TODO: check for permissions and list only the allowed $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,hi_content"; } $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array_merge($args, array('types' => array('hi_content' => new _PageList_Column_content('rev:hi_content', _("Content")))))); $pagelist->addPageList($pages); $header = HTML::p(); if (empty($post_args['from'])) { $header->pushContent(HTML::p(HTML::em(_("Warning: The search string cannot be empty!")))); } if ($next_action == 'verify') { $button_label = _("Yes"); $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently search & replace text in the selected files?")))); $this->replaceForm($header, $post_args); } else { $button_label = _("Search & Replace"); $this->replaceForm($header, $post_args); $header->pushContent(HTML::p(_("Select the pages to search:"))); } $buttons = HTML::p(Button('submit:admin_replace[rename]', $button_label, 'wikiadmin'), Button('submit:admin_replace[cancel]', _("Cancel"), 'button')); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_replace')), HiddenInputs(array('admin_replace[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons); }
/** * HomePage was not found so first-time install is supposed to run. * - import all pgsrc pages. * - Todo: installer interface to edit config/config.ini settings * - Todo: ask for existing old index.php to convert to config/config.ini * - Todo: theme-specific pages: * blog - HomePage, ADMIN_USER/Blogs */ function SetupWiki(&$request) { global $GenericPages, $LANG; //FIXME: This is a hack (err, "interim solution") // This is a bogo-bogo-login: Login without // saving login information in session state. // This avoids logging in the unsuspecting // visitor as ADMIN_USER // // This really needs to be cleaned up... // (I'm working on it.) $real_user = $request->_user; if (ENABLE_USER_NEW) { $request->_user = new _BogoUser(ADMIN_USER); } else { $request->_user = new WikiUser($request, ADMIN_USER, WIKIAUTH_BOGO); } StartLoadDump($request, _("Loading up virgin wiki")); $pgsrc = FindLocalizedFile(WIKI_PGSRC); $default_pgsrc = FindFile(DEFAULT_WIKI_PGSRC); $request->setArg('overwrite', true); if ($default_pgsrc != $pgsrc) { LoadAny($request, $default_pgsrc, $GenericPages); } $request->setArg('overwrite', false); LoadAny($request, $pgsrc); $dbi =& $request->_dbi; // Ensure that all mandatory pages are loaded $finder = new FileFinder(); if (!FUSIONFORGE) { $mandatory = explode(':', 'SandBox:Template/Category:Template/Talk:SpecialPages:CategoryCategory:CategoryActionPage:Help/OldTextFormattingRules:Help/TextFormattingRules:PhpWikiAdministration'); } else { if (WIKI_NAME == "help") { $mandatory = explode(':', 'SandBox:Template/Category:Template/Talk:SpecialPages:CategoryCategory:CategoryActionPage:Help/TextFormattingRules:PhpWikiAdministration'); } else { $mandatory = explode(':', 'SandBox:Template/UserPage:Template/Category:Template/Talk:SpecialPages:CategoryCategory:CategoryActionPage:TextFormattingRules:PhpWikiAdministration'); } } foreach (array_merge($mandatory, $GLOBALS['AllActionPages'], array(constant('HOME_PAGE'))) as $f) { $page = gettext($f); $epage = urlencode($page); if (!$dbi->isWikiPage($page)) { // translated version provided? if ($lf = FindLocalizedFile($pgsrc . $finder->_pathsep . $epage, 1)) { LoadAny($request, $lf); } else { // load english version of required action page LoadAny($request, FindFile(DEFAULT_WIKI_PGSRC . $finder->_pathsep . urlencode($f))); $page = $f; } } if (!$dbi->isWikiPage($page)) { trigger_error(sprintf("Mandatory file %s couldn't be loaded!", $page), E_USER_WARNING); } } $pagename = _("InterWikiMap"); $map = $dbi->getPage($pagename); $map->set('locked', true); PrintXML(HTML::p(HTML::em(WikiLink($pagename)), HTML::strong(" locked"))); EndLoadDump($request); }
function asEditableTable($type) { global $WikiTheme; if (!isset($this->_group)) { $this->_group =& $GLOBALS['request']->getGroup(); } $table = HTML::table(); $table->pushContent(HTML::tr(HTML::th(array('align' => 'left'), _("Access")), HTML::th(array('align' => 'right'), _("Group/User")), HTML::th(_("Grant")), HTML::th(_("Del/+")), HTML::th(_("Description")))); $allGroups = $this->_group->_specialGroups(); foreach ($this->_group->getAllGroupsIn() as $group) { if (!in_array($group, $this->_group->specialGroups())) { $allGroups[] = $group; } } //array_unique(array_merge($this->_group->getAllGroupsIn(), $deletesrc = $WikiTheme->_findData('images/delete.png'); $addsrc = $WikiTheme->_findData('images/add.png'); $nbsp = HTML::raw(' '); foreach ($this->perm as $access => $groups) { //$permlist = HTML::table(array('class' => 'cal','valign' => 'top')); $first_only = true; $newperm = HTML::input(array('type' => 'checkbox', 'name' => "acl[_new_perm][{$access}]", 'value' => 1)); $addbutton = HTML::input(array('type' => 'checkbox', 'name' => "acl[_add_group][{$access}]", 'title' => _("Add this ACL"), 'value' => 1)); $newgroup = HTML::select(array('name' => "acl[_new_group][{$access}]", 'style' => 'text-align: right;', 'size' => 1)); foreach ($allGroups as $groupname) { if (!isset($groups[$groupname])) { $newgroup->pushContent(HTML::option(array('value' => $groupname), $this->groupName($groupname))); } } if (empty($groups)) { $addbutton->setAttr('checked', 'checked'); $newperm->setAttr('checked', 'checked'); $table->pushContent(HTML::tr(array('valign' => 'top'), HTML::td(HTML::strong($access . ":")), HTML::td($newgroup), HTML::td($nbsp, $newperm), HTML::td($nbsp, $addbutton), HTML::td(HTML::em(getAccessDescription($access))))); } foreach ($groups as $group => $bool) { $checkbox = HTML::input(array('type' => 'checkbox', 'name' => "acl[{$access}][{$group}]", 'title' => _("Allow / Deny"), 'value' => 1)); if ($bool) { $checkbox->setAttr('checked', 'checked'); } $checkbox = HTML(HTML::input(array('type' => 'hidden', 'name' => "acl[{$access}][{$group}]", 'value' => 0)), $checkbox); $deletebutton = HTML::input(array('type' => 'checkbox', 'name' => "acl[_del_group][{$access}][{$group}]", 'style' => 'background: #aaa url(' . $deletesrc . ')', 'title' => _("Delete this ACL"), 'value' => 1)); if ($first_only) { $table->pushContent(HTML::tr(HTML::td(HTML::strong($access . ":")), HTML::td(array('class' => 'cal-today', 'align' => 'right'), HTML::strong($this->groupName($group))), HTML::td(array('align' => 'center'), $nbsp, $checkbox), HTML::td(array('align' => 'right', 'style' => 'background: #aaa url(' . $deletesrc . ') no-repeat'), $deletebutton), HTML::td(HTML::em(getAccessDescription($access))))); $first_only = false; } else { $table->pushContent(HTML::tr(HTML::td(), HTML::td(array('class' => 'cal-today', 'align' => 'right'), HTML::strong($this->groupName($group))), HTML::td(array('align' => 'center'), $nbsp, $checkbox), HTML::td(array('align' => 'right', 'style' => 'background: #aaa url(' . $deletesrc . ') no-repeat'), $deletebutton), HTML::td())); } } if (!empty($groups)) { $table->pushContent(HTML::tr(array('valign' => 'top'), HTML::td(array('align' => 'right'), _("add ")), HTML::td($newgroup), HTML::td(array('align' => 'center'), $nbsp, $newperm), HTML::td(array('align' => 'right', 'style' => 'background: #ccc url(' . $addsrc . ') no-repeat'), $addbutton), HTML::td(HTML::small(_("Check to add this ACL"))))); } } if ($type == 'default') { $table->setAttr('style', 'border: dotted thin black; background-color:#eee;'); } elseif ($type == 'inherited') { $table->setAttr('style', 'border: dotted thin black; background-color:#ddd;'); } elseif ($type == 'page') { $table->setAttr('style', 'border: solid thin black; font-weight: bold;'); } return $table; }
function chmodForm(&$header, $post_args) { $header->pushContent(HTML::p(HTML::em(_("This plugin is currently under development and does not work!")))); $header->pushContent(_("Chmod to permission:")); $header->pushContent(HTML::input(array('name' => 'admin_chmod[perm]', 'value' => $post_args['perm']))); $header->pushContent(' ' . _("(ugo : rwx)")); $header->pushContent(HTML::p()); $checkbox = HTML::input(array('type' => 'checkbox', 'name' => 'admin_chmod[updatechildren]', 'value' => 1)); if (!empty($post_args['updatechildren'])) { $checkbox->setAttr('checked', 'checked'); } $header->pushContent($checkbox, HTML::raw(" "), _("Propagate new permissions to all subpages?"), HTML::raw(" "), HTML::em(_("(disable individual page permissions, enable inheritance)?"))); $header->pushContent(HTML::hr(), HTML::p()); return $header; }
function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); // if (empty($args['s'])) // return ''; $html = HTML(); extract($args); // prevent from dump if ($q and $request->isPost()) { require_once "lib/Google.php"; $google = new Google(); if (!$google) { return ''; } switch ($mode) { case 'search': $result = $google->doGoogleSearch($q); break; case 'cache': $result = $google->doGetCachedPage($q); break; case 'spell': $result = $google->doSpellingSuggestion($q); break; default: trigger_error("Invalid mode"); } if (isa($result, 'HTML')) { $html->pushContent($result); } if (isa($result, 'GoogleSearchResults')) { //TODO: result template if (!empty($result->resultElements)) { $list = HTML::ol(); foreach ($result->resultElements as $res) { $li = HTML::li(LinkURL($res['URL'], $res['directoryTitle']), HTML::br(), $res['directoryTitle'] ? HTML(HTML::raw(' '), HTML::em($res['summary']), ' -- ', LinkURL($res['URL'])) : ''); $list->pushContent($li); } $html->pushContent($list); } else { return _("Nothing found"); } } if (is_string($result)) { // cache content also? $html->pushContent(HTML::blockquote(HTML::raw($result))); } } if ($formsize < 1) { $formsize = 30; } // todo: template $form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('pagename' => $basepage, 'mode' => $mode))); $form->pushContent(HTML::input(array('type' => 'text', 'value' => $q, 'name' => 'q', 'size' => $formsize))); $form->pushContent(HTML::input(array('type' => 'submit', 'class' => 'button', 'value' => gettext($mode)))); return HTML($html, $form); }
function setaclForm(&$header, $post_args, $pagehash) { $acl = $post_args['acl']; //FIXME: find intersection of all pages perms, not just from the last pagename $pages = array(); foreach ($pagehash as $name => $checked) { if ($checked) { $pages[] = $name; } } $perm_tree = pagePermissions($name); $table = pagePermissionsAclFormat($perm_tree, !empty($pages)); $header->pushContent(HTML::strong(_("Selected Pages: ")), HTML::tt(join(', ', $pages)), HTML::br()); $first_page = $GLOBALS['request']->_dbi->getPage($name); $owner = $first_page->getOwner(); list($type, $perm) = pagePermissionsAcl($perm_tree[0], $perm_tree); //if (DEBUG) $header->pushContent(HTML::pre("Permission tree for $name:\n",print_r($perm_tree,true))); if ($type == 'inherited') { $type = sprintf(_("page permission inherited from %s"), $perm_tree[1][0]); } elseif ($type == 'page') { $type = _("individual page permission"); } elseif ($type == 'default') { $type = _("default page permission"); } $header->pushContent(HTML::strong(_("Type") . ': '), HTML::tt($type), HTML::br()); $header->pushContent(HTML::strong(_("ACL") . ': '), HTML::tt($perm->asAclLines()), HTML::br()); $header->pushContent(HTML::p(HTML::strong(_("Description") . ': '), _("Selected Grant checkboxes allow access, unselected checkboxes deny access."), _("To ignore delete the line."), _("To add check 'Add' near the dropdown list."))); $header->pushContent($table); // // display array of checkboxes for existing perms // and a dropdown for user/group to add perms. // disabled if inherited, // checkbox to disable inheritance, // another checkbox to progate new permissions to all childs (if there exist some) //Todo: // warn if more pages are selected and they have different perms //$header->pushContent(HTML::input(array('name' => 'admin_setacl[acl]', // 'value' => $post_args['acl']))); $header->pushContent(HTML::br()); if (!empty($pages) and defined('EXPERIMENTAL') and EXPERIMENTAL) { $checkbox = HTML::input(array('type' => 'checkbox', 'name' => 'admin_setacl[updatechildren]', 'value' => 1)); if (!empty($post_args['updatechildren'])) { $checkbox->setAttr('checked', 'checked'); } $header->pushContent($checkbox, _("Propagate new permissions to all subpages?"), HTML::raw(" "), HTML::em(_("(disable individual page permissions, enable inheritance)?")), HTML::br(), HTML::em(_("(Currently not working)"))); } $header->pushContent(HTML::hr()); return $header; }
function run($dbi, $argstr, &$request, $basepage) { $this->_args = $this->getArgs($argstr, $request); extract($this->_args); if (!$page) { return ''; } $hidden_pagemeta = array('_cached_html'); $readonly_pagemeta = array('hits'); $dbi = $request->getDbh(); $p = $dbi->getPage($page); $pagemeta = $p->getMetaData(); // Look at arguments to see if submit was entered. If so, // process this request before displaying. // if ($request->isPost() and $request->_user->isAdmin() and $request->getArg('metaedit')) { $metafield = trim($request->getArg('metafield')); $metavalue = trim($request->getArg('metavalue')); if (!in_array($metafield, $readonly_pagemeta)) { if (preg_match('/^(.*?)\\[(.*?)\\]$/', $metafield, $matches)) { list(, $array_field, $array_key) = $matches; $array_value = $pagemeta[$array_field]; $array_value[$array_key] = $metavalue; $p->set($array_field, $array_value); } else { $p->set($metafield, $metavalue); } } $dbi->touch(); $url = $request->getURLtoSelf(false, array('metaedit', 'metafield', 'metavalue')); $request->redirect($url); // The rest of the output will not be seen due to the // redirect. } // Now we show the meta data and provide entry box for new data. $html = HTML(); $html->pushContent(fmt("Existing page-level metadata for %s:", $page)); $dl = HTML::dl(); foreach ($pagemeta as $key => $val) { if (is_string($val) and substr($val, 0, 2) == 'a:') { $dl->pushContent(HTML::dt("\n{$key} => {$val}\n", $dl1 = HTML::dl())); foreach (unserialize($val) as $akey => $aval) { $dl1->pushContent(HTML::dt(HTML::strong("{$key}" . '[' . $akey . "] => {$aval}\n"))); } $dl->pushContent($dl1); } elseif (is_array($val)) { $dl->pushContent(HTML::dt("\n{$key}:\n", $dl1 = HTML::dl())); foreach ($val as $akey => $aval) { $dl1->pushContent(HTML::dt(HTML::strong("{$key}" . '[' . $akey . "] => {$aval}\n"))); } $dl->pushContent($dl1); } elseif (in_array($key, $hidden_pagemeta)) { } elseif (in_array($key, $readonly_pagemeta)) { $dl->pushContent(HTML::dt(array('style' => 'background: #dddddd'), "{$key} => {$val}\n")); } else { $dl->pushContent(HTML::dt(HTML::strong("{$key} => {$val}\n"))); } } $html->pushContent($dl); if ($request->_user->isAdmin()) { $action = $request->getPostURL(); $hiddenfield = HiddenInputs($request->getArgs()); $instructions = _("Add or change a page-level metadata 'key=>value' pair. Note that you can remove a key by leaving the value-box empty."); $keyfield = HTML::input(array('name' => 'metafield'), ''); $valfield = HTML::input(array('name' => 'metavalue'), ''); $button = Button('submit:metaedit', _("Submit"), false); $form = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $hiddenfield, $instructions, HTML::br(), $keyfield, ' => ', $valfield, HTML::raw(' '), $button); $html->pushContent(HTML::br(), $form); } else { $html->pushContent(HTML::em(_("Requires WikiAdmin privileges to edit."))); } return $html; }
function run($dbi, $argstr, &$request, $basepage) { extract($this->getArgs($argstr, $request)); if (defined('CHARSET')) { $rss_parser = new RSSParser(CHARSET); } else { $rss_parser = new RSSParser(); } if (!empty($url)) { $rss_parser->parse_url($url, $debug); } if (!empty($rss_parser->channel['title'])) { $feed = $rss_parser->channel['title']; } if (!empty($rss_parser->channel['link'])) { $url = $rss_parser->channel['link']; } if (!empty($rss_parser->channel['description'])) { $description = $rss_parser->channel['description']; } if (!empty($feed)) { if (!empty($url)) { $titre = HTML::span(HTML::a(array('href' => $rss_parser->channel['link']), $rss_parser->channel['title'])); } else { $titre = HTML::span($rss_parser->channel['title']); } $th = HTML::div(array('class' => 'feed'), $titre); if (!empty($description)) { $th->pushContent(HTML::p(array('class' => 'chandesc'), HTML::raw($description))); } } else { $th = HTML(); } if (!empty($rss_parser->channel['date'])) { $th->pushContent(HTML::raw("<!--" . $rss_parser->channel['date'] . "-->")); } $html = HTML::div(array('class' => 'rss'), $th); if ($rss_parser->items) { // only maxitem's if ($maxitem > 0) { $rss_parser->items = array_slice($rss_parser->items, 0, $maxitem); } foreach ($rss_parser->items as $item) { $cell = HTML::div(array('class' => 'rssitem')); if ($item['link'] and empty($item['title'])) { $item['title'] = $item['link']; } $cell_title = HTML::div(array('class' => 'itemname'), HTML::a(array('href' => $item['link']), HTML::raw($item['title']))); $cell->pushContent($cell_title); $cell_author = HTML::raw($item['author']); $cell_pubDate = HTML::raw($item['pubDate']); $cell_authordate = HTML::div(array('class' => 'authordate'), $cell_author, HTML::raw(" - "), $cell_pubDate); $cell->pushContent($cell_authordate); if (!$titleonly && !empty($item['description'])) { $cell->pushContent(HTML::div(array('class' => 'itemdesc'), HTML::raw($item['description']))); } $html->pushContent($cell); } } else { $html = HTML::div(array('class' => 'rss'), HTML::em(_("no RSS items"))); } if (!check_php_version(5)) { $rss_parser->__destruct(); } return $html; }
function run($dbi, $argstr, &$request, $basepage) { global $WikiTheme; $args = $this->getArgs($argstr, $request); extract($args); if (empty($page)) { $page = $request->getArg('pagename'); } $relhtml = HTML(); if ($args['relations'] != '') { $relfilter = explode(",", $args['relations']); } else { $relfilter = array(); } if ($args['attributes'] != '') { $attfilter = explode(",", $args['attributes']); } else { $attfilter = array(); } foreach (explodePageList($page) as $pagename) { $p = $dbi->getPage($pagename); if ($args['relations'] != '0') { $links = $p->getRelations(); // iter of pagelinks // TODO: merge same relations together located_in::here, located_in::there while ($object = $links->next()) { if ($related = $object->get('linkrelation')) { // a page name if ($relfilter and !in_array($related, $relfilter)) { continue; } $rellink = WikiLink($related, false, $related); $rellink->setAttr('class', $rellink->getAttr('class') . ' relation'); $relhtml->pushContent($pagename . " ", $rellink, HTML::span(array('class' => 'relation-symbol'), "::"), WikiLink($object->_pagename), " ", $WikiTheme->makeActionButton(array('relation' => $related, 's' => $object->_pagename), '+', _("SemanticSearch")), count($relfilter) > 3 ? HTML::br() : " "); } } if (!empty($relhtml->_content) and !$noheader) { $relhtml = HTML(HTML::hr(), HTML::h3(fmt("Semantic relations for %s", $pagename)), $relhtml); } } $atthtml = HTML(); if ($args['attributes'] != '0') { if ($attributes = $p->get('attributes')) { // a hash of unique pairs foreach ($attributes as $att => $val) { if ($attfilter and !in_array($att, $attfilter)) { continue; } $rellink = WikiLink($att, false, $att); $rellink->setAttr('class', $rellink->getAttr('class') . ' relation'); $searchlink = $WikiTheme->makeActionButton(array('attribute' => $att, 's' => $val), $val, _("SemanticSearch")); $searchlink->setAttr('class', $searchlink->getAttr('class') . ' attribute'); if (!$noheader) { $atthtml->pushContent("{$pagename} "); } $atthtml->pushContent(HTML::span(array('class' => 'attribute ' . $att), $rellink, HTML::span(array('class' => 'relation-symbol'), ":="), $searchlink), count($attfilter) > 3 ? HTML::br() : " "); } if (!$noheader) { $relhtml = HTML($relhtml, HTML::hr(), HTML::h3(fmt("Attributes of %s", $pagename)), $atthtml); } else { $relhtml = HTML($relhtml, $atthtml); } } } } if ($nohelp) { return $relhtml; } return HTML($relhtml, HTML::hr(), WikiLink(_("Help/SemanticRelations"), false, HTML::em(_("Help/SemanticRelations"))), " - ", HTML::em(_("Find out how to add relations and attributes to pages."))); }