本文整理汇总了PHP中HTML::th方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::th方法的具体用法?PHP HTML::th怎么用?PHP HTML::th使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::th方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _generateColheadings
function _generateColheadings(&$info, &$table)
{
// table headings
$tr = HTML::tr();
$headings = array(_("Plugin"), _("Description"));
if ($info == 'args') {
$headings[] = _("Arguments");
}
foreach ($headings as $title) {
$tr->pushContent(HTML::th($title));
}
$table->pushContent(HTML::thead($tr));
}
示例2: run
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;
}
}
示例3: _arrayToTable
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;
}
示例4: doPoll
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);
}
}
示例5: run
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;
}
示例6: run
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;
}
示例7: showForm
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);
}
示例8: addTableHead
function addTableHead(&$table)
{
$row = HTML::tr(HTML::th(_("Name")), HTML::th(array('align' => 'right'), _("Score")));
if ($this->debug) {
$this->_pushDebugHeadingTDinto($row);
}
$table->pushContent(HTML::thead($row));
}
示例9: Block_table_dl_defn
function Block_table_dl_defn($term, $defn)
{
$this->XmlContent();
if (!is_array($defn)) {
$defn = $defn->getContent();
}
$this->_next_tight_top = false;
// value irrelevant - gets fixed later
$this->_ncols = $this->_ComputeNcols($defn);
$this->_nrows = 0;
foreach ($defn as $item) {
if ($this->_IsASubtable($item)) {
$this->_addSubtable($item);
} else {
$this->_addToRow($item);
}
}
$this->_flushRow();
$th = HTML::th($term);
if ($this->_nrows > 1) {
$th->setAttr('rowspan', $this->_nrows);
}
$this->_setTerm($th);
}
示例10: asEditableTable
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;
}
示例11: button_heading
function button_heading($pagelist, $colNum)
{
$s = HTML(HTML::raw(' '), $this->_heading, HTML::raw(' '));
return HTML::th(array('align' => 'center', 'valign' => 'middle', 'class' => 'gridbutton'), $s);
}
示例12: _setHeaders
function _setHeaders($row)
{
if (!$this->_headerSet) {
foreach ($row as $key => $value) {
$this->_theadrow->pushContent(HTML::th(_($key)));
}
$this->_headerSet = true;
}
}
示例13: run
function run($dbi, $argstr, $request)
{
if (!function_exists('ldap_connect')) {
if (!loadPhpExtension('ldap')) {
return $this->error(_("Missing ldap extension"));
}
}
$args = $this->getArgs($argstr, $request);
extract($args);
//include_once("lib/WikiUser/LDAP.php");
if (!$host) {
if (defined('LDAP_AUTH_HOST')) {
$host = LDAP_AUTH_HOST;
if (strstr(LDAP_AUTH_HOST, '://')) {
$port = null;
}
} else {
$host = 'localhost';
}
} else {
if (strstr($host, '://')) {
$port = null;
}
}
$html = HTML();
if (is_null($port)) {
$connect = ldap_connect($host);
} else {
$connect = ldap_connect($host, $port);
}
if (!$connect) {
return $this->error(_("Failed to connect to LDAP host"));
}
if (!$options and defined('LDAP_AUTH_HOST') and $args['host'] == LDAP_AUTH_HOST) {
if (!empty($GLOBALS['LDAP_SET_OPTION'])) {
$options = $GLOBALS['LDAP_SET_OPTION'];
}
}
if ($options) {
foreach ($options as $key => $value) {
if (!ldap_set_option($connect, $key, $value)) {
$this->error(_("Failed to set LDAP {$key} {$value}"));
}
}
}
// special convenience: if host = LDAP_AUTH_HOST
// then take user and password from config.ini also
if ($user) {
if ($password) {
// required for Windows Active Directory Server
$bind = ldap_bind($connect, $user, $password);
} else {
$bind = ldap_bind($connect, $user);
}
} elseif (defined('LDAP_AUTH_HOST') and $args['host'] == LDAP_AUTH_HOST) {
if (LDAP_AUTH_USER) {
if (LDAP_AUTH_PASSWORD) {
// Windows Active Directory Server is strict
$r = ldap_bind($connect, LDAP_AUTH_USER, LDAP_AUTH_PASSWORD);
} else {
$r = ldap_bind($connect, LDAP_AUTH_USER);
}
} else {
// anonymous bind
$bind = ldap_bind($connect);
}
} else {
// other anonymous bind
$bind = ldap_bind($connect);
}
if (!$bind) {
return $this->error(_("Failed to bind LDAP host"));
}
if (!$basedn) {
$basedn = LDAP_BASE_DN;
}
$attr_array = array("");
if (!$attributes) {
$res = ldap_search($connect, $basedn, $filter);
} else {
$attr_array = explode(" ", $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
// else take all
if (!$attributes) {
$attr_array = array();
for ($ii = 0; $ii < $entries[0]["count"]; $ii++) {
$data = $entries[0][$ii];
$attr_array[] = $data;
}
}
for ($i = 0; $i < count($attr_array); $i++) {
$attrcols[$i] = 0;
}
// Work out how many columns we need for each attribute. objectclass has more
for ($i = 0; $i < $entries[0]["count"]; $i++) {
$data = $entries[0][$i];
$datalen = $entries[0][$data]["count"];
//.........这里部分代码省略.........
示例14: showTopics
function showTopics($request, $args)
{
global $WikiTheme;
$dbi = $request->getDbh();
$topics = $this->findBlogs($dbi, $args['pagename'], 'wikiforum');
$html = HTML::table(array('border' => 0));
$row = HTML::tr(HTML::th('title'), HTML::th('last post'), HTML::th('author'));
$html->pushContent($row);
foreach ($topics as $rev) {
//TODO: get numposts, number of replies
$meta = $rev->get('wikiforum');
// format as list, not as wikiforum content
$page = new WikiPageName($rev, $args['pagename']);
$row = HTML::tr(HTML::td(WikiLink($page, 'if_known', $rev->get('summary'))), HTML::td($WikiTheme->formatDateTime($meta['ctime'])), HTML::td(WikiLink($meta['creator'], 'if_known')));
$html->pushContent($row);
}
return $html;
}
示例15: run
function run($dbi, $argstr, &$request, $basepage)
{
$this->disallowed_extensions = explode("\n", "ad[ep]\nasd\nba[st]\nchm\ncmd\ncom\ncgi\ncpl\ncrt\ndll\neml\nexe\nhlp\nhta\nin[fs]\nisp\njse?\nlnk\nmd[betw]\nms[cipt]\nnws\nocx\nops\npcd\np[ir]f\nphp\npl\npy\nreg\nsc[frt]\nsh[bsm]?\nswf\nurl\nvb[esx]?\nvxd\nws[cfh]");
//removed "\{[[:xdigit:]]{8}(?:-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}\}"
$args = $this->getArgs($argstr, $request);
extract($args);
$file_dir = getUploadFilePath();
//$url_prefix = SERVER_NAME . DATA_PATH;
$form = HTML::form(array('action' => $request->getPostURL(), 'enctype' => 'multipart/form-data', 'method' => 'post'));
$contents = HTML::div(array('class' => 'wikiaction'));
$contents->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => MAX_UPLOAD_SIZE)));
/// MV add pv
/// @todo: have a generic method to transmit pv
if (!empty($_REQUEST['pv'])) {
$contents->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'pv', 'value' => $_REQUEST['pv'])));
}
$contents->pushContent(HTML::input(array('name' => 'userfile', 'type' => 'file', 'size' => '50')));
$contents->pushContent(HTML::raw(" "));
$contents->pushContent(HTML::input(array('value' => _("Upload"), 'type' => 'submit')));
$form->pushContent($contents);
$message = HTML();
if ($request->isPost() and $this->only_authenticated) {
// Make sure that the user is logged in.
$user = $request->getUser();
if (!$user->isAuthenticated()) {
$message->pushContent(HTML::h2(_("ACCESS DENIED: You must log in to upload files.")), HTML::br(), HTML::br());
$result = HTML();
$result->pushContent($form);
$result->pushContent($message);
return $result;
}
}
$userfile = $request->getUploadedFile('userfile');
if ($userfile) {
$userfile_name = $userfile->getName();
$userfile_name = trim(basename($userfile_name));
$userfile_tmpname = $userfile->getTmpName();
$err_header = HTML::h2(fmt("ERROR uploading '%s': ", $userfile_name));
/// MV add
/// Wiki attachments
$wa = new WikiAttachment(GROUP_ID);
$rev = $wa->createRevision($userfile_name, $userfile->getSize(), $userfile->getType(), $userfile->getTmpName());
if ($rev >= 0) {
$prev = $rev + 1;
$interwiki = new PageType_interwikimap();
$link = $interwiki->link("Upload:{$prev}/{$userfile_name}");
$message->pushContent(HTML::h2(_("File successfully uploaded.")));
$message->pushContent(HTML::ul(HTML::li($link)));
// the upload was a success and we need to mark this event in the "upload log"
if ($logfile) {
$upload_log = $file_dir . basename($logfile);
$this->log($userfile, $upload_log, $message);
}
if ($autolink) {
require_once "lib/loadsave.php";
$pagehandle = $dbi->getPage($page);
if ($pagehandle->exists()) {
// don't replace default contents
$current = $pagehandle->getCurrentRevision();
$version = $current->getVersion();
$text = $current->getPackedContent();
$newtext = $text . "\n* [Upload:{$userfile_name}]";
$meta = $current->_data;
$meta['summary'] = sprintf(_("uploaded %s"), $userfile_name);
$pagehandle->save($newtext, $version + 1, $meta);
}
}
} else {
$message->pushContent($err_header);
$message->pushContent(HTML::br(), _("Uploading failed."), HTML::br());
}
} else {
$message->pushContent(HTML::br(), HTML::br());
}
/// {{{ Codendi Specific
// URL arguments
if (array_key_exists('offset', $_REQUEST)) {
$offset = $_REQUEST['offset'];
} else {
$offset = 0;
}
if (array_key_exists('limit', $_REQUEST)) {
$limit = $_REQUEST['limit'];
} else {
$limit = 10;
}
$attchTab = HTML::table(array('border' => '1', 'width' => '100%'));
$attchTab->pushContent(HTML::tr(HTML::th(_("Attachment")), HTML::th(_("Number of revision"))));
$wai =& WikiAttachment::getListWithCounter(GROUP_ID, user_getid(), array('offset' => $offset, 'nb' => $limit));
$wai->rewind();
while ($wai->valid()) {
$wa =& $wai->current();
$filename = basename($wa->getFilename());
$url = getUploadDataPath() . urlencode($filename);
$line = HTML::tr();
$line->pushContent(HTML::td(HTML::a(array('href' => $url), "Attach:" . $filename)));
$line->pushContent(HTML::td($wa->count()));
$attchTab->pushContent($line);
$wai->next();
}
//.........这里部分代码省略.........