Пример #1
0
     if (tinyd_check_browser_can_use_spaw()) {
         ob_start();
         $sw = new SPAW_Wysiwyg('message', $message);
         $sw->show();
         $form->addElement(new XoopsFormLabel(_TC_CONTENT, ob_get_contents()));
         ob_end_clean();
         $spaw_flag = true;
     }
 }
 if (!$spaw_flag) {
     if (empty($_GET['useplain'])) {
         $t_area = new XoopsFormDhtmlTextArea(_TC_CONTENT, 'message', htmlspecialchars($message, ENT_QUOTES), $body_tarea_height, $tarea_width);
     } else {
         $t_area = new XoopsFormTextArea(_TC_CONTENT . "<br /><br /><br /><br /><a href='{$mymodurl}/admin/text_wiki_sample.php?lang={$xoopsConfig['language']}' target='_blak'>Text_Wiki Sample</a>", 'message', htmlspecialchars($message, ENT_QUOTES), $body_tarea_height, $tarea_width);
     }
     $t_area->setExtra("style='width: {$tarea_width}em;'");
     $form->addElement($t_area);
 }
 // options
 $option_tray = new XoopsFormElementTray(_OPTIONS, '<br />');
 // smiley
 $smiley_checkbox = new XoopsFormCheckBox('', 'nosmiley', $nosmiley);
 $smiley_checkbox->addOption(1, _DISABLESMILEY);
 $option_tray->addElement($smiley_checkbox);
 // nobreaks
 if ($spaw_flag) {
     $form->addElement(new XoopsFormHidden('nobreaks', 1));
 } else {
     $breaks_checkbox = new XoopsFormCheckBox('', 'nobreaks', $nobreaks);
     $breaks_checkbox->addOption(1, _TC_DISABLEBREAKS);
     $option_tray->addElement($breaks_checkbox);
Пример #2
0
if ( !$entryID && !$definition) // therez no entryID? Then itz a new entry
	{
	$definition = constant("_MD_{$MYDIRNAME}_WRITEHERE");
	}

if ( $xoopsModuleConfig['dhtmluse'] == '1' )
	{
	$def_block = new XoopsFormDhtmlTextArea( constant("_MD_{$MYDIRNAME}_DEFINITION").constant("_MD_{$MYDIRNAME}_DONTUSETAG"), 'definition', $definition, 10, 40 );
	}
else
	{
	$def_block = new XoopsFormTextArea( constant("_MD_{$MYDIRNAME}_DEFINITION").constant("_MD_{$MYDIRNAME}_DONTUSETAG"), 'definition', $definition, 10, 40 );
	}

$def_block -> setExtra( 'onfocus="this.select()"' );
$sform -> addElement ( $def_block );

$sform -> addElement( new XoopsFormTextArea( constant("_MD_{$MYDIRNAME}_REFERENCE"), 'ref', $ref, 5, 40 ), false );
$sform -> addElement( new XoopsFormText( constant("_MD_{$MYDIRNAME}_URL"), 'url', 40, 80, $url ), false );

$button_tray = new XoopsFormElementTray( '', '' );

if ( is_object( $xoopsUser ) )
	{
	$uid = $xoopsUser->getVar('uid');
	$hidden_uid = new XoopsFormHidden( 'uid', intval($uid) );
	$button_tray -> addElement( $hidden_uid );

	if ( $xoopsUser->isAdmin($xoopsModule->getVar('mid')) )
		{
Пример #3
0
function hypconfShowForm($config)
{
    global $constpref, $mydirname, $mydirpath, $mytrustdirpath, $page, $xoopsConfig, $xoopsGTicket;
    if (!$config) {
        die('no configs');
    }
    if (isset($config['error'])) {
        echo '<div class="error">' . join('</div><div class="error">', $config['error']) . '</div>';
        unset($config['error']);
    }
    if (isset($config['contents'])) {
        echo $config['contents'];
        unset($config['contents']);
    }
    $underContents = '';
    if (isset($config['underContents'])) {
        $underContents = $config['underContents'];
        unset($config['underContents']);
    }
    if ($config) {
        $count = count($config);
        include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
        include_once dirname(dirname(__FILE__)) . '/class/formcheckbox.php';
        if (!XC_CLASS_EXISTS('XoopsFormBreak')) {
            include_once dirname(dirname(__FILE__)) . '/class/formbreak.php';
        }
        $form = new XoopsThemeForm(hypconf_constant($constpref . '_ADMENU_' . strtoupper($page)), 'pref_form', 'index.php');
        $button_tray = new XoopsFormElementTray("");
        for ($i = 0; $i < $count; $i++) {
            $description = defined($config[$i]['description']) ? constant($config[$i]['description']) : '';
            //$title4tray = (!$description) ? hypconf_constant($config[$i]['title']) : hypconf_constant($config[$i]['title']).'<br /><br /><span style="font-weight:normal;">'.hypconf_constant($config[$i]['description']).'</span>'; // GIJ
            $title4tray = hypconf_constant($config[$i]['title']);
            $title = '';
            // GIJ
            switch ($config[$i]['formtype']) {
                case 'textarea':
                    (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
                    if ($config[$i]['valuetype'] == 'array') {
                        // this is exceptional.. only when value type is arrayneed a smarter way for this
                        $ele = $config[$i]['value'] != '' ? new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars(implode('|', $config[$i]['value'], _CHARSET)), 5, 50) : new XoopsFormTextArea($title, $config[$i]['name'], '', 5, 50);
                    } else {
                        $ele = new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars($config[$i]['value'], ENT_COMPAT, _CHARSET), 5, 50);
                        $ele->setExtra('class="norich plain" spellcheck="false"');
                    }
                    break;
                case 'select':
                    $size = 1;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size);
                    $options = $config[$i]['options'];
                    $opcount = count($options);
                    //var_dump($options);
                    foreach ($options as $option) {
                        if (isset($option['confop_value']) && isset($option['confop_name'])) {
                            $optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
                            $optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
                        } else {
                            $optval = $optkey = $option;
                        }
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'select_multi':
                    $size = 5;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size, true);
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'check':
                    $ele = new HypconfFormCheckBox($title, $config[$i]['name'], $config[$i]['value']);
                    if (!empty($config[$i]['width'])) {
                        //$ele->setWidth($config[$i]['width']);
                    }
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? hypconf_constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? hypconf_constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'radio':
                    $ele = new XoopsFormRadio($title, $config[$i]['name'], $config[$i]['value']);
                    if (!empty($config[$i]['width'])) {
                        //$ele->setWidth($config[$i]['width']);
                    }
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? hypconf_constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? hypconf_constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'yesno':
                    $ele = new XoopsFormRadioYN($title, $config[$i]['name'], $config[$i]['value'], _YES, _NO);
                    break;
                case 'password':
                    $size = 50;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
                    $ele = new XoopsFormPassword($title, $config[$i]['name'], $size, 255, $myts->htmlspecialchars($config[$i]['value'], ENT_COMPAT, _CHARSET));
                    break;
                case 'label':
                    $ele = new XoopsFormLabel($title, $description);
                    $description = '';
                    break;
                case 'theme':
                case 'theme_multi':
                    $ele = $config[$i]['formtype'] !== 'theme_multi' ? new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value']) : new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], 5, true);
                    $handle = opendir(XOOPS_THEME_PATH . '/');
                    $dirlist = array();
                    while (false !== ($file = readdir($handle))) {
                        if (is_dir(XOOPS_THEME_PATH . '/' . $file) && !preg_match("/^\\..*\$/", $file) && strtolower($file) != 'cvs') {
                            $dirlist[$file] = $file;
                        }
                    }
                    closedir($handle);
                    $ele->addOption('', hypconf_constant($constpref . '_NOT_SPECIFY'));
                    if (!empty($dirlist)) {
                        asort($dirlist);
                        $ele->addOptionArray($dirlist);
                    }
                    break;
                case 'tplset':
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value']);
                    $tplset_handler =& xoops_gethandler('tplset');
                    $tplsetlist =& $tplset_handler->getList();
                    asort($tplsetlist);
                    $ele->addOption('', hypconf_constant($constpref . '_NOT_SPECIFY'));
                    foreach ($tplsetlist as $key => $name) {
                        $ele->addOption($key, htmlspecialchars($name, ENT_QUOTES, _CHARSET));
                    }
                    break;
                case 'textbox':
                default:
                    $size = 50;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
                    $ele = new XoopsFormText($title, $config[$i]['name'], $size, 255, $myts->htmlspecialchars($config[$i]['value'], ENT_COMPAT, _CHARSET));
                    if ($config[$i]['valuetype'] === 'int') {
                        $ele->setExtra(' style="text-align:right;"');
                    }
                    break;
            }
            $ele_tray = new XoopsFormElementTray($title4tray, '');
            $ele_tray->addElement($ele);
            $form->addElement($ele_tray);
            if ($description) {
                $form->insertBreak('<span style="font-weight:normal;">' . $description . '</span>', 'odd');
            }
            unset($ele_tray);
            unset($ele);
        }
        $button_tray->addElement(new XoopsFormHidden('op', 'save'));
        $button_tray->addElement(new XoopsFormHidden('page', $page));
        $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'hypconf');
        $button_tray->addElement(new XoopsFormButton('', 'button', _GO, 'submit'));
        $form->addElement($button_tray);
        $form->display();
    }
    if ($underContents) {
        echo '<div>' . $underContents . '</div>';
    }
}
Пример #4
0
function hypconfShowForm($config)
{
    global $constpref, $mydirname, $mydirpath, $mytrustdirpath, $page, $xoopsConfig, $xoopsGTicket;
    if (!$config) {
        die('no configs');
    }
    if (isset($config['error'])) {
        echo '<div class="error">' . join('</div><div class="error">', $config['error']) . '</div>';
        unset($config['error']);
    }
    if (isset($config['contents'])) {
        echo $config['contents'];
        unset($config['contents']);
    }
    if ($config) {
        $count = count($config);
        include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
        include_once dirname(dirname(__FILE__)) . '/class/formcheckbox.php';
        if (!XC_CLASS_EXISTS('XoopsFormBreak')) {
            include_once dirname(dirname(__FILE__)) . '/class/formbreak.php';
        }
        $form = new XoopsThemeForm(hypconf_constant($constpref . '_ADMENU_' . strtoupper($page)), 'pref_form', 'index.php');
        $button_tray = new XoopsFormElementTray("");
        for ($i = 0; $i < $count; $i++) {
            $description = defined($config[$i]['description']) ? constant($config[$i]['description']) : '';
            //$title4tray = (!$description) ? hypconf_constant($config[$i]['title']) : hypconf_constant($config[$i]['title']).'<br /><br /><span style="font-weight:normal;">'.hypconf_constant($config[$i]['description']).'</span>'; // GIJ
            $title4tray = hypconf_constant($config[$i]['title']);
            $title = '';
            // GIJ
            switch ($config[$i]['formtype']) {
                case 'textarea':
                    $myts =& MyTextSanitizer::getInstance();
                    if ($config[$i]['valuetype'] == 'array') {
                        // this is exceptional.. only when value type is arrayneed a smarter way for this
                        $ele = $config[$i]['value'] != '' ? new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars(implode('|', $config[$i]['value'])), 5, 50) : new XoopsFormTextArea($title, $config[$i]['name'], '', 5, 50);
                    } else {
                        $ele = new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars($config[$i]['value']), 5, 50);
                        $ele->setExtra('class="norich"');
                    }
                    break;
                case 'select':
                    $size = 1;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size);
                    $options = $config[$i]['options'];
                    $opcount = count($options);
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'select_multi':
                    $size = 5;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size, true);
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'check':
                    $ele = new HypconfFormCheckBox($title, $config[$i]['name'], $config[$i]['value']);
                    if (!empty($config[$i]['width'])) {
                        //$ele->setWidth($config[$i]['width']);
                    }
                    $options = $config[$i]['options'];
                    foreach ($options as $option) {
                        $optval = defined($option['confop_value']) ? hypconf_constant($option['confop_value']) : $option['confop_value'];
                        $optkey = defined($option['confop_name']) ? hypconf_constant($option['confop_name']) : $option['confop_name'];
                        $ele->addOption($optval, $optkey);
                    }
                    break;
                case 'yesno':
                    $ele = new XoopsFormRadioYN($title, $config[$i]['name'], $config[$i]['value'], _YES, _NO);
                    break;
                case 'password':
                    $size = 50;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $myts =& MyTextSanitizer::getInstance();
                    $ele = new XoopsFormPassword($title, $config[$i]['name'], $size, 255, $myts->htmlspecialchars($config[$i]['value']));
                    break;
                case 'textbox':
                default:
                    $size = 50;
                    if (!empty($config[$i]['size'])) {
                        $size = $config[$i]['size'];
                    }
                    $myts =& MyTextSanitizer::getInstance();
                    $ele = new XoopsFormText($title, $config[$i]['name'], $size, 255, $myts->htmlspecialchars($config[$i]['value']));
                    if ($config[$i]['valuetype'] === 'int') {
                        $ele->setExtra(' style="text-align:right;"');
                    }
                    break;
            }
            $ele_tray = new XoopsFormElementTray($title4tray, '');
            $ele_tray->addElement($ele);
            $form->addElement($ele_tray);
            if ($description) {
                $form->insertBreak('<span style="font-weight:normal;">' . $description . '</span>', 'odd');
            }
            unset($ele_tray);
            unset($ele);
        }
        $button_tray->addElement(new XoopsFormHidden('op', 'save'));
        $button_tray->addElement(new XoopsFormHidden('page', $page));
        $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'hypconf');
        $button_tray->addElement(new XoopsFormButton('', 'button', _GO, 'submit'));
        $form->addElement($button_tray);
        $form->display();
    }
}
Пример #5
0
    $fromemail_text = new XoopsFormText(_MI_TAF_FORMTHFROMEMAIL, "fromEmail", 40, 100, '');
    $fromemail_text->setExtra($styleWidth);
    $_SESSION['usersSubject'] = $subject;
    $subject_text = new XoopsFormLabel(_MI_TAF_FORMTHSUBJ, $subject4show);
    $subject_text->setExtra($styleWidth);
} else {
    $subject_text = new XoopsFormText(_MI_TAF_FORMTHSUBJ, "usersSubject", 50, 100, $subject4show);
    $subject_text->setExtra($styleWidth);
}
$to_text = new XoopsFormText(_MI_TAF_FORMTHTO, "usersTo", 40, 100, '');
$to_text->setExtra($styleWidth);
$body_label = new XoopsFormLabel(_MI_TAF_FORMTHBODY, nl2br($comment4show));
$body_label->setExtra($styleWidth);
$body_hidden = new XoopsFormHidden("usersComments", $comment4show);
$comment_textarea = new XoopsFormTextArea(_MI_TAF_FORMTHBODY, "usersComments", $comment4show, 10, 40);
$comment_textarea->setExtra($styleWidth);
$ticket_hidden = $xoopsGTicket->getTicketXoopsForm(__LINE__);
$submit_button = new XoopsFormButton("", "submit", _MI_TAF_BUTTONSEND, "submit");
$contact_form = new XoopsThemeForm(_MI_TAF_FORMTITLE, "tf_form", "index.php");
$contact_form->addElement($to_text, true);
if (!is_object($xoopsUser)) {
    $contact_form->addElement($fromname_text, true);
    $contact_form->addElement($fromemail_text, true);
}
$contact_form->addElement($subject_text);
if ($xoopsModuleConfig['can_bodyedit']) {
    $contact_form->addElement($comment_textarea, true);
} else {
    $contact_form->addElement($body_label);
    $contact_form->addElement($body_hidden);
}