function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); extract($args); include_once "lib/imdb.php"; $imdb = new imdb(); if (method_exists($imdb, $query)) { $SqlResult = $imdb->{$query}($title ? $title : $name); } else { $SqlResult = array(); } // if ($limit) ; // TODO: fill paging vars (see PageList) if ($ordered) { $html = HTML::ol(array('class' => 'sqlresult')); foreach ($SqlResult as $row) { $html->pushContent(HTML::li(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'), $row[0])); } } else { $html = HTML::table(array('class' => 'sqlresult')); $i = 0; foreach ($SqlResult as $row) { $tr = HTML::tr(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow')); foreach ($row as $col) { $tr->pushContent(HTML::td($col)); } $html->pushContent($tr); } } // if ($limit) ; // do paging via pagelink template return $html; }
function showForm(&$dbi, &$request, $args, $allrelations) { global $WikiTheme; $action = $request->getPostURL(); $hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's')); $pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), ''); $help = Button('submit:semsearch[help]', "?", false); $svalues = empty($allrelations) ? "" : join("','", $allrelations); $reldef = JavaScript("var semsearch_relations = new Array('" . $svalues . "')"); $querybox = HTML::textarea(array('name' => 's', 'title' => _("Enter a valid query expression"), 'rows' => 4, 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'array:semsearch_relations'), $args['s']); $submit = Button('submit:semsearch[relations]', _("Search"), false, array('title' => 'Move to help page. No seperate window')); $instructions = _("Search in all specified pages for the expression."); $form = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $reldef, $hiddenfield, HiddenInputs(array('attribute' => '')), $instructions, HTML::br(), HTML::table(array('border' => '0', 'width' => '100%'), HTML::tr(HTML::td(_("Pagename(s): "), $pagefilter), HTML::td(array('align' => 'right'), $help)), HTML::tr(HTML::td(array('colspan' => 2), $querybox))), HTML::br(), HTML::div(array('align' => 'center'), $submit)); return $form; }
function run($dbi, $argstr, &$request, $basepage) { extract($this->getArgs($argstr, $request)); $h = HTML(); $this->_generatePageheader($info, $h); if (!REQUIRE_ADMIN || $request->_user->isadmin()) { $h->pushContent(HTML::h2(_("Plugins"))); $table = HTML::table(array('class' => "pagelist")); $this->_generateColheadings($info, $table); $this->_generateTableBody($info, $dbi, $request, $table); $h->pushContent($table); } else { $h->pushContent(fmt("You must be an administrator to %s.", _("use this plugin"))); } return $h; }
function run($dbi, $argstr, &$request, $basepage) { if (!ACCESS_LOG) { return; } $args = $this->getArgs($argstr, $request); $table = HTML::table(array('cellpadding' => 1, 'cellspacing' => 2, 'border' => 0, 'class' => 'pagelist')); if (!$args['noheader'] and !empty($args['caption'])) { $table->pushContent(HTML::caption(array('align' => 'top'), $args['caption'])); } $logs = array(); $limit = $args['limit']; $accesslog =& $request->_accesslog; if ($logiter = $accesslog->get_referer($limit, "external_only") and $logiter->count()) { $table->pushContent(HTML::tr(HTML::th("Target"), HTML::th("Referrer"), HTML::th("Host"), HTML::th("Date"))); while ($logentry = $logiter->next()) { $table->pushContent(HTML::tr(HTML::td($logentry['request']), HTML::td($logentry['referer']), HTML::td($logentry['host']), HTML::td($logentry['time']))); } return $table; } }
function run($dbi, $argstr, &$request, $basepage) { $this->_args = $this->getArgs($argstr, $request); extract($this->_args); //trigger_error("1 p= $page a= $author"); if ($page && $page == 'username') { //FIXME: use [username]!!!!! $page = $author; } //trigger_error("2 p= $page a= $author"); if (!$page || !$author) { //user not signed in or no author specified return ''; } //$pagelist = new PageList($info, $exclude); /////////////////////////// $nbsp = HTML::raw(' '); global $WikiTheme; // date & time formatting if (!($page == 'all')) { $p = $dbi->getPage($page); $t = HTML::table(array('class' => 'pagelist', 'style' => 'font-size:smaller')); $th = HTML::thead(); $tb = HTML::tbody(); $th->pushContent(HTML::tr(HTML::td(array('align' => 'right'), _("Version")), $includeminor ? HTML::td(_("Minor")) : "", HTML::td(_("Author")), HTML::td(_("Summary")), HTML::td(_("Modified")))); $allrevisions_iter = $p->getAllRevisions(); while ($rev = $allrevisions_iter->next()) { $isminor = $rev->get('is_minor_edit'); $authordoesmatch = $author == $rev->get('author'); if ($authordoesmatch && (!$isminor || $includeminor && $isminor)) { $difflink = Button(array('action' => 'diff', 'previous' => 'minor'), $rev->getversion(), $rev); $tr = HTML::tr(HTML::td(array('align' => 'right'), $difflink, $nbsp), $includeminor ? HTML::td($nbsp, $isminor ? "minor" : "major", $nbsp) : "", HTML::td($nbsp, WikiLink($rev->get('author'), 'if_known'), $nbsp), HTML::td($nbsp, $rev->get('summary')), HTML::td(array('align' => 'right'), $WikiTheme->formatdatetime($rev->get('mtime')))); $class = $isminor ? 'evenrow' : 'oddrow'; $tr->setAttr('class', $class); $tb->pushContent($tr); //$pagelist->addPage($rev->getPage()); } } $captext = fmt($includeminor ? "History of all major and minor edits by %s to page %s." : "History of all major edits by %s to page %s.", WikiLink($author, 'auto'), WikiLink($page, 'auto')); $t->pushContent(HTML::caption($captext)); $t->pushContent($th, $tb); } else { //search all pages for all edits by this author ///////////////////////////////////////////////////////////// $t = HTML::table(array('class' => 'pagelist', 'style' => 'font-size:smaller')); $th = HTML::thead(); $tb = HTML::tbody(); $th->pushContent(HTML::tr(HTML::td(_("Page Name")), HTML::td(array('align' => 'right'), _("Version")), $includeminor ? HTML::td(_("Minor")) : "", HTML::td(_("Summary")), HTML::td(_("Modified")))); ///////////////////////////////////////////////////////////// $allpages_iter = $dbi->getAllPages($includedeleted); while ($p = $allpages_iter->next()) { ///////////////////////////////////////////////////////////// $allrevisions_iter = $p->getAllRevisions(); while ($rev = $allrevisions_iter->next()) { $isminor = $rev->get('is_minor_edit'); $authordoesmatch = $author == $rev->get('author'); if ($authordoesmatch && (!$isminor || $includeminor && $isminor)) { $difflink = Button(array('action' => 'diff', 'previous' => 'minor'), $rev->getversion(), $rev); $tr = HTML::tr(HTML::td($nbsp, $isminor ? $rev->_pagename : WikiLink($rev->_pagename, 'auto')), HTML::td(array('align' => 'right'), $difflink, $nbsp), $includeminor ? HTML::td($nbsp, $isminor ? "minor" : "major", $nbsp) : "", HTML::td($nbsp, $rev->get('summary')), HTML::td(array('align' => 'right'), $WikiTheme->formatdatetime($rev->get('mtime')), $nbsp)); $class = $isminor ? 'evenrow' : 'oddrow'; $tr->setAttr('class', $class); $tb->pushContent($tr); //$pagelist->addPage($rev->getPage()); } } ///////////////////////////////////////////////////////////// } $captext = fmt($includeminor ? "History of all major and minor modifications for any page edited by %s." : "History of major modifications for any page edited by %s.", WikiLink($author, 'auto')); $t->pushContent(HTML::caption($captext)); $t->pushContent($th, $tb); } // if (!$noheader) { // total minor, major edits. if include minoredits was specified // } return $t; // if (!$noheader) { // $pagelink = WikiLink($page, 'auto'); // // if ($pagelist->isEmpty()) // return HTML::p(fmt("No pages link to %s.", $pagelink)); // // if ($pagelist->getTotal() == 1) // $pagelist->setCaption(fmt("One page links to %s:", // $pagelink)); // else // $pagelist->setCaption(fmt("%s pages link to %s:", // $pagelist->getTotal(), $pagelink)); // } // // return $pagelist; }
function run($dbi, $argstr, &$request, $basepage) { global $WikiTheme; include_once 'lib/InlineParser.php'; $table = array(); $lines = preg_split('/\\s*?\\n\\s*/', $argstr); foreach ($lines as $line) { if (!$line) { continue; } $line = trim($line); // If line ends with a '|', remove it if ($line[strlen($line) - 1] == '|') { $line = substr($line, 0, -1); } if ($line[0] != '|') { // trigger_error(sprintf(_("Line %s does not begin with a '|'."), $line), E_USER_WARNING); } else { $table[] = $this->_parse_row($line, $basepage); } } $nbrows = sizeof($table); // If table is empty, do not generate table markup if ($nbrows == 0) { return HTML::raw(''); } $nbcols = sizeof($table[0]); for ($i = 0; $i < $nbrows; $i++) { for ($j = 0; $j < $nbcols; $j++) { if (preg_match('/@@/', $table[$i][$j])) { $table[$i][$j] = compute_tablecell($table, $i, $j, $nbrows, $nbcols); } } } $htmltable = HTML::table(array('class' => "bordered")); foreach ($table as $row) { $htmlrow = HTML::tr(); foreach ($row as $cell) { if ($cell && $cell[0] == '=') { $cell = trim(substr($cell, 1)); $htmlrow->pushContent(HTML::th(TransformInline($cell, 2.0, $basepage))); } else { if (is_numeric($cell)) { $htmlrow->pushContent(HTML::td(array('style' => "text-align:right"), $cell)); } else { $htmlrow->pushContent(HTML::td(TransformInline($cell, 2.0, $basepage))); } } } $htmltable->pushContent($htmlrow); } return $htmltable; }
function _arrayToTable($array, &$request) { $thead = HTML::thead(); $label[0] = _("Wiki Name"); $label[1] = _("Search"); $thead->pushContent(HTML::tr(HTML::th($label[0]), HTML::th($label[1]))); $tbody = HTML::tbody(); $dbi = $request->getDbh(); if ($array) { foreach ($array as $moniker => $interurl) { $monikertd = HTML::td(array('class' => 'interwiki-moniker'), $dbi->isWikiPage($moniker) ? WikiLink($moniker) : $moniker); $w = new WikiPluginLoader(); $p = $w->getPlugin('ExternalSearch'); $argstr = sprintf('url="%s"', addslashes($interurl)); $searchtd = HTML::td($p->run($dbi, $argstr, $request, $basepage)); $tbody->pushContent(HTML::tr($monikertd, $searchtd)); } } $table = HTML::table(); $table->setAttr('class', 'interwiki-map'); $table->pushContent($thead); $table->pushContent($tbody); return $table; }
<?php require 'script.php'; ?> <!doctype html> <html class="no-js" lang=""> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="style.css"> </head> <body> <h3>Segmented</h3> <?php echo HTML::table($originalSource['columns'], $originalSource['rows']); ?> </body> </html>
} else { $thead[] = _("Profile"); } $options = array('align' => 'center', 0 => array('align' => 'right')); $tbody = array(); for ($i = 1; $log = $logQ->fetch(); $i++) { $row = $i . '.'; $row .= OPEN_SEPARATOR; $row .= I18n::localDate($log["access_date"]); $row .= OPEN_SEPARATOR; $row .= $log["login"]; $row .= OPEN_SEPARATOR; if ($table == 'record') { $row .= $log["table_name"]; $row .= OPEN_SEPARATOR; $row .= $log["operation"]; $row .= OPEN_SEPARATOR; $row .= htmlspecialchars(var_export(unserialize($log["affected_row"]), true)); } else { $row .= $profiles[$log["id_profile"]]; } $tbody[] = explode(OPEN_SEPARATOR, $row); } // end for $logQ->freeResult(); $logQ->close(); unset($logQ); unset($log); echo HTML::rule(); echo HTML::table($thead, $tbody, null, $options); require_once "../layout/footer.php";
function _formatMap($pagetext) { $map = $this->_getMap($pagetext); if (!$map) { return HTML::p("<No interwiki map found>"); } // Shouldn't happen. $mon_attr = array('class' => 'interwiki-moniker'); $url_attr = array('class' => 'interwiki-url'); $thead = HTML::thead(HTML::tr(HTML::th($mon_attr, _("Moniker")), HTML::th($url_attr, _("InterWiki Address")))); foreach ($map as $moniker => $interurl) { $rows[] = HTML::tr(HTML::td($mon_attr, new Cached_WikiLinkIfKnown($moniker)), HTML::td($url_attr, HTML::tt($interurl))); } return HTML::table(array('class' => 'interwiki-map'), $thead, HTML::tbody(false, $rows)); }
function run($dbi, $argstr, &$request, $basepage) { extract($this->getArgs($argstr, $request)); $attributes = $attrib ? explode(",", $attrib) : array(); $photos = array(); $html = HTML(); $count = 0; // check all parameters // what type do we have? if (!$src) { $showdesc = 'none'; $src = $request->getArg('pagename'); $error = $this->fromLocation($src, $photos); } else { $error = $this->fromFile($src, $photos, $url); } if ($error) { return $this->error($error); } if ($numcols < 1) { $numcols = 1; } if ($align != 'left' && $align != 'center' && $align != 'right') { $align = 'center'; } if (count($photos) == 0) { return; } if (in_array("sort", $attributes)) { sort($photos); } if ($p) { $mode = "normal"; } if ($mode == "column") { $mode = "normal"; $numcols = "1"; } // set some fixed properties for each $mode if ($mode == 'thumbs' || $mode == 'tiles') { $attributes = array_merge($attributes, "alt"); $attributes = array_merge($attributes, "nowrap"); $cellwidth = 'auto'; // else cell won't nowrap $width = 50; } elseif ($mode == 'list') { $numcols = 1; $cellwidth = "auto"; $width = 50; } elseif ($mode == 'slide') { $tableheight = 0; $cell_width = 0; $numcols = count($photos); $keep = $photos; while (list($key, $value) = each($photos)) { list($x, $y, $s, $t) = @getimagesize($value['src']); if ($height != 'auto') { $y = $this->newSize($y, $height); } if ($width != 'auto') { $y = round($y * $this->newSize($x, $width) / $x); } if ($x > $cell_width) { $cell_width = $x; } if ($y > $tableheight) { $tableheight = $y; } } $tableheight += 50; $photos = $keep; unset($x, $y, $s, $t, $key, $value, $keep); } $row = HTML(); $duration = 1000 * $duration; if ($mode == 'slide') { $row->pushContent(JavaScript("\ni = 0;\nfunction display_slides() {\n j = i - 1;\n cell0 = document.getElementsByName('wikislide' + j);\n cell = document.getElementsByName('wikislide' + i);\n if (cell0.item(0) != null)\n cell0.item(0).style.display='none';\n if (cell.item(0) != null)\n cell.item(0).style.display='block';\n i += 1;\n if (cell.item(0) == null) i = 0;\n setTimeout('display_slides()',{$duration});\n}\ndisplay_slides();")); } while (list($key, $value) = each($photos)) { if ($p && basename($value["name"]) != "{$p}") { continue; } if ($h && basename($value["name"]) == "{$h}") { $color = $hlcolor ? $hlcolor : $bgcolor; } else { $color = $bgcolor; } // $params will be used for each <img > tag $params = array('src' => $value["name"], 'src_tile' => $value["name_tile"], 'border' => "0", 'alt' => ($value["desc"] != "" and in_array("alt", $attributes)) ? $value["desc"] : basename($value["name"])); if (!@empty($value['location'])) { $params = array_merge($params, array("location" => $value['location'])); } // check description switch ($showdesc) { case 'none': $value["desc"] = ''; break; case 'name': $value["desc"] = basename($value["name"]); break; case 'desc': break; default: // 'both' if (!$value["desc"]) { $value["desc"] = basename($value["name"]); } break; } // FIXME: get getimagesize to work with names with spaces in it. // convert $value["name"] from webpath to local path $size = @getimagesize($value["name"]); // try " " => "\\ " if (!$size and !empty($value["src"])) { $size = @getimagesize($value["src"]); if (!$size) { trigger_error("Unable to getimagesize(" . $value["name"] . ")", E_USER_NOTICE); } } $newwidth = $this->newSize($size[0], $width); if ($mode == 'thumbs' || $mode == 'tiles' || $mode == 'list') { if (!empty($size[0])) { $newheight = round(50 * $size[1] / $size[0]); } else { $newheight = ''; } if ($height == 'auto') { $height = 150; } } else { $newheight = $this->newSize($size[1], $height); } if ($width != 'auto' && $newwidth > 0) { $params = array_merge($params, array("width" => $newwidth)); } if ($height != 'auto' && $newheight > 0) { $params = array_merge($params, array("height" => $newheight)); } // cell operations $cell = array('align' => "center", 'valign' => "top", 'bgcolor' => "{$color}"); if ($cellwidth != 'auto') { if ($cellwidth == 'equal') { $newcellwidth = round(100 / $numcols) . "%"; } else { if ($cellwidth == 'image') { $newcellwidth = $newwidth; } else { $newcellwidth = $cellwidth; } } $cell = array_merge($cell, array("width" => $newcellwidth)); } if (in_array("nowrap", $attributes)) { $cell = array_merge($cell, array("nowrap" => "nowrap")); } //create url to display single larger version of image on page $url = WikiURL($request->getPage(), array("p" => basename($value["name"]))) . "#" . basename($value["name"]); $b_url = WikiURL($request->getPage(), array("h" => basename($value["name"]))) . "#" . basename($value["name"]); $url_text = $link ? HTML::a(array("href" => "{$url}"), basename($value["desc"])) : basename($value["name"]); if (!$p) { if ($mode == 'normal' || $mode == 'slide') { if (!@empty($params['location'])) { $params['src'] = $params['location']; } unset($params['location'], $params['src_tile']); $url_image = $link ? HTML::a(array("id" => basename($value["name"])), HTML::a(array("href" => "{$url}"), HTML::img($params))) : HTML::img($params); } else { $keep = $params; if (!@empty($params['src_tile'])) { $params['src'] = $params['src_tile']; } unset($params['location'], $params['src_tile']); $url_image = $link ? HTML::a(array("id" => basename($value["name"])), HTML::a(array("href" => "{$url}"), ImageTile::image_tile($params))) : HTML::img($params); $params = $keep; unset($keep); } } else { if (!@empty($params['location'])) { $params['src'] = $params['location']; } unset($params['location'], $params['src_tile']); $url_image = $link ? HTML::a(array("id" => basename($value["name"])), HTML::a(array("href" => "{$b_url}"), HTML::img($params))) : HTML::img($params); } if ($mode == 'list') { $url_text = HTML::a(array("id" => basename($value["name"])), $url_text); } // here we use different modes if ($mode == 'tiles') { $row->pushContent(HTML::td($cell, HTML::table(array("cellpadding" => 1, "border" => 0), HTML::tr(HTML::td(array("valign" => "top", "rowspan" => 2), $url_image), HTML::td(array("valign" => "top", "nowrap" => 0), HTML::span(array('class' => 'boldsmall'), $url_text), HTML::br(), HTML::span(array('class' => 'gensmall'), $size[0] . " x " . $size[1] . " pixels")))))); } elseif ($mode == 'list') { $desc = $showdesc != 'none' ? $value["desc"] : ''; $row->pushContent(HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), HTML::span(array('class' => 'boldsmall'), $url_text))); $row->pushContent(HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), HTML::span(array('class' => 'gensmall'), $size[0] . " x " . $size[1] . " pixels"))); if ($desc != '') { $row->pushContent(HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), HTML::span(array('class' => 'gensmall'), $desc))); } } elseif ($mode == 'thumbs') { $desc = $showdesc != 'none' ? HTML::p(HTML::a(array("href" => "{$url}"), $url_text)) : ''; $row->pushContent(HTML::td($cell, $url_image, HTML::span(array('class' => 'gensmall'), $desc))); } elseif ($mode == 'normal') { $desc = $showdesc != 'none' ? HTML::p($value["desc"]) : ''; $row->pushContent(HTML::td($cell, $url_image, HTML::span(array('class' => 'gensmall'), $desc))); } elseif ($mode == 'slide') { if ($newwidth == 'auto' || !$newwidth) { $newwidth = $this->newSize($size[0], $width); } if ($newwidth == 'auto' || !$newwidth) { $newwidth = $size[0]; } if ($newheight != 'auto') { $newwidth = round($size[0] * $newheight / $size[1]); } $desc = $showdesc != 'none' ? HTML::p($value["desc"]) : ''; if ($count == 0) { $cell = array('style' => 'display: block; ' . 'position: absolute; ' . 'left: 50% ; ' . 'margin-left: -' . round($newwidth / 2) . 'px;' . 'text-align: center; ' . 'vertical-align: top', 'name' => "wikislide" . $count); } else { $cell = array('style' => 'display: none; ' . 'position: absolute ;' . 'left: 50% ;' . 'margin-left: -' . round($newwidth / 2) . 'px;' . 'text-align: center; ' . 'vertical-align: top', 'name' => "wikislide" . $count); } if ($align == 'left' || $align == 'right') { if ($count == 0) { $cell = array('style' => 'display: block; ' . 'position: absolute; ' . $align . ': 50px; ' . 'vertical-align: top', 'name' => "wikislide" . $count); } else { $cell = array('style' => 'display: none; ' . 'position: absolute; ' . $align . ': 50px; ' . 'vertical-align: top', 'name' => "wikislide" . $count); } } $row->pushContent(HTML::td($cell, $url_image, HTML::span(array('class' => 'gensmall'), $desc))); $count++; } elseif ($mode == 'row') { $desc = $showdesc != 'none' ? HTML::p($value["desc"]) : ''; $row->pushContent(HTML::table(array("style" => "display: inline"), HTML::tr(HTML::td($url_image)), HTML::tr(HTML::td(array("class" => "gensmall", "style" => "text-align: center; " . "background-color: {$color}"), $desc)))); } else { return $this->error(fmt("Invalid argument: %s=%s", 'mode', $mode)); } // no more images in one row as defined by $numcols if (($key + 1) % $numcols == 0 || $key + 1 == count($photos) || $p) { if ($mode == 'row') { $html->pushcontent(HTML::span($row)); } else { $html->pushcontent(HTML::tr($row)); } $row->setContent(''); } } //create main table $table_attributes = array("border" => 0, "cellpadding" => 5, "cellspacing" => 2, "width" => $tablewidth); if (!@empty($tableheight)) { $table_attributes = array_merge($table_attributes, array("height" => $tableheight)); } if ($mode != 'row') { $html = HTML::table($table_attributes, $html); } // align all return HTML::div(array("align" => $align), $html); }
echo Msg::info(_("No medical tests defined for this medical problem.")); include_once "../layout/footer.php"; exit; } echo HTML::section(2, _("Medical Tests List:")); $thead = array(_("Function") => array('colspan' => $_SESSION['auth']['is_administrative'] ? 3 : 1), _("Document Type"), _("Path Filename")); $tbody = array(); while ($test = $testQ->fetch()) { $temp = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); $temp = substr($temp, 0, strrpos($temp, "/")) . "/tests/" . String::translateBrowser($test->getPathFilename(false)); $row = HTML::link(HTML::image('../img/action_view.png', _("view")), $temp, null, array('class' => 'popup')); $row .= OPEN_SEPARATOR; if ($_SESSION['auth']['is_administrative']) { $row .= HTML::link(HTML::image('../img/action_edit.png', _("edit")), '../medical/test_edit_form.php', array('id_problem' => $idProblem, 'id_patient' => $idPatient, 'id_test' => $test->getIdTest())); $row .= OPEN_SEPARATOR; $row .= HTML::link(HTML::image('../img/action_delete.png', _("delete")), '../medical/test_del_confirm.php', array('id_problem' => $idProblem, 'id_patient' => $idPatient, 'id_test' => $test->getIdTest())); $row .= OPEN_SEPARATOR; } // end if $row .= $test->getDocumentType(); $row .= OPEN_SEPARATOR; $row .= $test->getPathFilename(); $tbody[] = explode(OPEN_SEPARATOR, $row); } // end while $testQ->freeResult(); $testQ->close(); unset($testQ); unset($test); echo HTML::table($thead, $tbody); require_once "../layout/footer.php";
/** * Really should have a _fixupPagedata and _fixupVersiondata, but this works. * also used in plugin/EditMetaData */ function _fixupData(&$data, $prefix = '') { if (!is_array($data)) { return; } global $request; $user = $request->getUser(); foreach ($data as $key => $val) { $fullkey = $prefix . '[' . $key . ']'; if (is_integer($key)) { } elseif ($key == 'passwd' and !$user->isAdmin()) { $data[$key] = $val ? _("<not displayed>") : _("<empty>"); } elseif ($key and $key == '_cached_html') { $val = TransformedText::unpack($val); ob_start(); print_r($val); $data[$key] = HTML::pre(ob_get_contents()); ob_end_clean(); } elseif (is_bool($val)) { $data[$key] = $this->_showvalue($key, $val ? "true" : "false", $prefix); } elseif (is_string($val) && (substr($val, 0, 2) == 'a:' or substr($val, 0, 2) == 'O:')) { // how to indent this table? $val = unserialize($val); $this->_fixupData($val, $fullkey); $data[$key] = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0), $this->_showhash(false, $val, $fullkey)); } elseif (is_array($val)) { // how to indent this table? $this->_fixupData($val, $fullkey); $data[$key] = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0), $this->_showhash(false, $val, $fullkey)); } elseif (is_object($val)) { // how to indent this table? ob_start(); print_r($val); $val = HTML::pre(ob_get_contents()); ob_end_clean(); $data[$key] = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0), $this->_showhash(false, $val, $fullkey)); } elseif ($key and $key == '%content') { if ($val === true) { $val = '<true>'; } elseif (strlen($val) > 40) { $val = substr($val, 0, 40) . " ..."; } $data[$key] = $val; } } unset($data['%pagedata']); // problem in backend }
function run($dbi, $argstr, &$request, $basepage) { // When 'phpweather/phpweather.php' is not installed then // PHPWEATHER_BASE_DIR will be undefined. if (!defined('PHPWEATHER_BASE_DIR')) { return $this->error(_("You have to define PHPWEATHER_BASE_DIR before use. (config/config.ini)")); } //early return require_once PHPWEATHER_BASE_DIR . '/output/pw_images.php'; require_once PHPWEATHER_BASE_DIR . '/pw_utilities.php'; extract($this->getArgs($argstr, $request)); $html = HTML(); $w = new phpweather(); // Our weather object if (!empty($icao)) { /* We assign the ICAO to the weather object: */ $w->set_icao($icao); if (!$w->get_country_code()) { /* The country code couldn't be resolved, so we * shouldn't use the ICAO: */ trigger_error(sprintf(_("The ICAO '%s' wasn't recognized."), $icao), E_USER_NOTICE); $icao = ''; } } if (!empty($icao)) { /* We check and correct the language if necessary: */ //if (!in_array($language, array_keys($w->get_languages('text')))) { if (!in_array($language, array_keys(get_languages('text')))) { trigger_error(sprintf(_("%s does not know about the language '%s', using 'en' instead."), $this->getName(), $language), E_USER_NOTICE); $language = 'en'; } $class = "pw_text_{$language}"; require_once PHPWEATHER_BASE_DIR . "/output/{$class}.php"; $t = new $class($w); $t->set_pref_units($units); $i = new pw_images($w); $i_temp = HTML::img(array('src' => $i->get_temp_image())); $i_wind = HTML::img(array('src' => $i->get_winddir_image())); $i_sky = HTML::img(array('src' => $i->get_sky_image())); $m = $t->print_pretty(); $m_td = HTML::td(HTML::p(new RawXml($m))); $i_tr = HTML::tr(); $i_tr->pushContent(HTML::td($i_temp)); $i_tr->pushContent(HTML::td($i_wind)); $i_table = HTML::table($i_tr); $i_table->pushContent(HTML::tr(HTML::td(array('colspan' => '2'), $i_sky))); $tr = HTML::tr(); $tr->pushContent($m_td); $tr->pushContent(HTML::td($i_table)); $html->pushContent(HTML::table($tr)); } /* We make a menu if asked to, or if $icao is empty: */ if ($menu || empty($icao)) { $form_arg = array('action' => $request->getURLtoSelf(), 'method' => 'get'); /* The country box is always part of the menu: */ $p1 = HTML::p(new RawXml(get_countries_select($w, $cc))); /* We want to save the language: */ $p1->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'language', 'value' => $language))); /* And also the ICAO: */ $p1->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'icao', 'value' => $icao))); $caption = empty($cc) ? _("Submit country") : _("Change country"); $p1->pushContent(HTML::input(array('type' => 'submit', 'value' => $caption))); $html->pushContent(HTML::form($form_arg, $p1)); if (!empty($cc)) { /* We have selected a country, now display a list with * the available stations in that country: */ $p2 = HTML::p(); /* We need the country code after the form is submitted: */ $p2->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'cc', 'value' => $cc))); $p2->pushContent(new RawXml(get_stations_select($w, $cc, $icao))); $p2->pushContent(new RawXml(get_languages_select($language))); $p2->pushContent(HTML::input(array('type' => 'submit', 'value' => _("Submit location")))); $html->pushContent(HTML::form($form_arg, $p2)); } } return $html; }
function run($dbi, $argstr, &$request, $basepage) { global $WikiTheme; $args = $this->getArgs($argstr, $request); extract($args); if ($since) { $since = strtotime($since); } if ($month) { $since = strtotime($month); $since = mktime(0, 0, 0, date("m", $since), 1, date("Y", $since)); $until = mktime(23, 59, 59, date("m", $since) + 1, 0, date("Y", $since)); } else { $until = 0; } $iter = $dbi->getAllPages(false, '-mtime'); $pages = array(); while ($page = $iter->next()) { $pagename = $page->getName(); if (!$page->exists()) { continue; } $rev = $page->getRevision(1, false); $date = $rev->get('mtime'); //$author = $rev->get('author_id'); $author = $page->getOwner(); if (defined('DEBUG') && DEBUG && $debug) { echo "<i>{$pagename}, ", strftime("%Y-%m-%d %h:%m:%s", $date), ", {$author}</i><br />\n"; } if ($userid and !preg_match("/" . $userid . "/", $author)) { continue; } if ($since and $date < $since) { continue; } if ($until and $date > $until) { continue; } if (!$comments and preg_match("/\\/Comment/", $pagename)) { continue; } $monthnum = strftime("%Y%m", $date); if (!isset($pages[$monthnum])) { $pages[$monthnum] = array('author' => array(), 'month' => strftime("%B, %Y", $date)); } if (!isset($pages[$monthnum]['author'][$author])) { $pages[$monthnum]['author'][$author] = array('count' => 0, 'pages' => array()); } $pages[$monthnum]['author'][$author]['count']++; $pages[$monthnum]['author'][$author]['pages'][] = $pagename; } $iter->free(); $html = HTML::table(HTML::col(array('span' => 2, 'align' => 'left'))); $nbsp = HTML::raw(' '); krsort($pages); foreach ($pages as $monthname => $parr) { $html->pushContent(HTML::tr(HTML::td(array('colspan' => 2), HTML::strong($parr['month'])))); uasort($parr['author'], 'cmp_by_count'); foreach ($parr['author'] as $user => $authorarr) { $count = $authorarr['count']; $id = preg_replace("/ /", "_", 'pages-' . $monthname . '-' . $user); $html->pushContent(HTML::tr(HTML::td($nbsp, $nbsp, HTML::img(array('id' => "{$id}-img", 'src' => $WikiTheme->_findData("images/folderArrowClosed.png"), 'onclick' => "showHideFolder('{$id}')", 'alt' => _("Click to hide/show"), 'title' => _("Click to hide/show"))), $nbsp, $user), HTML::td($count))); if ($links) { $pagelist = HTML(); foreach ($authorarr['pages'] as $p) { $pagelist->pushContent(WikiLink($p), ', '); } } else { $pagelist = join(', ', $authorarr['pages']); } $html->pushContent(HTML::tr(array('id' => $id . '-body', 'style' => 'display:none; background-color: #eee;'), HTML::td(array('colspan' => 2, 'style' => 'font-size:smaller'), $pagelist))); } } return $html; }
function _upgrade_db_init(&$dbh) { global $request, $DBParams, $DBAuthParams; if (!in_array($DBParams['dbtype'], array('SQL', 'ADODB', 'PDO'))) { return; } if (DBADMIN_USER) { // if need to connect as the root user, for CREATE and ALTER privileges $AdminParams = $DBParams; if ($DBParams['dbtype'] == 'SQL') { $dsn = DB::parseDSN($AdminParams['dsn']); } else { // ADODB or PDO $dsn = parseDSN($AdminParams['dsn']); } $AdminParams['dsn'] = sprintf("%s://%s:%s@%s/%s", $dsn['phptype'], DBADMIN_USER, DBADMIN_PASSWD, $dsn['hostspec'], $dsn['database']); if (DEBUG & _DEBUG_SQL and $DBParams['dbtype'] == 'PDO') { echo "<br>\nDBParams['dsn']: '", $DBParams['dsn'], "'"; echo "<br>\ndsn: '", print_r($dsn), "'"; echo "<br>\nAdminParams['dsn']: '", $AdminParams['dsn'], "'"; } $dbh = WikiDB::open($AdminParams); } elseif ($dbadmin = $request->getArg('dbadmin')) { if (empty($dbadmin['user']) or isset($dbadmin['cancel'])) { $dbh =& $request->_dbi; } else { $AdminParams = $DBParams; if ($DBParams['dbtype'] == 'SQL') { $dsn = DB::parseDSN($AdminParams['dsn']); } else { $dsn = parseDSN($AdminParams['dsn']); } $AdminParams['dsn'] = sprintf("%s://%s:%s@%s/%s", $dsn['phptype'], $dbadmin['user'], $dbadmin['passwd'], $dsn['hostspec'], $dsn['database']); $dbh = WikiDB::open($AdminParams); } } else { // Check if the privileges are enough. Need CREATE and ALTER perms. // And on windows: SELECT FROM mysql, possibly: UPDATE mysql. $form = HTML::form(array("method" => "post", "action" => $request->getPostURL(), "accept-charset" => $GLOBALS['charset']), HTML::p(_("Upgrade requires database privileges to CREATE and ALTER the phpwiki database."), HTML::br(), _("And on windows at least the privilege to SELECT FROM mysql, and possibly UPDATE mysql")), HiddenInputs(array('action' => 'upgrade')), HTML::table(array("cellspacing" => 4), HTML::tr(HTML::td(array('align' => 'right'), _("DB admin user:"******"dbadmin[user]", 'size' => 12, 'maxlength' => 256, 'value' => 'root')))), HTML::tr(HTML::td(array('align' => 'right'), _("DB admin password:"******"dbadmin[passwd]", 'type' => 'password', 'size' => 12, 'maxlength' => 256)))), HTML::tr(HTML::td(array('align' => 'center', 'colspan' => 2), Button("submit:", _("Submit"), 'wikiaction'), HTML::raw(' '), Button("submit:dbadmin[cancel]", _("Cancel"), 'button'))))); $form->printXml(); echo "</div><!-- content -->\n"; echo asXML(Template("bottom")); echo "</body></html>\n"; $request->finish(); exit; } }
echo HTML::start('body', array('id' => 'top')); echo HTML::start('div', array('id' => 'wrap')); echo HTML::start('div', array('id' => 'header')); echo appLogo(); $array = array(HTML::link(_("Close Window"), '#', null, array('onclick' => 'window.close(); return false;'))); echo HTML::itemList($array, array('id' => 'shortcuts')); echo menuBar($tab); echo HTML::end('div'); // #header echo HTML::start('div', array('id' => 'main')); echo HTML::start('div', array('id' => 'content')); echo HTML::section(1, sprintf(_("This is a preview of the %s theme."), $_POST["theme_name"])); echo HTML::para(HTML::link(_("Sample Link"), '#top')); echo HTML::rule(); echo HTML::section(2, _("Subtitle Sample:")); $thead = array(_("Table Heading") => array('colspan' => 2)); $tbody = array(); $tbody[] = array(sprintf(_("Sample data row %d"), 1)); $tbody[] = array(sprintf(_("Sample data row %d"), 2)); $row = Form::label("sample_text", _("Required Field") . ":", array('class' => 'required')); $row .= OPEN_SEPARATOR; $row .= Form::text("sample_text", _("Sample Input Text"), array('size' => 50, 'readonly' => true)); $tbody[] = explode(OPEN_SEPARATOR, $row); $options = array('tfoot' => array('align' => 'center'), 'r0' => array('colspan' => 2), 'r1' => array('colspan' => 2)); $tfoot = array(Form::button("sample_button", _("Sample Button"), array('type' => 'button'))); echo HTML::table($thead, $tbody, $tfoot, $options); echo Msg::error(_("Sample Error")); echo Msg::warning(_("Sample Warning")); echo Msg::info(_("Sample Info")); echo Msg::hint(_("Sample Hint")); require_once "../layout/footer.php";
function showForm(&$dbi, &$request, $args) { global $WikiTheme; $action = $request->getPostURL(); $hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's', 'semsearch', 'relation', 'attribute')); $pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), ''); $allrelations = $dbi->listRelations(false, false, true); $svalues = empty($allrelations) ? "" : join("','", $allrelations); $reldef = JavaScript("var semsearch_relations = new Array('" . $svalues . "')"); $relation = HTML::input(array('name' => 'relation', 'value' => $args['relation'], 'title' => _("Filter by this relation. With autocompletion."), 'class' => 'dropdown', 'style' => 'width:10em', 'acdropdown' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'array:semsearch_relations'), ''); $queryrel = HTML::input(array('name' => 's', 'value' => $args['s'], 'title' => _("Filter by this link. These are pagenames. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), ''); $relsubmit = Button('submit:semsearch[relations]', _("Relations"), false); // just testing some dhtml... not yet done $enhancements = HTML(); $nbsp = HTML::raw(' '); $this_uri = $_SERVER['REQUEST_URI'] . '#'; $andbutton = new Button(_("AND"), $this_uri, 'wikiaction', array('onclick' => "addquery('rel', 'and')", 'title' => _("Add an AND query"))); $orbutton = new Button(_("OR"), $this_uri, 'wikiaction', array('onclick' => "addquery('rel', 'or')", 'title' => _("Add an OR query"))); if (DEBUG) { $enhancements = HTML::span($andbutton, $nbsp, $orbutton); } $instructions = _("Search in pages for a relation with that value (a pagename)."); $form1 = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $reldef, $hiddenfield, HiddenInputs(array('attribute' => '')), $instructions, HTML::br(), HTML::table(array('border' => 0, 'cellspacing' => 2), HTML::colgroup(array('span' => 6)), HTML::thead(HTML::tr(HTML::th('Pagefilter'), HTML::th('Relation'), HTML::th(), HTML::th('Links'), HTML::th())), HTML::tbody(HTML::tr(HTML::td($pagefilter, ": "), HTML::td($relation), HTML::td(HTML::strong(HTML::tt(' :: '))), HTML::td($queryrel), HTML::td($nbsp, $relsubmit, $nbsp, $enhancements))))); $allattrs = $dbi->listRelations(false, true, true); if (empty($allrelations) and empty($allattrs)) { // be nice to the dummy. $this->_norelations_warning = 1; } $svalues = empty($allattrs) ? "" : join("','", $allattrs); $attdef = JavaScript("var semsearch_attributes = new Array('" . $svalues . "')\n" . "var semsearch_op = new Array('" . join("','", $this->_supported_operators) . "')"); // TODO: We want some more tricks: Autofill the base unit of the selected // attribute into the s area. $attribute = HTML::input(array('name' => 'attribute', 'value' => $args['attribute'], 'title' => _("Filter by this attribute name. With autocompletion."), 'class' => 'dropdown', 'style' => 'width:10em', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_list' => 'array:semsearch_attributes'), ''); $attr_op = HTML::input(array('name' => 'attr_op', 'value' => $args['attr_op'], 'title' => _("Comparison operator. With autocompletion."), 'class' => 'dropdown', 'style' => 'width:2em', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_list' => 'array:semsearch_op'), ''); $queryatt = HTML::input(array('name' => 's', 'value' => $args['s'], 'title' => _("Filter by this numeric attribute value. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'false', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_assoc' => 'false', 'autocomplete_list' => 'plugin:SemanticSearch page=' . $args['page'] . ' attribute=^[S] attr_op==~'), ''); $andbutton = new Button(_("AND"), $this_uri, 'wikiaction', array('onclick' => "addquery('attr', 'and')", 'title' => _("Add an AND query"))); $orbutton = new Button(_("OR"), $this_uri, 'wikiaction', array('onclick' => "addquery('attr', 'or')", 'title' => _("Add an OR query"))); if (DEBUG) { $enhancements = HTML::span($andbutton, $nbsp, $orbutton); } $attsubmit = Button('submit:semsearch[attributes]', _("Attributes"), false); $instructions = HTML::span(_("Search in pages for an attribute with that numeric value."), "\n"); if (DEBUG) { $instructions->pushContent(HTML(" ", new Button(_("Advanced..."), _("SemanticSearchAdvanced")))); } $form2 = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $attdef, $hiddenfield, HiddenInputs(array('relation' => '')), $instructions, HTML::br(), HTML::table(array('border' => 0, 'cellspacing' => 2), HTML::colgroup(array('span' => 6)), HTML::thead(HTML::tr(HTML::th('Pagefilter'), HTML::th('Attribute'), HTML::th('Op'), HTML::th('Value'), HTML::th())), HTML::tbody(HTML::tr(HTML::td($pagefilter, ": "), HTML::td($attribute), HTML::td($attr_op), HTML::td($queryatt), HTML::td($nbsp, $attsubmit, $nbsp, $enhancements))))); return HTML($form1, $form2); }
function doPoll($page, $request, $answers, $readonly = false) { $question = $this->_args['question']; $answer = $this->_args['answer']; $html = HTML::table(array('cellspacing' => 2)); $init = isset($question[0]) ? 0 : 1; for ($i = $init; $i <= count($question); $i++) { if (!isset($question[$i])) { break; } $poll = $page->get('poll'); @$poll['data']['all'][$i]++; $q = $question[$i]; if (!isset($answer[$i])) { trigger_error(fmt("Missing %s for %s", "answer" . "[{$i}]", "question" . "[{$i}]"), E_USER_ERROR); } if (!$readonly) { $page->set('poll', $poll); } $a = $answer[$i]; $result = isset($answers[$i]) ? $answers[$i] : -1; if (!is_array($a)) { $checkbox = HTML::input(array('type' => 'checkbox', 'name' => "answer[{$i}]", 'value' => $a)); if ($result >= 0) { $checkbox->setAttr('checked', "checked"); } if (!$readonly) { list($percent, $count, $all) = $this->storeResult($page, $i, $result ? 1 : 0); } else { list($percent, $count, $all) = $this->getResult($page, $i, 1); } $print = sprintf(_(" %d%% (%d/%d)"), $percent, $count, $all); $html->pushContent(HTML::tr(HTML::th(array('colspan' => 4, 'align' => 'left'), $q))); $html->pushContent(HTML::tr(HTML::td($checkbox), HTML::td($a), HTML::td($this->bar($percent)), HTML::td($print))); } else { $html->pushContent(HTML::tr(HTML::th(array('colspan' => 4, 'align' => 'left'), $q))); $row = HTML(); if (!$readonly) { $this->storeResult($page, $i, $answers[$i]); } for ($j = 0; $j <= count($a); $j++) { if (isset($a[$j])) { list($percent, $count, $all) = $this->getResult($page, $i, $j); $print = sprintf(_(" %d%% (%d/%d)"), $percent, $count, $all); $radio = HTML::input(array('type' => 'radio', 'name' => "answer[{$i}]", 'value' => $j)); if ($result == $j) { $radio->setAttr('checked', "checked"); } $row->pushContent(HTML::tr(HTML::td($radio), HTML::td($a[$j]), HTML::td($this->bar($percent)), HTML::td($print))); } } $html->pushContent($row); } } if (!$readonly) { return HTML(HTML::h3(_("The result of this poll so far:")), $html, HTML::p(_("Thanks for participating!"))); } else { return HTML(HTML::h3(_("The result of this poll so far:")), $html); } }
function run($dbi, $argstr, $request) { extract($this->getArgs($argstr, $request)); $html = HTML::table(array('cellpadding' => 1, 'cellspacing' => 1, 'border' => 1)); $connect = ldap_connect($host, $port); if (!ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3)) { $this->error(_("Failed to set LDAP protocol version to 3")); } $bind = ldap_bind($connect); $attr_array = array(""); // for now - if (!$attributes) { $res = ldap_search($connect, $basedn, $filter); } else { $attr_array = split(" ", $attributes); $res = ldap_search($connect, $basedn, $filter, $attr_array); } $entries = ldap_get_entries($connect, $res); // If we were given attributes then we return them in the order given if ($attributes) { for ($i = 0; $i < count($attr_array); $i++) { $attrcols[$i] = 0; } // Work out how many columns we need for each attribute. for ($i = 0; $i < $entries["count"]; $i++) { for ($ii = 0; $ii < $entries[$i]["count"]; $ii++) { $data = $entries[$i][$ii]; $datalen = $entries[$i][$data]["count"]; if ($attrcols[$ii] < $datalen) { $attrcols[$ii] = $datalen; } } } // Now print the headers $row = HTML::tr(); for ($i = 0; $i < count($attr_array); $i++) { $row->pushContent(HTML::th(array('colspan' => $attrcols[$i]), $attr_array[$i])); } $html->pushContent($row); for ($i = 0; $i < $entries["count"]; $i++) { // start a new row for every data value. $row = HTML::tr(); $nc = 0; for ($ii = 0; $ii < $entries[$i]["count"]; $ii++) { $data = $entries[$i][$ii]; // 3 possible cases for the values of each attribute. switch ($entries[$i][$data]["count"]) { case 0: $row->pushContent(HTML::td("")); $nc++; break; default: for ($iii = 0; $iii < $entries[$i][$data]["count"]; $iii++) { $row->pushContent(HTML::td($entries[$i][$data][$iii])); $nc++; } } // Make up some blank cells if required to pad this row for ($j = 0; $j < $attrcols[$ii] - $nc; $j++) { $row->pushContent(HTML::td("")); } } $html->pushContent($row); } } else { // $i = entries // $ii = attributes for entry // $iii = values per attribute for ($i = 0; $i < $entries["count"]; $i++) { $row = HTML::tr(); for ($ii = 0; $ii < $entries[$i]["count"]; $ii++) { $data = $entries[$i][$ii]; for ($iii = 0; $iii < $entries[$i][$data]["count"]; $iii++) { //echo $data.": ".$entries[$i][$data][$iii]."<br>"; if (!$attributes) { $row->pushContent(HTML::td($data)); } $row->pushContent(HTML::td($entries[$i][$data][$iii])); } } $html->pushContent($row); } } // THE_END); // ?? return $html; }
function _generateTable($caption) { if (count($this->pagelist) > 0) { $table = HTML::table(array('cellpadding' => 0, 'cellspacing' => 1, 'border' => 0, 'class' => 'pagelist')); if ($caption) { $table->pushContent(HTML::caption(array('align' => 'top'), $caption)); } $row = HTML::tr(); $spacer = new RawXml(" "); foreach ($this->_columns as $col_heading) { $row->pushContent(HTML::td(HTML($spacer, HTML::u($col_heading)))); $table_summary[] = $col_heading; } // Table summary for non-visual browsers. $table->setAttr('summary', sprintf(_("Columns: %s."), implode(", ", $table_summary))); $table->pushContent(HTML::thead($row), HTML::tbody(false, $this->_rows)); } else { $table = HTML(); if ($caption) { $table->pushContent(HTML::p($caption)); } $table->pushContent(HTML::p($this->_messageIfEmpty)); } return $table; }
function run($dbi, $argstr, &$request, $basepage) { global $DBParams; //$request->setArg('nocache','1'); extract($this->getArgs($argstr, $request)); if (!$alias) { return $this->error(_("No DSN alias for SqlResult.ini specified")); } $sql = $this->_sql; // apply custom filters if ($where and strstr($sql, "%%where%%")) { $sql = str_replace("%%where%%", $where, $sql); } // TODO: use a SQL construction library? if ($limit) { $pagelist = new PageList(); $limit = $pagelist->limit($limit); if (strstr($sql, "%%limit%%")) { $sql = str_replace("%%limit%%", $limit, $sql); } else { if (strstr($sql, "LIMIT")) { $sql = preg_replace("/LIMIT\\s+[\\d,]+\\s+/m", "LIMIT " . $limit . " ", $sql); } } } if (strstr($sql, "%%sortby%%")) { if (!$sortby) { $sql = preg_replace("/ORDER BY .*%%sortby%%\\s/m", "", $sql); } else { $sql = str_replace("%%sortby%%", $sortby, $sql); } } elseif (PageList::sortby($sortby, 'db')) { // add sorting: support paging sortby links if (preg_match("/\\sORDER\\s/", $sql)) { $sql = preg_replace("/ORDER BY\\s\\S+\\s/m", "ORDER BY " . PageList::sortby($sortby, 'db'), $sql); } else { $sql .= " ORDER BY " . PageList::sortby($sortby, 'db'); } } $inidsn = $this->getDsn($alias); if (!$inidsn) { return $this->error(sprintf(_("No DSN for alias %s in SqlResult.ini found"), $alias)); } // adodb or pear? adodb as default, since we distribute per default it. // for pear there may be overrides. // TODO: native PDO support (for now we use ADODB) if ($DBParams['dbtype'] == 'SQL') { $dbh = DB::connect($inidsn); $all = $dbh->getAll($sql); if (DB::isError($all)) { return $this->error($all->getMessage() . ' ' . $all->userinfo); } } else { // unless PearDB use the included ADODB, regardless if dba, file or PDO, ... if ($DBParams['dbtype'] != 'ADODB') { // require_once('lib/WikiDB/adodb/adodb-errorhandler.inc.php'); require_once 'lib/WikiDB/adodb/adodb.inc.php'; } $parsed = parseDSN($inidsn); $dbh =& ADONewConnection($parsed['phptype']); $conn = $dbh->Connect($parsed['hostspec'], $parsed['username'], $parsed['password'], $parsed['database']); if (!$conn) { return $this->error($dbh->errorMsg()); } $GLOBALS['ADODB_FETCH_MODE'] = ADODB_FETCH_ASSOC; $dbh->SetFetchMode(ADODB_FETCH_ASSOC); $all = $dbh->getAll($sql); $GLOBALS['ADODB_FETCH_MODE'] = ADODB_FETCH_NUM; $dbh->SetFetchMode(ADODB_FETCH_NUM); if (!$all) { return $this->error($dbh->errorMsg()); } } $args = array(); if ($limit) { // fill paging vars (see PageList) $args = $pagelist->pagingTokens(count($all), count($all[0]), $limit); if (!$args) { $args = array(); } } if ($template) { $args = array_merge(array('SqlResult' => $all, 'ordered' => $ordered, 'where' => $where, 'sortby' => $sortby, 'limit' => $limit), $args); // paging params override given params return Template($template, $args); } else { if ($ordered) { $html = HTML::ol(array('class' => 'sqlresult')); if ($all) { foreach ($all as $row) { $html->pushContent(HTML::li(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'), $row[0])); } } } else { $html = HTML::table(array('class' => 'sqlresult')); $i = 0; if ($all) { foreach ($all as $row) { $tr = HTML::tr(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow')); if ($row) { foreach ($row as $col) { $tr->pushContent(HTML::td($col)); } } $html->pushContent($tr); } } } } // do paging via pagelink template if (!empty($args['NUMPAGES'])) { $paging = Template("pagelink", $args); $html = $table->pushContent(HTML::thead($paging), HTML::tbody($html), HTML::tfoot($paging)); } if (0 and DEBUG) { // test deferred error/warning/notice collapsing trigger_error("test notice", E_USER_NOTICE); trigger_error("test warning", E_USER_WARNING); } return $html; }
function finish() { $defs =& $this->_content; $ncols = 0; foreach ($defs as $defn) { $ncols = max($ncols, $defn->ncols()); } foreach ($defs as $key => $defn) { $defs[$key]->setWidth($ncols); } return HTML::table(array('class' => 'wiki-dl-table', 'border' => 1, 'cellspacing' => 0, 'cellpadding' => 6), $defs); }
function run($dbi, $argstr, &$request, $basepage) { include_once "lib/BlockParser.php"; // MediawikiTablePlugin markup is new. $markup = 2.0; // We allow the compact Mediawiki syntax with: // - multiple cells on the same line (separated by "||"), // - multiple header cells on the same line (separated by "!!"). $argstr = str_replace("||", "\n| ", $argstr); $argstr = str_replace("!!", "\n! ", $argstr); $lines = preg_split('/\\n/', $argstr); $table = HTML::table(); // We always generate an Id for the table. // This is convenient for tables of class "sortable". // If user provides an Id, the generated Id will be overwritten below. $table->setAttr("id", GenerateId("MediawikiTable")); if (substr($lines[0], 0, 2) == "{|") { // Start of table $lines[0] = substr($lines[0], 2); } if ($lines[0][0] != '|' and $lines[0][0] != '!') { $line = array_shift($lines); $attrs = parse_attributes($line); foreach ($attrs as $key => $value) { if (in_array($key, array("id", "class", "title", "style", "bgcolor", "frame", "rules", "border", "cellspacing", "cellpadding", "summary", "align", "width"))) { $table->setAttr($key, $value); } } } if (count($lines) == 1) { // empty table, we only have closing "|}" line return HTML::raw(''); } foreach ($lines as $line) { if (substr($line, 0, 2) == "|}") { // End of table continue; } if (substr($line, 0, 2) == "|-") { if (isset($row)) { if (isset($cell)) { if (isset($content)) { if (is_numeric(trim($content))) { $cell->pushContent(HTML::p(array('style' => "text-align:right"), trim($content))); } else { $cell->pushContent(TransformText(trim($content), $markup, $basepage)); } unset($content); } $row->pushContent($cell); unset($cell); } if (isset($thead)) { $thead->pushContent($row); $table->pushContent($thead); unset($thead); $tbody = HTML::tbody(); } else { $tbody->pushContent($row); } } $row = HTML::tr(); $attrs = parse_attributes(substr($line, 2)); foreach ($attrs as $key => $value) { if (in_array($key, array("id", "class", "title", "style", "bgcolor", "align", "valign"))) { $row->setAttr($key, $value); } } continue; } // Table summary if (substr($line, 0, 2) == "|=") { $line = substr($line, 2); $table->setAttr("summary", trim($line)); } // Table caption if (substr($line, 0, 2) == "|+") { $caption = HTML::caption(); $line = substr($line, 2); $pospipe = strpos($line, "|"); $posbracket = strpos($line, "["); if ($pospipe !== false && ($posbracket === false || $posbracket > $pospipe)) { $attrs = parse_attributes(substr($line, 0, $pospipe)); foreach ($attrs as $key => $value) { if (in_array($key, array("id", "class", "title", "style", "align", "lang"))) { $caption->setAttr($key, $value); } } $line = substr($line, $pospipe + 1); } $caption->pushContent(trim($line)); $table->pushContent($caption); } if ((substr($line, 0, 1) == "|" or substr($line, 0, 1) == "!") and isset($row)) { if (isset($cell)) { if (isset($content)) { if (is_numeric(trim($content))) { $cell->pushContent(HTML::p(array('style' => "text-align:right"), trim($content))); } else { $cell->pushContent(TransformText(trim($content), $markup, $basepage)); } unset($content); } $row->pushContent($cell); } if (substr($line, 0, 1) == "!") { $cell = HTML::th(); // Header $thead = HTML::thead(); } else { $cell = HTML::td(); if (!isset($tbody)) { $tbody = HTML::tbody(); } } $line = substr($line, 1); // If there is a "|" in the line, the start of line // (before the "|") is made of attributes. // The end of the line (after the "|") is the cell content // This is not true if the pipe is inside [], {{}} or {{{}}} // | [foo|bar] // The following cases must work: // | foo // | [foo|bar] // | class="xxx" | foo // | class="xxx" | [foo|bar] // | {{tmpl|arg=val}} // | {{image.png|alt}} // | {{{ xxx | yyy }}} $pospipe = strpos($line, "|"); $posbracket = strpos($line, "["); $poscurly = strpos($line, "{"); if ($pospipe !== false && ($posbracket === false || $posbracket > $pospipe) && ($poscurly === false || $poscurly > $pospipe)) { $attrs = parse_attributes(substr($line, 0, $pospipe)); foreach ($attrs as $key => $value) { if (in_array($key, array("id", "class", "title", "style", "colspan", "rowspan", "width", "height", "bgcolor", "align", "valign"))) { $cell->setAttr($key, $value); } } $line = substr($line, $pospipe + 1); if (is_numeric(trim($line))) { $cell->pushContent(HTML::p(array('style' => "text-align:right"), trim($line))); } else { $cell->pushContent(TransformText(trim($line), $markup, $basepage)); } continue; } } if (isset($row) and isset($cell)) { $line = str_replace("?\\>", "?>", $line); $line = str_replace("\\~", "~", $line); if (empty($content)) { $content = ''; } $content .= $line . "\n"; } } if (isset($row)) { if (isset($cell)) { if (isset($content)) { if (is_numeric(trim($content))) { $cell->pushContent(HTML::p(array('style' => "text-align:right"), trim($content))); } else { $cell->pushContent(TransformText(trim($content), $markup, $basepage)); } } $row->pushContent($cell); } $tbody->pushContent($row); $table->pushContent($tbody); } return $table; }
function _start_block($header) { $this->_block = HTML::table(array('width' => '100%', 'class' => 'block', 'cellspacing' => 0, 'cellpadding' => 1, 'border' => 0), HTML::tr(HTML::td(array('colspan' => 2), HTML::tt($header)))); }
$result = $conn->query($insert_div_data); echo 'HTML & CSS Code created successfully<br/>'; break; case 'label': $data_html = $obj->label($var_name, $label, $value, $div_name); $data_css = $obj_css->styles($var_name, $color, $width, $height, $x_position, $y_position, $z_index, $font_size, $font_color); $obj->write_to_file($data_html, $html_file_name, $css_file_name, $data_css); $insert = "INSERT INTO `CMS`.`html_css` (`ID`, `HTML`, `CSS`, `FORM_ID`,`STATUS`, `NAME`) VALUES (NULL, '{$data_html}', '{$data_css}', {$index_of_form},'1', '{$label}');"; $result = $conn->query($insert); $ID = mysqli_insert_id($conn); $insert_div_data = "INSERT INTO `CMS`.`divs` (`ID`, `ELEMENT`, `HTML_CSS_ID`) VALUES (NULL, '{$data_html}',{$ID});"; $result = $conn->query($insert_div_data); echo 'HTML & CSS Code created successfully<br/>'; break; case 'table': $data_html = $obj->table($var_name, $label, $value, $div_name); $data_css = $obj_css->styles($var_name, $color, $width, $height, $x_position, $y_position, $z_index, $font_size, $font_color); $obj->write_to_file($data_html, $html_file_name, $css_file_name, $data_css); $insert = "INSERT INTO `CMS`.`html_css` (`ID`, `HTML`, `CSS`, `FORM_ID`,`STATUS`, `NAME`) VALUES (NULL, '{$data_html}', '{$data_css}', {$index_of_form},'1', '{$label}');"; $result = $conn->query($insert); $ID = mysqli_insert_id($conn); $insert_div_data = "INSERT INTO `CMS`.`divs` (`ID`, `ELEMENT`, `HTML_CSS_ID`) VALUES (NULL, '{$data_html}',{$ID});"; $result = $conn->query($insert_div_data); echo 'HTML & CSS Code created successfully<br/>'; break; case 'list': $list = array(); if (isset($list1)) { array_push($list, $list1); } if (isset($list2)) {
function OptionsButtonBars($plugin_args) { $this->__construct('fieldset', array('class' => 'wiki-rc-action')); // Add ShowHideFolder button $icon = $GLOBALS['WikiTheme']->_findData('images/folderArrowOpen.png'); $img = HTML::img(array('id' => 'rc-action-img', 'src' => $icon, 'onclick' => "showHideFolder('rc-action')", 'alt' => _("Click to hide/show"), 'title' => _("Click to hide/show"))); // Display selection buttons extract($plugin_args); // Custom caption if (!$caption) { $caption = _("Show changes for:"); } $this->pushContent(HTML::legend($caption, ' ', $img)); $table = HTML::table(array('id' => 'rc-action-body', 'style' => 'display:block')); $tr = HTML::tr(); foreach (explode(",", $daylist) as $days_button) { $tr->pushContent($this->_makeDayButton($days_button, $days)); } $table->pushContent($tr); $tr = HTML::tr(); $tr->pushContent($this->_makeUsersButton(0)); $tr->pushContent($this->_makeUsersButton(1)); $table->pushContent($tr); $tr = HTML::tr(); $tr->pushContent($this->_makePagesButton(0)); $tr->pushContent($this->_makePagesButton(1)); $table->pushContent($tr); $tr = HTML::tr(); $tr->pushContent($this->_makeMinorButton(1, $show_minor)); $tr->pushContent($this->_makeMinorButton(0, $show_minor)); $table->pushContent($tr); $tr = HTML::tr(); $tr->pushContent($this->_makeShowAllButton(1, $show_all)); $tr->pushContent($this->_makeShowAllButton(0, $show_all)); $table->pushContent($tr); $tr = HTML::tr(); $tr->pushContent($this->_makeNewPagesButton(0, $only_new)); $tr->pushContent($this->_makeNewPagesButton(1, $only_new)); $table->pushContent($tr); $this->pushContent($table); }
function run($dbi, $argstr, &$request, $basepage) { $this->args = $this->getArgs($argstr, $request); $args =& $this->args; $this->_links = array(); $now = localtime(time() + 3600 * $request->getPref('timeOffset'), 1); foreach (array('month' => $now['tm_mon'] + 1, 'year' => $now['tm_year'] + 1900) as $param => $dflt) { if (!($args[$param] = intval($args[$param]))) { $args[$param] = $dflt; } } $time = mktime(12, 0, 0, $args['month'] + $args['month_offset'], 1, $args['year']); $colnum = $args['display_weeknum'] ? 8 : 7; $cal = HTML::table(array('cellspacing' => 0, 'cellpadding' => 2, 'class' => 'cal'), HTML::thead($this->__header($request->getArg('pagename'), $time), $this->__daynames($args['start_wday']))); $t = localtime($time, 1); if ($now['tm_year'] == $t['tm_year'] && $now['tm_mon'] == $t['tm_mon']) { $this->_today = $now['tm_mday']; } else { $this->_today = false; } $tbody = HTML::tbody(); $row = HTML::tr(); if ($args['display_weeknum']) { $row->pushContent(HTML::td(array('class' => 'cal-weeknum'), (int) strftime("%U", $time) + 1)); } // %U problem. starts with 0 $col = (7 + $t['tm_wday'] - $args['start_wday']) % 7; if ($col > 0) { $row->pushContent(HTML::td(array('colspan' => $col))); } $done = false; while (!$done) { $row->pushContent($this->__date($dbi, $time)); if (++$col % 7 == 0) { $tbody->pushContent($row); $col = 0; $row = HTML::tr(); } $time += SECONDS_PER_DAY; $t = localtime($time, 1); $done = $t['tm_mday'] == 1; if (!$col and !$done and $args['display_weeknum']) { $row->pushContent(HTML::td(array('class' => 'cal-weeknum'), (int) strftime("%U", $time) + 1)); } // starts with 0 } if ($row->getContent()) { $row->pushContent(HTML::td(array('colspan' => (42 - $col) % 7))); $tbody->pushContent($row); } $cal->pushContent($tbody); return $cal; }
function run($dbi, $argstr, &$request, $basepage) { global $WikiTheme; include_once "lib/BlockParser.php"; // RichTablePlugin markup is new. $markup = 2.0; $lines = preg_split('/\\n/', $argstr); $table = HTML::table(); if ($lines[0][0] == '*') { $line = substr(array_shift($lines), 1); $attrs = $this->_parse_attr($line); foreach ($attrs as $key => $value) { if (in_array($key, array("id", "class", "title", "style", "bgcolor", "frame", "rules", "border", "cellspacing", "cellpadding", "summary", "align", "width"))) { $table->setAttr($key, $value); } } } foreach ($lines as $line) { if (substr($line, 0, 1) == "-") { if (isset($row)) { if (isset($cell)) { if (isset($content)) { $cell->pushContent(TransformText($content, $markup, $basepage)); unset($content); } $row->pushContent($cell); unset($cell); } $table->pushContent($row); } $row = HTML::tr(); $attrs = $this->_parse_attr(substr($line, 1)); foreach ($attrs as $key => $value) { if (in_array($key, array("id", "class", "title", "style", "bgcolor", "align", "valign"))) { $row->setAttr($key, $value); } } continue; } if (substr($line, 0, 1) == "|" and isset($row)) { if (isset($cell)) { if (isset($content)) { $cell->pushContent(TransformText($content, $markup, $basepage)); unset($content); } $row->pushContent($cell); } $cell = HTML::td(); $line = substr($line, 1); if ($line[0] == "*") { $attrs = $this->_parse_attr(substr($line, 1)); foreach ($attrs as $key => $value) { if (in_array($key, array("id", "class", "title", "style", "colspan", "rowspan", "width", "height", "bgcolor", "align", "valign"))) { $cell->setAttr($key, $value); } } continue; } } if (isset($row) and isset($cell)) { $line = str_replace("?\\>", "?>", $line); $line = str_replace("\\~", "~", $line); if (empty($content)) { $content = ''; } $content .= $line . "\n"; } } if (isset($row)) { if (isset($cell)) { if (isset($content)) { $cell->pushContent(TransformText($content)); } $row->pushContent($cell); } $table->pushContent($row); } return $table; }
/** * void hourly(string $table, int $year, int $month, int $day) * * Draws a table with hourly stats * * @param string $table * @param int $year * @param int $month * @param int $day * @return void * @access public * @static */ public static function hourly($table, $year, $month, $day) { $logQ = new Query_LogStats($table); $totalHits = $logQ->dayHits($year, $month, $day); $monthName = self::getMonthName($month); echo HTML::section(4, sprintf(_("Hourly Stats for %s %d, %d: %d hits"), $monthName, intval($day), intval($year), $totalHits)); if ($totalHits == 0) { $logQ->close(); echo Msg::info(_("There are not statistics")); return; } $array = $logQ->dayHitsByHour($year, $month, $day); $thead = array(_("Hour"), _("Hits")); $options = array(1 => array('nowrap' => 1)); $tbody = array(); foreach ($array as $hour => $hits) { $row = sprintf("%02d:00 - %02d:59", $hour, $hour); $row .= OPEN_SEPARATOR; if ($hits == 0) { $widthImage = 0; $percent = 0; } else { $widthImage = round(100 * $hits / $totalHits, 0); $percent = substr(100 * $hits / $totalHits, 0, 5); } $row .= self::_percBar($widthImage); $row .= ' ' . $percent . '% (' . $hits . ')'; $tbody[] = explode(OPEN_SEPARATOR, $row); } echo HTML::table($thead, $tbody, null, $options); $logQ->freeResult(); $logQ->close(); unset($logQ); }