コード例 #1
0
ファイル: HtmlConverter.php プロジェクト: hugcoday/wiki
 function run($dbi, $argstr, &$request, $basepage)
 {
     /* plugin not yet has arguments - save for later (copied from UpLoad)
        $args = $this->getArgs($argstr, $request);
        extract($args);
                */
     $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)));
     $contents->pushContent(HTML::input(array('name' => 'userfile', 'type' => 'file', 'size' => '50')));
     $contents->pushContent(HTML::raw(" "));
     $contents->pushContent(HTML::input(array('value' => _("Convert"), 'type' => 'submit')));
     $form->pushContent($contents);
     $message = HTML();
     $userfile = $request->getUploadedFile('userfile');
     if ($userfile) {
         $userfile_name = $userfile->getName();
         $userfile_name = basename($userfile_name);
         $userfile_tmpname = $userfile->getTmpName();
         if (!preg_match("/(\\.html|\\.htm)\$/i", $userfile_name)) {
             $message->pushContent(_("Only files with extension HTML are allowed"), HTML::br(), HTML::br());
         } else {
             $message->pushContent(_("Processed {$userfile_name}"), HTML::br(), HTML::br());
             $message->pushContent(_("Copy the output below and paste it into your Wiki page."), HTML::br());
             $message->pushContent($this->_process($userfile_tmpname));
         }
     } else {
         $message->pushContent(HTML::br(), HTML::br());
     }
     $result = HTML();
     $result->pushContent($form);
     $result->pushContent($message);
     return $result;
 }
コード例 #2
0
ファイル: GoTo.php プロジェクト: pombredanne/tuleap
 function run($dbi, $argstr, &$request, $basepage)
 {
     $request->setArg('action', false);
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if ($goto = $request->getArg('goto')) {
         // The user has pressed 'Go'; process request
         $request->setArg('goto', false);
         $target = $goto['target'];
         if ($dbi->isWikiPage($target)) {
             $url = WikiURL($target, 0, 1);
         } else {
             $url = WikiURL($target, array('action' => 'edit'), 1);
         }
         $request->redirect($url);
         // User should see nothing after redirect
         return '';
     }
     $action = $request->getURLtoSelf();
     $form = HTML::form(array('action' => $action, 'method' => 'post'));
     $form->pushContent(HiddenInputs($request->getArgs()));
     $textfield = HTML::input(array('type' => 'text', 'size' => $size, 'name' => 'goto[target]'));
     $button = Button('submit:goto[go]', _("Go"), false);
     $form->pushContent($textfield, $button);
     return $form;
 }
コード例 #3
0
ファイル: Button.php プロジェクト: romartyn/cogear
 public function render()
 {
     $this->getAttributes();
     $this->attributes->value = $this->label;
     $this->attributes->label = '';
     $this->code = HTML::input($this->attributes);
     return parent::render();
 }
コード例 #4
0
ファイル: Button.php プロジェクト: brussens/cogear2
 public function render()
 {
     $this->prepareOptions();
     $this->value = $this->label;
     $this->options->label = '';
     $this->code = HTML::input($this->options);
     return parent::render();
 }
コード例 #5
0
ファイル: Captcha.php プロジェクト: pombredanne/tuleap
 function getFormElements()
 {
     $el = array();
     if (!$this->request->getSessionVar('captcha_ok')) {
         $el['CAPTCHA_INPUT'] = HTML::input(array('type' => 'text', 'class' => 'wikitext', 'id' => 'edit:captcha_input', 'name' => 'edit[captcha_input]', 'size' => $this->length + 2, 'maxlength' => 256));
         $url = WikiURL("", array("action" => "captcha", "id" => time()), false);
         $el['CAPTCHA_IMAGE'] = "<img src=\"{$url}\" alt=\"captcha\" />";
         $el['CAPTCHA_LABEL'] = '<label for="edit:captcha_input">' . _("Type word above:") . ' </label>';
     }
     return $el;
 }
コード例 #6
0
ファイル: PasswordReset.php プロジェクト: hugcoday/wiki
 function doForm(&$request, $userid = '', $header = '', $footer = '')
 {
     $post_args = $request->getArg('admin_reset');
     if (!$header) {
         $header = HTML::p(_("Reset password of user: "******"user", 'value' => $userid)));
     }
     if (!$footer) {
         $isadmin = $request->_user->isAdmin();
         $footer = HTML::p(Button('submit:admin_reset[reset]', $isadmin ? _("Yes") : _("Send email"), $isadmin ? 'wikiadmin' : 'button'), HTML::Raw('&nbsp;'), Button('submit:admin_reset[cancel]', _("Cancel"), 'button'));
     }
     return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, HiddenInputs($request->getArgs(), false, array('admin_reset', 'user')), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $footer);
 }
コード例 #7
0
ファイル: FoafViewer.php プロジェクト: neymanna/fusionforge
 function run($dbi, $argstr, &$request, $basepage)
 {
     /* ignore fatal on loading */
     /*
     global $ErrorManager;
     $ErrorManager->pushErrorHandler(new WikiMethodCb($this,'_error_handler'));
     */
     // Require the XML_FOAF_Parser class. This is a pear library not included with phpwiki.
     // see doc/README.foaf
     if (findFile('XML/FOAF/Parser.php', 'missing_ok')) {
         require_once 'XML/FOAF/Parser.php';
     }
     //$ErrorManager->popErrorHandler();
     if (!class_exists('XML_FOAF_Parser')) {
         return $this->error(_("required pear library XML/FOAF/Parser.php not found in include_path"));
     }
     extract($this->getArgs($argstr, $request));
     // Get our FOAF File from the foaf plugin argument or $_GET['foaf']
     if (empty($foaf)) {
         $foaf = $request->getArg('foaf');
     }
     $chooser = HTML::form(array('method' => 'get', 'action' => $request->getURLtoSelf()), HTML::h4(_("FOAF File URI")), HTML::input(array('id' => 'foaf', 'name' => 'foaf', 'type' => 'text', 'size' => '80', 'value' => $foaf)), HTML::br(), HTML::input(array('id' => 'pretty', 'name' => 'pretty', 'type' => 'radio', 'checked' => 'checked'), _("Pretty HTML")), HTML::input(array('id' => 'original', 'name' => 'original', 'type' => 'radio'), _("Original URL (Redirect)")), HTML::br(), HTML::input(array('type' => 'submit', 'value' => _("Parse FOAF"))));
     if (empty($foaf)) {
         return $chooser;
     } else {
         //Error Checking
         if (substr($foaf, 0, 7) != "http://") {
             return $this->error(_("foaf must be a URI starting with http://"));
         }
         // Start of output
         if (!empty($original)) {
             $request->redirect($foaf);
         } else {
             $foaffile = url_get_contents($foaf);
             if (!$foaffile) {
                 //TODO: get errormsg
                 return HTML(HTML::p("Resource isn't available: Something went wrong, probably a 404!"));
             }
             // Create new Parser object
             $parser = new XML_FOAF_Parser();
             // Parser FOAF into $foaffile
             $parser->parseFromMem($foaffile);
             $a = $parser->toArray();
             $html = HTML(HTML::h1(@$a[0]["name"]), HTML::table(HTML::thead(), HTML::tbody(@$a[0]["title"] ? HTML::tr(HTML::td(_("Title")), HTML::td($a[0]["title"])) : null, @$a[0]["homepage"][0] ? $this->iterateHTML($a[0], "homepage", $a["dc"]) : null, @$a[0]["weblog"][0] ? $this->iterateHTML($a[0], "weblog", $a["dc"]) : null, HTML::tr(HTML::td("Full Name"), @$a[0]["name"][0] ? HTML::td(@$a[0]["name"]) : null), @$a[0]["nick"][0] ? $this->iterateHTML($a[0], "nick", $a["dc"]) : null, @$a[0]["mboxsha1sum"][0] ? $this->iterateHTML($a[0], "mboxsha1sum", $a["dc"]) : null, @$a[0]["depiction"][0] ? $this->iterateHTML($a[0], "depiction", $a["dc"]) : null, @$a[0]["seealso"][0] ? $this->iterateHTML($a[0], "seealso", $a["dc"]) : null, HTML::tr(HTML::td("Source"), HTML::td(HTML::a(array('href' => @$foaf), "RDF"))))));
             if (DEBUG) {
                 $html->pushContent(HTML::hr(), $chooser);
             }
             return $html;
         }
     }
 }
コード例 #8
0
 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;
 }
コード例 #9
0
ファイル: LinkSearch.php プロジェクト: hugcoday/wiki
 function showForm(&$dbi, &$request, $args)
 {
     $action = $request->getPostURL();
     $hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's', 'direction'));
     $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'), '');
     $query = 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'), '');
     $dirsign_switch = JavaScript("\nfunction dirsign_switch() {\n  var d = document.getElementById('dirsign')\n  d.innerHTML = (d.innerHTML == ' =&gt; ') ? ' &lt;= ' : ' =&gt; '\n}\n");
     $dirsign = " => ";
     $in = $out = array('name' => 'direction', 'type' => 'radio', 'onChange' => 'dirsign_switch()');
     $out['value'] = 'out';
     $out['id'] = 'dir_out';
     if ($args['direction'] == 'out') {
         $out['checked'] = 'checked';
     }
     $in['value'] = 'in';
     $in['id'] = 'dir_in';
     if ($args['direction'] == 'in') {
         $in['checked'] = 'checked';
         $dirsign = " <= ";
     }
     $direction = HTML(HTML::input($out), HTML::label(array('for' => 'dir_out'), _("outgoing")), HTML::input($in), HTML::label(array('for' => 'dir_in'), _("incoming")));
     /*
     $direction = HTML::select(array('name'=>'direction',
                                     'onChange' => 'dirsign_switch()'));
     $out = array('value' => 'out');
     if ($args['direction']=='out') $out['selected'] = 'selected';
     $in = array('value' => 'in');
     if ($args['direction']=='in') {
         $in['selected'] = 'selected';
         $dirsign = " <= ";
     }
     $direction->pushContent(HTML::option($out, _("outgoing")));
     $direction->pushContent(HTML::option($in, _("incoming")));
     */
     $submit = Button('submit:search', _("LinkSearch"), false);
     $instructions = _("Search in pages for links with the matching name.");
     $form = HTML::form(array('action' => $action, 'method' => 'GET', 'accept-charset' => $GLOBALS['charset']), $dirsign_switch, $hiddenfield, $instructions, HTML::br(), $pagefilter, HTML::strong(HTML::tt(array('id' => 'dirsign'), $dirsign)), $query, HTML::raw('&nbsp;'), $direction, HTML::raw('&nbsp;'), $submit);
     return $form;
 }
コード例 #10
0
ファイル: WikiFormRich.php プロジェクト: pombredanne/tuleap
 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     if (empty($action)) {
         return $this->error(fmt("A required argument '%s' is missing.", "action"));
     }
     $form = HTML::form(array('action' => $request->getPostURL(), 'method' => strtolower($method), 'class' => 'wikiaction', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('action' => $action, 'group_id' => GROUP_ID)));
     $nbsp = HTML::Raw('&nbsp;');
     $already_submit = 0;
     foreach ($this->inputbox as $inputbox) {
         foreach ($inputbox as $inputtype => $input) {
             if ($inputtype == 'radiobutton') {
                 $inputtype = 'radio';
             }
             // convert from older versions
             $input['type'] = $inputtype;
             $text = '';
             if ($inputtype != 'submit') {
                 if (empty($input['name'])) {
                     return $this->error(fmt("A required argument '%s' is missing.", $inputtype . "[][name]"));
                 }
                 if (!isset($input['text'])) {
                     $input['text'] = gettext($input['name']);
                 }
                 $text = $input['text'];
                 unset($input['text']);
             }
             switch ($inputtype) {
                 case 'checkbox':
                 case 'radio':
                     if (empty($input['value'])) {
                         $input['value'] = 1;
                     }
                     if (is_array($input['value'])) {
                         $div = HTML::div(array('class' => $class));
                         $values = $input['value'];
                         $name = $input['name'];
                         $input['name'] = $inputtype == 'checkbox' ? $name . "[]" : $name;
                         foreach ($values as $val) {
                             $input['value'] = $val;
                             if ($request->getArg($name)) {
                                 if ($request->getArg($name) == $val) {
                                     $input['checked'] = 'checked';
                                 } else {
                                     unset($input['checked']);
                                 }
                             }
                             $div->pushContent(HTML::input($input), $nbsp, $val, $nbsp, "\n");
                             if (!$nobr) {
                                 $div->pushContent(HTML::br());
                             }
                         }
                         $form->pushContent($div);
                     } else {
                         if (empty($input['checked'])) {
                             if ($request->getArg($input['name'])) {
                                 $input['checked'] = 'checked';
                             }
                         } else {
                             $input['checked'] = 'checked';
                         }
                         if ($nobr) {
                             $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                         } else {
                             $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                         }
                     }
                     break;
                 case 'editbox':
                     $input['type'] = 'text';
                     if (empty($input['value']) and $s = $request->getArg($input['name'])) {
                         $input['value'] = $s;
                     }
                     if ($nobr) {
                         $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                     } else {
                         $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                     }
                     break;
                 case 'combobox':
                     // TODO: moACDROPDOWN
                     $values = $input['value'];
                     unset($input['value']);
                     $input['type'] = 'text';
                     if (is_string($values)) {
                         $values = explode(",", $values);
                     }
                     if (empty($values)) {
                         if ($input['method']) {
                             $input['value'] = xmlrequest($input['method']);
                         } elseif ($s = $request->getArg($input['name'])) {
                             $input['value'] = $s;
                         }
                     } elseif (is_array($values)) {
                         $name = $input['name'];
                         unset($input['name']);
                         foreach ($values as $val) {
                             $input = array('value' => $val);
                             if ($request->getArg($name)) {
                                 if ($request->getArg($name) == $val) {
                                     $input['selected'] = 'selected';
                                 } else {
                                     unset($input['selected']);
                                 }
                             }
                             //$select->pushContent(HTML::option($input, $val));
                         }
                     }
                     if ($nobr) {
                         $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                     } else {
                         $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                     }
                     break;
                 case 'pulldown':
                     $values = $input['value'];
                     unset($input['value']);
                     unset($input['type']);
                     $select = HTML::select($input);
                     if (is_string($values)) {
                         $values = explode(",", $values);
                     }
                     if (empty($values) and $s = $request->getArg($input['name'])) {
                         $select->pushContent(HTML::option(array('value' => $s), $s));
                     } elseif (is_array($values)) {
                         $name = $input['name'];
                         unset($input['name']);
                         foreach ($values as $val) {
                             $input = array('value' => $val);
                             if ($request->getArg($name)) {
                                 if ($request->getArg($name) == $val) {
                                     $input['selected'] = 'selected';
                                 } else {
                                     unset($input['selected']);
                                 }
                             }
                             $select->pushContent(HTML::option($input, $val));
                         }
                     }
                     $form->pushContent($text, $nbsp, $select);
                     break;
                 case 'reset':
                 case 'hidden':
                     $form->pushContent(HTML::input($input));
                     break;
                     // change the order of inputs, by explicitly placing a submit button here.
                 // change the order of inputs, by explicitly placing a submit button here.
                 case 'submit':
                     //$input['type'] = 'submit';
                     if (empty($input['value'])) {
                         $input['value'] = $buttontext ? $buttontext : $action;
                     }
                     unset($input['text']);
                     if (empty($input['class'])) {
                         $input['class'] = $class;
                     }
                     if ($nobr) {
                         $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                     } else {
                         $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                     }
                     // unset the default submit button
                     $already_submit = 1;
                     break;
             }
         }
     }
     if ($request->getArg('start_debug')) {
         $form->pushContent(HTML::input(array('name' => 'start_debug', 'value' => $request->getArg('start_debug'), 'type' => 'hidden')));
     }
     if (!USE_PATH_INFO) {
         $form->pushContent(HiddenInputs(array('pagename' => $basepage)));
     }
     if (!$already_submit) {
         if (empty($buttontext)) {
             $buttontext = $action;
         }
         $submit = Button('submit:', $buttontext, $class);
         if ($cancel) {
             $form->pushContent(HTML::span(array('class' => $class), $submit, Button('submit:cancel', _("Cancel"), $class)));
         } else {
             $form->pushContent(HTML::span(array('class' => $class), $submit));
         }
     }
     return $form;
 }
コード例 #11
0
ファイル: checkbox.php プロジェクト: brussens/cogear2
<label class="checkbox"><?php 
echo HTML::input($element->options);
?>
 <?php 
echo $element->text;
?>
</label>
コード例 #12
0
<?php

/*
 * Client module for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-client
 * @package   hipanel-module-client
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
 */
use hipanel\grid\GridView;
use yii\helpers\Html;
use yii\widgets\Pjax;
$this->title = 'Set language';
$this->params['breadcrumbs'][] = $this->title;
echo Html::beginForm(['set-credit'], 'POST');
if (!Yii::$app->request->isAjax) {
    echo Html::submitButton(Yii::t('hipanel', 'Submit'), ['class' => 'btn btn-primary']);
}
if (!Yii::$app->request->isAjax) {
    echo Html::submitButton(Yii::t('hipanel', 'Cancel'), ['type' => 'cancel', 'class' => 'btn btn-success', 'onClick' => 'history.back()']);
}
Pjax::begin();
$widgetIndexConfig = ['dataProvider' => $dataProvider, 'columns' => [['label' => Yii::t('hipanel', 'Client'), 'format' => 'raw', 'value' => function ($data) {
    return HTML::input('hidden', "ids[{$data->id}][Client][id]", $data->id, ['readonly' => 'readonly']) . HTML::tag('span', $data->login);
}], ['label' => Yii::t('hipanel', 'Language'), 'format' => 'raw', 'value' => function ($data) {
    return Html::dropDownList("ids[{$data->id}}][Client][language]", $data->language, \hipanel\models\Ref::getList('type,lang', 'hipanel'));
}]]];
echo GridView::widget($widgetIndexConfig);
Pjax::end();
echo Html::endForm();
コード例 #13
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     //if ($request->getArg('action') != 'browse')
     //    return $this->disabled("(action != 'browse')");
     $args = $this->getArgs($argstr, $request);
     $this->_args = $args;
     extract($args);
     $this->preSelectS($args, $request);
     $info = $args['info'];
     $this->debug = $args['debug'];
     // array_multisort($this->_list, SORT_NUMERIC, SORT_DESC);
     $pagename = $request->getArg('pagename');
     // GetUrlToSelf() with all given params
     //$uri = $GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI']; // without s would be better.
     //$uri = $request->getURLtoSelf();//false, array('verify'));
     $form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'POST'));
     if ($request->getArg('WikiAdminSelect') == _("Go")) {
         $p = false;
     } else {
         $p = $request->getArg('p');
     }
     //$p = @$GLOBALS['HTTP_POST_VARS']['p'];
     $form->pushContent(HTML::p(array('class' => 'wikitext'), _("Select: "), HTML::input(array('type' => 'text', 'name' => 's', 'value' => $args['s'])), HTML::input(array('type' => 'submit', 'name' => 'WikiAdminSelect', 'value' => _("Go")))));
     if ($request->isPost() && !$request->getArg('wikiadmin') && !empty($p)) {
         $this->_list = array();
         // List all selected pages again.
         foreach ($p as $page => $name) {
             $this->_list[$name] = 1;
         }
     } elseif ($request->isPost() and $request->_user->isAdmin() and !empty($p) and $request->getArg('action') == 'WikiAdminSelect' and $request->getArg('wikiadmin')) {
         // handle external plugin
         $loader = new WikiPluginLoader();
         $a = array_keys($request->getArg('wikiadmin'));
         $plugin_action = $a[0];
         $single_arg_plugins = array("Remove");
         if (in_array($plugin_action, $single_arg_plugins)) {
             $plugin = $loader->getPlugin($plugin_action);
             $ul = HTML::ul();
             foreach ($p as $page => $name) {
                 $plugin_args = "run_page={$name}";
                 $request->setArg($plugin_action, 1);
                 $request->setArg('p', array($page => $name));
                 // if the plugin requires more args than the pagename,
                 // then this plugin will not return. (Rename, SearchReplace, ...)
                 $action_result = $plugin->run($dbi, $plugin_args, $request, $basepage);
                 $ul->pushContent(HTML::li(fmt("Selected page '%s' passed to '%s'.", $name, $select)));
                 $ul->pushContent(HTML::ul(HTML::li($action_result)));
             }
         } else {
             // redirect to the plugin page.
             // in which page is this plugin?
             $plugin_action = preg_replace("/^WikiAdmin/", "", $plugin_action);
             $args = array();
             foreach ($p as $page => $x) {
                 $args["p[{$page}]"] = 1;
             }
             header("Location: " . WikiURL(_("PhpWikiAdministration") . "/" . _($plugin_action), $args, 1));
             exit;
         }
     } elseif (empty($args['s'])) {
         // List all pages to select from.
         $this->_list = $this->collectPages($this->_list, $dbi, $args['sortby'], $args['limit']);
     }
     $pagelist = new PageList_Selectable($info, $args['exclude'], $args);
     $pagelist->addPageList($this->_list);
     $form->pushContent($pagelist->getContent());
     foreach ($args as $k => $v) {
         if (!in_array($k, array('s', 'WikiAdminSelect', 'action', 'verify'))) {
             $form->pushContent(HiddenInputs(array($k => $v)));
         }
         // plugin params
     }
     /*
     foreach ($_GET as $k => $v) {
         if (!in_array($k,array('s','WikiAdminSelect','action')))
             $form->pushContent(HiddenInputs(array($k => $v))); // debugging params, ...
     }
     */
     if (!$request->getArg('verify')) {
         $form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'action', 'value' => 'verify')));
         $form->pushContent(Button('submit:verify', _("Select pages"), 'wikiadmin'), Button('submit:cancel', _("Cancel"), 'button'));
     } else {
         global $WikiTheme;
         $form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'action', 'value' => 'WikiAdminSelect')));
         // Add the Buttons for all registered WikiAdmin plugins
         $plugin_dir = 'lib/plugin';
         if (defined('PHPWIKI_DIR')) {
             $plugin_dir = PHPWIKI_DIR . "/{$plugin_dir}";
         }
         $fs = new fileSet($plugin_dir, 'WikiAdmin*.php');
         $actions = $fs->getFiles();
         foreach ($actions as $f) {
             $f = preg_replace('/.php$/', '', $f);
             $s = preg_replace('/^WikiAdmin/', '', $f);
             if (!in_array($s, array("Select", "Utils"))) {
                 // disable Select and Utils
                 $form->pushContent(Button("submit:wikiadmin[{$f}]", _($s), "wikiadmin"));
                 $form->pushContent($WikiTheme->getButtonSeparator());
             }
         }
         $form->pushContent(Button('submit:cancel', _("Cancel"), 'button'));
     }
     if (!$request->getArg('select')) {
         return $form;
     } else {
         //return $action_result;
     }
 }
コード例 #14
0
ファイル: tovars_block_view_3.php プロジェクト: kd-brinex/kd
_offer">
    <td class="offer-v3-name">
        <div class="offer-v3-code"><?php 
echo $model->tovar_id;
?>
</div>
        <h3><a href="<?php 
echo url::toRoute(['view', 'id' => $model->tovar_id], true);
?>
"><?php 
echo $model->tovarname;
?>
</a></h3>
    </td>
    <td class="offer-v3-store"><?php 
echo HTML::input('number', 'tovar_count', $model->tovar_count, ['size' => '3', 'min' => 1, 'max' => 10, 'id' => $model->tovar_id, 'onchange' => 'count(this)']);
?>
</td>

<!--    <td class="offer-v3-stock">8</td>-->
    <td class="offer-v3-price" id="<?php 
echo $model->tovar_id;
?>
_price"?><?php 
echo $model->tovar_price;
?>
</td>
<td class="offer-v3-price" id="<?php 
echo $model->tovar_id;
?>
_summa"?><?php 
コード例 #15
0
ファイル: WikiPoll.php プロジェクト: hugcoday/wiki
 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);
     }
 }
コード例 #16
0
ファイル: ExternalSearch.php プロジェクト: hugcoday/wiki
 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     if (empty($args['url'])) {
         return '';
     }
     extract($args);
     $posted = $GLOBALS['HTTP_POST_VARS'];
     if (in_array('url', array_keys($posted))) {
         $s = $posted['s'];
         $this->_url = $posted['url'];
         $this->_getInterWikiUrl($request);
         if (strstr($this->_url, '%s')) {
             $this->_url = sprintf($this->_url, $s);
         } else {
             $this->_url .= $s;
         }
         if (defined('DEBUG') && DEBUG && $debug) {
             trigger_error("redirect url: " . $this->_url);
         } else {
             $request->redirect($this->_url);
             //no return!
         }
     }
     $this->_name = $name;
     $this->_s = $s;
     if ($formsize < 1) {
         $formsize = 30;
     }
     $this->_url = $url;
     $this->_getInterWikiUrl($request);
     $form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('pagename' => $basepage)));
     $form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'url', 'value' => $this->_url)));
     $s = HTML::input(array('type' => 'text', 'value' => $this->_s, 'name' => 's', 'size' => $formsize));
     if (!empty($args["useimage"])) {
         //FIXME: This does not work with Gecko
         $button = HTML::img(array('src' => $useimage, 'alt' => 'imagebutton'));
         if (!empty($width)) {
             $button->setAttr('width', $width);
         }
         if (!empty($height)) {
             $button->setAttr('height', $height);
         }
         // on button_position => none display no input form
         if ($button_position == 'right') {
             $form->pushContent($s);
         }
         $form->pushContent(HTML::button(array('type' => 'button', 'class' => 'button', 'value' => $this->_name), $button));
         if ($button_position == 'left') {
             $form->pushContent($s);
         }
     } else {
         if ($button_position != 'left' and $button_position != 'right') {
             return $this->error(fmt("Invalid argument: %s=%s", 'button_position', $button_position));
         }
         $button = HTML::input(array('type' => 'submit', 'class' => 'button', 'value' => $this->_name));
         if ($button_position == 'left') {
             $form->pushContent($button);
             $form->pushContent($s);
         } elseif ($button_position == 'right') {
             $form->pushContent($s);
             $form->pushContent($button);
         }
     }
     return $form;
 }
コード例 #17
0
ファイル: WikiAdminChmod.php プロジェクト: pombredanne/tuleap
 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("&nbsp;"), _("Propagate new permissions to all subpages?"), HTML::raw("&nbsp;&nbsp;"), HTML::em(_("(disable individual page permissions, enable inheritance)?")));
     $header->pushContent(HTML::hr(), HTML::p());
     return $header;
 }
コード例 #18
0
 echo HTML::input("radio", "usuario_tipo", "fan", array("checked" => "checked"));
 echo HTML::label("musico", "Musico");
 echo HTML::input("radio", "usuario_tipo", "musico");
 echo HTML::label("local", "Local");
 echo HTML::input("radio", "usuario_tipo", "local");
 echo HTML::open_div(array("class" => "form-group"));
 echo HTML::input("text", "usuario_nombre_usuario", null, array("class" => "form-control", "placeholder" => "Nombre de usuario"));
 echo HTML::close_div();
 echo HTML::open_div(array("class" => "form-group"));
 echo HTML::input("email", "usuario_email", null, array("class" => "form-control", "placeholder" => "*****@*****.**"));
 echo HTML::close_div();
 echo HTML::open_div(array("class" => "form-group"));
 echo HTML::input("password", "usuario_contrasena", null, array("class" => "form-control", "placeholder" => "········"));
 echo HTML::close_div();
 echo HTML::open_div(array("class" => "form-group"));
 echo HTML::input("password", "usuario_contrasena_repeat", null, array("class" => "form-control", "placeholder" => "········"));
 echo HTML::close_div();
 echo HTML::open_div(array("class" => "form-group"));
 echo HTML::open_div(array("class" => "row"));
 echo HTML::open_div(array("class" => "col-xs-6 col-xs-offset-3"));
 echo HTML::button_HTML5("submit", "Registrarme!", "register", array("class" => "form-control btn btn-info"));
 echo HTML::close_div();
 echo HTML::close_div();
 echo HTML::close_div();
 echo HTML::close_form();
 ?>
                         </div>
                     </ul>
                 </li>
                 <li class="dropdown">
                     <a class="dropdown-toggle" data-toggle="dropdown">Entrar <span class="caret"></span></a>
コード例 #19
0
ファイル: PhpWeather.php プロジェクト: hugcoday/wiki
 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;
 }
コード例 #20
0
ファイル: WikiAdminSetAcl.php プロジェクト: hugcoday/wiki
 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("&nbsp;&nbsp;"), HTML::em(_("(disable individual page permissions, enable inheritance)?")), HTML::br(), HTML::em(_("(Currently not working)")));
     }
     $header->pushContent(HTML::hr());
     return $header;
 }
コード例 #21
0
ファイル: login.php プロジェクト: neferketer/whymusic.es
        foreach ($login->errors as $error) {
            echo HTML::open_div(array("class" => "form-group has-error"));
            echo HTML::label("usuario_nombre_usuario", $error, array("class" => "control-label"));
            echo HTML::close_div();
        }
    }
    if ($login->messages) {
        foreach ($login->messages as $message) {
            echo HTML::open_div(array("class" => "form-group has-error"));
            echo HTML::label("usuario_nombre_usuario", $message, array("class" => "control-label"));
            echo HTML::close_div();
        }
    }
}
if ($login->isUserLoggedIn() == true) {
    ROUTER::redirect_to_action("account/user");
} else {
    echo ROUTER::create_action_url("account/login");
    echo HTML::open_div(array("id" => "login"));
    echo HTML::open_form(ROUTER::create_action_url('account/login'), "POST", "form_login");
    echo HTML::label("usuario_nombre_usuario", "Introduce tu nombre de usuario");
    echo HTML::input("text", "usuario_nombre_usuario", null, array("placeholder" => "Introduce tu nombre de usuario"));
    echo HTML::label("usuario_contrasena", "Introduce tu contraseña");
    echo HTML::input("password", "usuario_contrasena", null, array("placeholder" => "········"));
    echo HTML::label("usuario_recuerdame", "Recordar session?");
    echo HTML::checkbox("usuario_recuerdame", "usuario_recuerdame", false);
    echo HTML::button_HTML5("submit", "Entrar!", "login");
    echo HTML::close_form();
    echo HTML::close_div();
    echo HTML::br(3);
}
コード例 #22
0
ファイル: SemanticSearch.php プロジェクト: hugcoday/wiki
 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('&nbsp;');
     $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);
 }
コード例 #23
0
ファイル: UpLoad.php プロジェクト: hugcoday/wiki
 function run($dbi, $argstr, &$request, $basepage)
 {
     $this->allowed_extensions = explode("\n", "7z\navi\nbmp\nbz2\nc\ncfg\ndiff\ndoc\ndocx\nflv\ngif\nh\nics\nini\njpeg\njpg\nkmz\nmp3\nodg\nodp\nods\nodt\nogg\npatch\npdf\npng\nppt\npptx\nrar\nsvg\ntar\ntar.gz\ntxt\nxls\nxlsx\nxml\nxsd\nzip");
     $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\\d?\nphtml\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();
     $file_dir .= "/";
     $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)));
     $contents->pushContent(HTML::input(array('name' => 'userfile', 'type' => 'file', 'size' => $size)));
     if ($mode == 'edit') {
         $contents->pushContent(HTML::input(array('name' => 'action', 'type' => 'hidden', 'value' => 'edit')));
         $contents->pushContent(HTML::raw(" "));
         $contents->pushContent(HTML::input(array('value' => _("Upload"), 'name' => 'edit[upload]', 'type' => 'submit')));
     } else {
         $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()) {
             if (defined('FUSIONFORGE') and FUSIONFORGE) {
                 $message->pushContent(HTML::div(array('class' => 'error'), HTML::p(_("You cannot upload files.")), HTML::ul(HTML::li(_("Check you are logged in.")), HTML::li(_("Check you are in the right project.")), HTML::li(_("Check you are a member of the current project.")))));
             } else {
                 $message->pushContent(HTML::div(array('class' => 'error'), HTML::p(_("ACCESS DENIED: You must log in to upload files."))));
             }
             $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));
         if (UPLOAD_USERDIR) {
             $file_dir .= $request->_user->_userid;
             if (!file_exists($file_dir)) {
                 mkdir($file_dir, 0775);
             }
             $file_dir .= "/";
             $u_userfile = $request->_user->_userid . "/" . $userfile_name;
         } else {
             $u_userfile = $userfile_name;
         }
         $u_userfile = preg_replace("/ /", "%20", $u_userfile);
         $userfile_tmpname = $userfile->getTmpName();
         $err_header = HTML::div(array('class' => 'error'), HTML::p(fmt("ERROR uploading '%s'", $userfile_name)));
         if (preg_match("/(\\." . join("|\\.", $this->disallowed_extensions) . ")(\\.|\$)/i", $userfile_name)) {
             $message->pushContent($err_header);
             $message->pushContent(HTML::p(fmt("Files with extension %s are not allowed.", join(", ", $this->disallowed_extensions))));
         } elseif (!DISABLE_UPLOAD_ONLY_ALLOWED_EXTENSIONS and !preg_match("/(\\." . join("|\\.", $this->allowed_extensions) . ")\$/i", $userfile_name)) {
             $message->pushContent($err_header);
             $message->pushContent(HTML::p(fmt("Only files with the extension %s are allowed.", join(", ", $this->allowed_extensions))));
         } elseif (preg_match("/[^._a-zA-Z0-9- ]/", strip_accents($userfile_name))) {
             $message->pushContent($err_header);
             $message->pushContent(HTML::p(_("Invalid filename. File names may only contain alphanumeric characters and dot, underscore, space or dash.")));
         } elseif (file_exists($file_dir . $userfile_name)) {
             $message->pushContent($err_header);
             $message->pushContent(HTML::p(fmt("There is already a file with name %s uploaded.", $u_userfile)));
         } elseif ($userfile->getSize() > MAX_UPLOAD_SIZE) {
             $message->pushContent($err_header);
             $message->pushContent(HTML::p(_("Sorry but this file is too big.")));
         } elseif (move_uploaded_file($userfile_tmpname, $file_dir . $userfile_name) or IsWindows() and rename($userfile_tmpname, $file_dir . $userfile_name)) {
             $interwiki = new PageType_interwikimap();
             $link = $interwiki->link("Upload:{$u_userfile}");
             $message->pushContent(HTML::div(array('class' => 'feedback'), HTML::p(_("File successfully uploaded.")), HTML::p($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:{$u_userfile}";
                     // don't inline images
                     $meta = $current->_data;
                     $meta['summary'] = sprintf(_("uploaded %s"), $u_userfile);
                     $pagehandle->save($newtext, $version + 1, $meta);
                 }
             }
         } else {
             $message->pushContent($err_header);
             $message->pushContent(HTML::br(), _("Uploading failed."), HTML::br());
         }
     } else {
         $message->pushContent(HTML::br(), _("No file selected. Please select one."), HTML::br());
     }
     //$result = HTML::div( array( 'class' => 'wikiaction' ) );
     $result = HTML();
     $result->pushContent($form);
     $result->pushContent($message);
     return $result;
 }
コード例 #24
0
ファイル: upgrade.php プロジェクト: pombredanne/tuleap
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('&nbsp;'), Button("submit:dbadmin[cancel]", _("Cancel"), 'button')))));
        $form->printXml();
        echo "</div><!-- content -->\n";
        echo asXML(Template("bottom"));
        echo "</body></html>\n";
        $request->finish();
        exit;
    }
}
コード例 #25
0
ファイル: WikiAdminChown.php プロジェクト: pombredanne/tuleap
 function chownForm(&$header, $post_args)
 {
     $header->pushContent(_("Chown") . " ");
     $header->pushContent(' ' . _("to") . ': ');
     $header->pushContent(HTML::input(array('name' => 'admin_chown[user]', 'value' => $post_args['user'])));
     $header->pushContent(HTML::p());
     return $header;
 }
コード例 #26
0
ファイル: editpage.php プロジェクト: nterray/tuleap
 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;
 }
コード例 #27
0
ファイル: form.php プロジェクト: hutchike/plumline
</td>
</tr>
<tr>
    <td class="align-right">Country</td>
    <td><?php 
echo HTML::input('message->country', array('class' => 'input-field'));
?>
 <?php 
echo HTML::validation_message('message->country');
?>
</td>
</tr>
<tr>
    <td class="align-right">Timezone</td>
    <td><?php 
echo HTML::input('message->timezone', array('class' => 'input-field'));
?>
 <?php 
echo HTML::validation_message('message->timezone');
?>
</td>
</tr>
<tr>
    <td class="align-right">Preferred meeting</td>
    <td><?php 
echo HTML::select('message->meeting', array('No preference / Not sure', 'Monday 11am Central (GMT-6)', 'Monday 7pm Central (GMT-6)', 'Thursday 9am GMT', 'All meetings'), $message->meeting, array('class' => 'input-field'));
?>
 <?php 
echo HTML::validation_message('message->meeting');
?>
</td>
コード例 #28
0
ファイル: image.php プロジェクト: romartyn/cogear
<?if($value):?>
<div class="image-preview"><?php 
echo HTML::img($value, '', $image);
?>
<a href="<?php 
echo Ajax::link(array('action' => 'replace', 'form' => $form->name, 'element' => $element->name));
?>
" class="form-action delete">x</a></div>
<?endif;?>
<?php 
echo HTML::input($attributes);
コード例 #29
0
ファイル: html.php プロジェクト: huseyinduygun/flexi
 public static function hidden($name = '', $value = '')
 {
     return HTML::input('hidden')->name($name)->value($value);
 }
コード例 #30
0
ファイル: HTML.php プロジェクト: levmorozov/mii
 /**
  * Creates a submit form input.
  *
  *     echo Form::submit(NULL, 'Login');
  *
  * @param   string  $name       input name
  * @param   string  $value      input value
  * @param   array   $attributes html attributes
  * @return  string
  * @uses    Form::input
  */
 public static function submit($name, $value, array $attributes = NULL)
 {
     $attributes['type'] = 'submit';
     return HTML::input($name, $value, $attributes);
 }