<td width="10%"><?php 
        echo TEXT_CC;
        ?>
</td>
										  <td width="90%"><?php 
        echo olc_draw_textarea_field('cc', 'soft', '100%', '3', $newsletters_data['cc']);
        ?>
</td>
										</tr>
							      <tr>
								      <td width="10%" valign="top"><?php 
        echo TEXT_BODY;
        ?>
</td>
								      <td width="90%"><?php 
        $sw = new SPAW_Wysiwyg($control_name = 'newsletter_body', $value = stripslashes($newsletters_data['body']), $lang = EMPTY_STRING, $mode = 'full', $theme = 'default', $width = '100%', $height = '800px', $css_stylesheet = SPAW_STYLESHEET, $dropdown_data = EMPTY_STRING);
        $sw->show();
        ?>
								      </td>
								   </tr>
							   </table>
							   <a href="<?php 
        echo olc_href_link(FILENAME_MODULE_NEWSLETTER);
        ?>
">
							   <?php 
        echo olc_image_button('button_back.gif', IMAGE_BACK);
        ?>
</a>
							   <right><?php 
        echo olc_image_submit('button_save.gif', IMAGE_SAVE);
    $use_spaw = false;
}
// $use_koivi = $GLOBALS['wp_use_koivi'];
$smilies = array();
foreach ($GLOBALS['wpsmiliestrans'][wp_id()] as $smiley => $img) {
    $smile['id'] = str_replace("'", "\\'", $smiley);
    $smile['path'] = $smilies_directory . '/' . $img;
    $smile['name'] = $smiley;
    $smilies[] = $smile;
}
if ($use_spaw) {
    include_once $spaw_root . "spaw_control.class.php";
    $trans_tbl = get_html_translation_table(HTML_SPECIALCHARS);
    $trans_tbl = array_flip($trans_tbl);
    $content = strtr($content, $trans_tbl);
    $sw = new SPAW_Wysiwyg('wp_content', $content, _LANGCODE, 'full', 'default', '70%', '400px');
    $spaw_form = $sw->getHtml();
    //} else if ($use_koivi) {
    //	include XOOPS_ROOT_PATH."/class/xoopsformloader.php";
    //	include_once 'wysiwyg/formwysiwygtextarea.php';
    //	$trans_tbl = get_html_translation_table (HTML_SPECIALCHARS);
    //	$trans_tbl = array_flip ($trans_tbl);
    //	$content = strtr ($content, $trans_tbl);
    //	$wysiwyg_text_area = new XoopsFormWysiwygTextArea( $caption, 'wp_content', $content, '100%', '400px','');
    //	$wysiwyg_text_area->setUrl(wp_siteurl()."/wp-admin/wysiwyg");
    //	$spaw_form = $wysiwyg_text_area->render();
} else {
    $spaw_form = "";
}
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));
$can_upload = get_settings('use_fileupload') && $user_level >= get_settings('fileupload_minlevel') && (in_array($user_login, $allowed_users) || trim(get_settings('fileupload_allowedusers')) == "");
Exemple #3
0
 function GetSPAW($fieldname = 'spaw', $fieldvalue = '', $width = '550px', $height = '150px', $style = 'default', $displayoutput = true)
 {
     global $control_name, $spaw_root, $spaw_dir, $spaw_default_lang, $spaw_dropdown_data;
     global $HTTP_SERVER_VARS, $HTTP_HOST, $DOCUMENT_ROOT;
     $available_styles = array("mini", "default", "classic");
     if (!in_array($style, $available_styles)) {
         $style = "mini";
     }
     $content = "";
     if ($this->spawcalled == false) {
         define('DR', "{$DOCUMENT_ROOT}/");
         $spaw_root = DR . 'components/spaw/';
         $spaw_dir = "/components/spaw/";
         //ob_start();
         include $spaw_root . "spaw_control.class.php";
         //$content .= ob_get_contents();
         //ob_end_clean();
         $this->spawcalled = true;
         //print "CALLING $fieldname SPAW";
     }
     $content .= "";
     //$content .= "<form name=xxx_$fieldname>";
     if ($style == "default" || $style == "classic") {
         $sw = new SPAW_Wysiwyg($fieldname, stripslashes($fieldvalue), 'en', 'full', $style, $width, $height);
     } elseif ($style == "mini") {
         $sw = new SPAW_Wysiwyg($fieldname, stripslashes($fieldvalue), 'en', 'mini', 'default', $width, $height, '');
     }
     $content .= $sw->show();
     //$content .= "</form name=xxx>";
     if ($displayoutput == true) {
         print $content;
     } else {
         return $content;
     }
 }
 function GetSPAW($fieldname = 'spaw', $fieldvalue = '', $width = '650px', $height = '200px', $style = 'default')
 {
     global $control_name, $spaw_root, $spaw_dir, $spaw_default_lang, $spaw_dropdown_data;
     global $HTTP_SERVER_VARS, $HTTP_HOST, $DOCUMENT_ROOT;
     $available_styles = array("mini", "default", "classic");
     if (!in_array($style, $available_styles)) {
         $style = "mini";
     }
     $content = "";
     if ($this->SPAW_called == false) {
         define('DR', "{$DOCUMENT_ROOT}/");
         $spaw_root = DR . 'components/spaw/';
         $spaw_dir = "/components/spaw/";
         include $spaw_root . "spaw_control.class.php";
         $this->SPAW_called = true;
     }
     if ($style == "default" || $style == "classic") {
         $sw = new SPAW_Wysiwyg($fieldname, stripslashes($fieldvalue), 'en', 'full', $style, $width, $height);
     } elseif ($style == "mini") {
         $sw = new SPAW_Wysiwyg($fieldname, stripslashes($fieldvalue), 'en', 'mini', 'default', $width, $height, '');
     }
     $content .= $sw->show();
     print $content;
 }
Exemple #5
0
 function main_page()
 {
     global $HTTP_POST_VARS;
     $test = "{$this->textarea_safe_code}";
     $sw = new SPAW_Wysiwyg('code', $test, 'eng', 'full', 'default', '100%', '450px');
     $suffix_list_selected[$this->Conf->Eval_suffix] = "SELECTED";
     while (list(, $suffix) = each($this->Conf->Eval_suffix_list)) {
         $suffix_select_options .= "<OPTION VALUE='{$suffix}' {$suffix_list_selected[$suffix]}>{$suffix}\n";
     }
     $ret .= "<DIV ALIGN='center'>\n";
     $ret .= "<H2>" . _CC_ED_TITLE2 . "</H2></DIV>\n";
     $ret .= "<FORM NAME='main_form' METHOD='POST' ACTION='{$GLOBALS['PHP_SELF']}'>\n";
     $ret .= "<INPUT TYPE='hidden' NAME='action' VALUE=''>\n";
     //$ret .= $sw->show();
     $ret .= "<INPUT TYPE='hidden' NAME='Current_file' VALUE='{$this->Conf->Current_file}'>\n";
     $ret .= $this->Out->begin_invisible_table("", array("CELLPADDING='1'", "CELLSPACING='0'", "ALIGN='center'"));
     $ret .= "<TR BGCOLOR='#CCCCCC'><TD>\n";
     $ret .= "<FONT COLOR='{$this->Conf->Alert_message_color}' FACE='MS Sans Serif, Arial'>{$this->alert_message}</FONT>\n";
     $ret .= "<FONT COLOR='{$this->Conf->Success_message_color}' FACE='MS Sans Serif, Arial'>{$this->success_message}</FONT>\n";
     $ret .= "</TD</TR>\n";
     $ret .= "<TR BGCOLOR='#CCCCCC'><TD>\n";
     $ret .= $this->Out->start_box_table();
     $ret .= "<TR BGCOLOR='#CCCCCC'>\n";
     /* SELECT FILE */
     $ret .= "<TD ALIGN='left' COLSPAN='7'><SELECT NAME='code_file_name'>\n";
     $data_dir_obj = dir($this->Conf->Data_dir);
     $selected[$this->Conf->Current_file] = "SELECTED";
     while ($my_files[] = $data_dir_obj->read()) {
     }
     sort($my_files);
     while ($file = next($my_files)) {
         if (ereg("^\\.{1,2}\$", $file)) {
             continue;
         }
         $my_fullname = "{$data_dir_obj->path}/{$file}";
         $ret .= "<OPTION VALUE='{$file}' {$selected[$my_fullname]}>{$file}</OPTION>\n";
     }
     $data_dir_obj->close();
     $ret .= "</SELECT>";
     /* OPEN SAVE AS */
     $ret .= "&nbsp;&nbsp;<INPUT TYPE='submit' VALUE='" . _CC_ED_OPEN . "' onClick='main_form.action.value=\"open_file\"'>\n";
     $ret .= "<INPUT TYPE='submit' VALUE='" . _CC_ED_SAVE . "' onClick='main_form.action.value=\"save_as\"; main_form.submit()'>\n";
     $ret .= "<INPUT TYPE='text' NAME='save_as_filename' VALUE='{$HTTP_POST_VARS['save_as_filename']}'>\n";
     $ret .= "" . _CC_ED_REPL . ": <INPUT TYPE='CHECKBOX' NAME='overwrite_ok' VALUE='CHECKED' {$HTTP_POST_VARS['overwrite_ok']}>\n";
     /* ROWS */
     // $ret .= "<div align='right'>"._CC_ED_ROWS.": <INPUT TYPE='text' NAME='Code_rows' VALUE='{$this->Conf->Code_rows}' SIZE='3' MAXLENGTH='3' CLASS='netscapesucks2'>\n";
     //$ret .= "<INPUT TYPE='submit' VALUE='"._CC_ED_SIZE."' onClick='main_form.action.value=\"save_size\"; main_form.submit()'></div></TD>\n";
     $ret .= "</td></TR>\n";
     $ret .= "<TR BGCOLOR='#CCCCCC'>\n";
     /* TEXTAREA */
     $ret .= "<TD COLSPAN='7'>";
     $ret .= $sw->getHtml();
     // $ret .= "<TEXTAREA ROWS='{$this->Conf->Code_rows}' NAME='code' class='textareacj'>{$this->textarea_safe_code}</TEXTAREA></TD>";
     $ret .= "</TR>\n";
     $ret .= "<TR BGCOLOR='#CCCCCC'>\n";
     /* RUN AS */
     $ret .= "<TD COLSPAN='7'><INPUT TYPE='submit' VALUE='- " . _CC_ED_RUN . " -' onClick='main_form.action.value=\"eval\"; main_form.submit()'>\n";
     $ret .= "<SPAN CLASS='netscapesucks'>" . _CC_ED_RUNAS . ":</SPAN> <SELECT NAME='Eval_suffix'>{$suffix_select_options}</SELECT>";
     $ret .= "<div align='right'><INPUT TYPE='submit' VALUE='" . _CC_ED_ABOUT . "' onClick='main_form.action.value=\"about\"; main_form.submit()'></div></TD>\n";
     $ret .= "</TR>\n";
     $ret .= $this->Out->end_box_table();
     $ret .= "</TD></TR>\n";
     $ret .= $this->Out->end_invisible_table();
     $ret .= "</FORM>\n";
     return $ret;
 }
Exemple #6
0
function display_edit_form($cat_array, $form_title, $action)
{
    global $cattree, $table_icon;
    global $gnavi_defaultlat;
    global $gnavi_defaultlng;
    global $gnavi_defaultzoom;
    global $gnavi_defaultmtype;
    global $gnavi_googlemapapi_key;
    global $gnavi_usegooglemap, $xoopsDB;
    global $gnavi_lang_java;
    global $gnavi_body_editor;
    global $gnavi_googlemap_url;
    $myts =& MyTextSanitizer::getInstance();
    extract($cat_array);
    // Beggining of XoopsForm
    $form = new XoopsThemeForm($form_title, 'MainForm', '');
    // Hidden
    $form->addElement(new XoopsFormHidden('action', $action));
    $form->addElement(new XoopsFormHidden('cid', $cid));
    // Title
    $form->addElement(new XoopsFormText(_MD_A_GNAVI_CAT_TH_TITLE, 'title', 30, 50, $myts->htmlSpecialChars($title)), true);
    // Image URL
    $form->addElement(new XoopsFormText(_MD_A_GNAVI_CAT_TH_IMGURL, 'imgurl', 50, 150, $myts->htmlSpecialChars($imgurl)));
    // Kml URL
    $form->addElement(new XoopsFormText(_MD_A_GNAVI_CAT_TH_KMLURL, 'kmlurl', 50, 150, $myts->htmlSpecialChars($kmlurl)));
    // Parent Category
    ob_start();
    $cattree->makeMySelBox("title", "weight", $pid, 1, 'pid');
    $cat_selbox = ob_get_contents();
    ob_end_clean();
    $form->addElement(new XoopsFormLabel(_MD_A_GNAVI_CAT_TH_PARENT, $cat_selbox));
    //----------------------------editor-------------------------------------------
    if ($gnavi_body_editor == 'common_fckeditor') {
        // FCKeditor in common/fckeditor/
        $jscript = '
			<script type="text/javascript" src="' . XOOPS_URL . '/common/fckeditor/fckeditor.js"></script>
			<script type="text/javascript"><!--
				function fckeditor_exec() {
					var oFCKeditor = new FCKeditor( "description" , "100%" , "500" , "Default" );
					
					oFCKeditor.BasePath = "' . XOOPS_URL . '/common/fckeditor/";
					
					oFCKeditor.ReplaceTextarea();
				}
			// --></script>
		';
        $wysiwyg_body = '<textarea id="description" name="description">' . htmlspecialchars($description, ENT_QUOTES) . '</textarea><script>fckeditor_exec();</script>';
        $desc_tarea = new XoopsFormLabel(_MD_A_GNAVI_CAT_TH_DESC, $jscript . $wysiwyg_body);
    } else {
        if ($gnavi_body_editor == 'common_spaw' && file_exists(XOOPS_ROOT_PATH . '/common/spaw/spaw_control.class.php')) {
            // older spaw in common/spaw/
            include XOOPS_ROOT_PATH . '/common/spaw/spaw_control.class.php';
            ob_start();
            $sw = new SPAW_Wysiwyg("description", $description);
            $sw->show();
            $wysiwyg_body = ob_get_contents();
            ob_end_clean();
            $desc_tarea = new XoopsFormLabel(_MD_A_GNAVI_CAT_TH_DESC, $wysiwyg_body);
        } else {
            if ($gnavi_body_editor == 'pure_html') {
                $desc_tarea = new XoopsFormTextArea(_MD_A_GNAVI_CAT_TH_DESC, "description", $myts->makeTareaData4Edit($description), 20, 60);
            } else {
                $desc_tarea = new XoopsFormDhtmlTextArea(_MD_A_GNAVI_CAT_TH_DESC, "description", $myts->makeTareaData4Edit($description), 20, 60);
            }
        }
    }
    $form->addElement($desc_tarea);
    //---------------------------------------------------------------------------------
    $form->addElement(new XoopsFormText(_MD_A_GNAVI_CAT_TH_WEIGHT, 'weight', 5, 3, $myts->htmlSpecialChars($weight)));
    //Google Maps
    if ($gnavi_usegooglemap) {
        $set_latlng_state = "";
        if ($lat == 0 && $lng == 0) {
            $lat = $gnavi_defaultlat;
            $lng = $gnavi_defaultlng;
            $zoom = $gnavi_defaultzoom;
            $mtype = $gnavi_defaultmtype;
            if ($action == "update") {
                $set_latlng_state = "checked";
            }
        }
        $gmap = new XoopsFormLabel(_MD_GNAV_MAP, "\n<div><input type='checkbox' name='set_latlng' id='set_latlng' value='1' onclick='ChangeMapArea(this)' {$set_latlng_state}/>&nbsp;" . _MD_GNAV_MAP_UNINPUT . "</div>\n<div id='maparea'>\n<div id='map' style='width:100%;height:400px;'></div>\n<div id='gn_latlng'>" . _MD_GNAV_MAP_LAT . ":&nbsp;<span id='slat'>" . $myts->makeTboxData4Edit($lat) . "</span>&nbsp;&nbsp;&nbsp;" . _MD_GNAV_MAP_LNG . ":&nbsp;<span id='slng'>" . $myts->makeTboxData4Edit($lng) . "</span>&nbsp;&nbsp;&nbsp;" . _MD_GNAV_MAP_ZOOM . ":&nbsp;<span id='sz'>" . $myts->makeTboxData4Edit($zoom) . "</span></div>\n<input type='hidden' name='lat' id='lat' size='20' value='" . $myts->makeTboxData4Edit($lat) . "' />\n<input type='hidden' name='lng' id='lng' size='20' value='" . $myts->makeTboxData4Edit($lng) . "' />\n<input type='hidden' name='z' id='z' size='20' value='" . $myts->makeTboxData4Edit($zoom) . "' />\n<input type='hidden' name='mt' id='mt' size='30' value='" . $myts->makeTboxData4Edit($mtype) . "' />\n</div>\n<script src='" . $gnavi_googlemap_url . "/maps?file=api&amp;v=2&amp;key={$gnavi_googlemapapi_key}' type='text/javascript' charset='utf-8'></script>\n<script src='../js/map.js' type='text/javascript' charset='utf-8'></script>\n<script type='text/javascript'>\n//<![CDATA[\n\t{$gnavi_lang_java}\n\twindow.onload = InputGMap;\n//]]>\n</script>");
        $form->addElement($gmap);
        $icon_select = new XoopsFormSelect(_MD_GNAV_MAP_ICON, 'icd', $icd, 1, false);
        $sql = "SELECT icd, title FROM {$table_icon} ";
        $result = $xoopsDB->query($sql);
        $icons_array = array();
        $icons_array[0] = '---';
        while ($myrow = $xoopsDB->fetchArray($result)) {
            $icons_array[$myrow['icd']] = $myrow['title'];
        }
        $icon_select->addOptionArray($icons_array);
        $form->addElement($icon_select);
    }
    // Buttons
    $button_tray = new XoopsFormElementTray('', '&nbsp;');
    $button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
    $button_tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset'));
    $form->addElement($button_tray);
    // Ticket
    $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement($form, __LINE__);
    // End of XoopsForm
    $form->display();
}
Exemple #7
0
function editentry( $entryID = '' )
	{
	global $xoopsUser,$xoopsConfig,$xoopsModuleConfig,$xoopsModule,$cat_table,$ent_table,$xoopsGTicket,$spaw_root,$MYDIRNAME; 
	$xoopsDB =& Database::getInstance();
	$myts =& MyTextSanitizer::getInstance();

	$op = 'default';
	if ( !empty( $_GET['op'] ) ) $op = trim($_GET['op']);
	if ( !empty( $_POST['op'] ) ) $op = trim($_POST['op']);
	$entryID = !empty( $_GET['entryID'] ) ? intval($_GET['entryID']) : '';
	//Initialize all variables before we start
	$block = $html = $smiley = $xcodes = $breaks = $offline = $submit = $categoryID = 0;
	$term = $proc = $definition = $ref = $url = '';

	// Since this is a submission, the id exists, so retrieve data: were editing an entry
	$result = $xoopsDB -> query( "SELECT categoryID, term, proc, definition, ref, url, uid, submit, datesub, html, smiley, xcodes, breaks, block, offline, notifypub, request FROM $ent_table WHERE entryID = '$entryID' AND ( submit = '1' OR request = '1' )" );

	if ( $xoopsDB -> getRowsNum( $result ) == 0 )
		{
		redirect_header( "submissions.php", 1, constant("_AM_{$MYDIRNAME}_NOTUPDATED") );
		}

	list( $categoryID, $term, $proc, $definition, $ref, $url, $uid, $submit, $datesub, $html, $smiley, $xcodes, $breaks, $block, $offline, $notifypub, $request ) = $xoopsDB -> fetchrow( $result );

	$query = $xoopsDB -> query ( "SELECT name FROM $cat_table WHERE categoryID = '$categoryID' ");
	list($name) = $xoopsDB->fetchRow($query);

	$term = isset( $term ) ? $myts -> htmlspecialchars($term) : '';
	if ($proc)
		{
		list($temp,$proc) = explode(",",$proc);
		}
	$proc = isset( $proc ) ? $myts -> htmlSpecialChars($proc) : '';
//	$definition = isset( $definition ) ? $myts -> htmlSpecialChars($definition) : '';
	$ref = isset( $ref ) ? $myts -> htmlSpecialChars($ref) : '';
	$url = isset( $url ) ? $myts -> htmlSpecialChars($url) : '';

	xoops_cp_header();
	adminMenu(3, constant("_AM_{$MYDIRNAME}_AUTHORIZE")."&nbsp;&raquo;&nbsp;".$term);
	include('./mymenu.php');
	$sform = new XoopsThemeForm( constant("_AM_{$MYDIRNAME}_AUTHENTRY") . ": $term" , "op", xoops_getenv( 'PHP_SELF' ) );

	$sform -> setExtra( 'enctype="multipart/form-data"' );

	// Author selector
	ob_start();
	if (!$uid)
		{
		$uid = $xoopsUser -> getVar ("uid");
		}
	echo	xoops_getLinkedUnameFromId( intval($uid) );
	$sform -> addElement( new XoopsFormLabel( constant("_AM_{$MYDIRNAME}_AUTHOR"), ob_get_contents() ) );
	ob_end_clean();

	if ($xoopsModuleConfig['multicats'] == 1)
		{
		$mytree = new XoopsTree( $cat_table, "categoryID" , "0" );

		ob_start();
		$sform -> addElement( new XoopsFormHidden( 'categoryID', $categoryID ) );
		$mytree -> makeMySelBox( "name", "weight", $categoryID );
		$sform -> addElement( new XoopsFormLabel( constant("_AM_{$MYDIRNAME}_CATNAME"), ob_get_contents() ) );
		ob_end_clean();
		}

	$sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_ENTRYTERM"), 'term', 50, 80, $term), true );
	$sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_ENTRYPROC"), 'proc', 50, 80, $proc), true );
//	$sform -> addElement( new XoopsFormDhtmlTextArea( constant("_AM_{$MYDIRNAME}_ENTRYDEF"), 'definition', $definition, 15, 60 ) );
	if( !empty( $_GET['usespaw'] ) && $spaw_root )
		{
		// SPAW Config
		include_once $spaw_root."spaw_control.class.php";
		ob_start() ;
		$sw = new SPAW_Wysiwyg( 'definition', $definition, _LANGCODE, 'full', 'default', '100%', '400px' );
		$def_block = new XoopsFormLabel( constant("_AM_{$MYDIRNAME}_ENTRYDEF")."[<a href=\"".xoops_getenv( 'PHP_SELF')."?op=$op&amp;entryID=$entryID\" title=\"".constant("_AM_{$MYDIRNAME}_BB")."\">".constant("_AM_{$MYDIRNAME}_SPAWTOBB")."</a>]" , $sw->getHtml() ) ;
		ob_end_clean() ;
		}
	elseif( $spaw_root )
		{
		$def_block = new XoopsFormDhtmlTextArea( constant("_AM_{$MYDIRNAME}_ENTRYDEF")."[<a href=\"".xoops_getenv( 'PHP_SELF')."?op=$op&amp;entryID=$entryID&amp;usespaw=1\" title=\"".constant("_AM_{$MYDIRNAME}_SPAW")."\">".constant("_AM_{$MYDIRNAME}_BBTOSPAW")."</a>]", 'definition', $myts -> htmlSpecialChars($definition), 15, 60 );
		}
	else
		{
		$def_block = new XoopsFormDhtmlTextArea( constant("_AM_{$MYDIRNAME}_ENTRYDEF"), 'definition', $myts -> htmlSpecialChars($definition), 15, 60 );
		}
	$sform -> addElement ( $def_block );
	$sform -> addElement( new XoopsFormTextArea( constant("_AM_{$MYDIRNAME}_ENTRYREFERENCE"), 'ref', $ref, 5, 60 ), false );
	$sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_ENTRYURL"), 'url', 50, 80, $url ), false );

	$options_tray = new XoopsFormElementTray(constant("_AM_{$MYDIRNAME}_OPTIONS"),'<br />');

	$html_checkbox = new XoopsFormCheckBox( '', 'html', intval($html) );
	$html_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_DOHTML") );
	$options_tray -> addElement( $html_checkbox );

	$smiley_checkbox = new XoopsFormCheckBox( '', 'smiley', intval($smiley) );
	$smiley_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_DOSMILEY") );
	$options_tray -> addElement( $smiley_checkbox );

	$xcodes_checkbox = new XoopsFormCheckBox( '', 'xcodes', intval($xcodes) );
	$xcodes_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_DOXCODE") );
	$options_tray -> addElement( $xcodes_checkbox );

	$breaks_checkbox = new XoopsFormCheckBox( '', 'breaks', intval($breaks) );
	$breaks_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_BREAKS") );
	$options_tray -> addElement( $breaks_checkbox );

	$sform -> addElement( $options_tray );

	$button_tray = new XoopsFormElementTray( '', '' );
	$hidden = new XoopsFormHidden( 'op', 'authentry' );
	$button_tray -> addElement( $hidden );

	$hidden_id = new XoopsFormHidden( 'entryID', intval($entryID) );
	$button_tray -> addElement( $hidden_id );

	$hidden_uid = new XoopsFormHidden( 'uid', intval($uid) );
	$button_tray -> addElement( $hidden_uid );

	$hidden_block = new XoopsFormHidden( 'block', intval($block) );
	$button_tray -> addElement( $hidden_block );

	//PREVIEW(ver0.31)
	$butt_preview = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_PREVIEWOPEN"), 'button' );
	$butt_preview->setExtra('onclick="document.op.action=\'../preview.php\';document.op.target=\'_blank\';document.op.submit();"');
	$button_tray->addElement( $butt_preview );

	$butt_save = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_AUTHORIZE"), 'submit' );
//	$butt_save->setExtra('onclick="this.form.elements.op.value=\'authentry\'"');
	$butt_save->setExtra('onclick="document.op.action=\'./submissions.php\';document.op.target=\'_self\';this.form.elements.op.value=\'authentry\'"');
	$button_tray->addElement( $butt_save );

	$butt_cancel = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CANCEL"), 'button' );
	$butt_cancel->setExtra('onclick="history.go(-1)"');
	$button_tray->addElement( $butt_cancel );

	$button_tray->addElement( $xoopsGTicket->getTicketXoopsForm( __LINE__ ) );//GIJ
	$sform -> addElement( $button_tray );
	$sform -> display();
	unset( $hidden );
	xoops_cp_footer();
	}
Exemple #8
0
function entryEdit( $entryID = '' )
	{
	global $xoopsUser,$xoopsConfig,$xoopsModuleConfig,$mydirname,$MYDIRNAME,$spaw_root,$cat_table,$ent_table,$xoopsGTicket; 
	$xoopsDB =& Database::getInstance();
	$xoopsModule = XoopsModule::getByDirname("$mydirname");
	$myts =& MyTextSanitizer::getInstance();

	$op = 'default';
	if ( !empty( $_GET['op'] ) ) $op = trim($_GET['op']);
	if ( !empty( $_POST['op'] ) ) $op = trim($_POST['op']);
	$entryID = !empty( $_GET['entryID'] ) ? intval($_GET['entryID']) : '';
	/**
	 * Clear all variables before we start
	 */
	if(!isset($block)) { $block = 0; }
	if(!isset($html)) { $html = 0; }
	if(!isset($smiley)) { $smiley = 0; }
	if(!isset($xcodes)) { $xcodes = 0; }
	if(!isset($breaks)) { $breaks = 0; }
	if(!isset($offline)) { $offline = 0; }
	if(!isset($submit)) { $submit = 0; }
	if(!isset($request)) { $request = 0; }
	if(!isset($notifypub)) { $notifypub = 0; }
	if(!isset($categoryID)) { $categoryID = 0; }
	if(!isset($term)) { $term = ""; }
	if(!isset($proc)) { $proc = ""; }
	if(!isset($definition)) 
		{
		$definition = constant("_AM_{$MYDIRNAME}_WRITEHERE");	
		}
	if(!isset($ref)) { $ref = ""; }
	if(!isset($url)) { $url = ""; }
	if(!isset($renewdate)) { $renewdate = 0; }
	if(!isset($datesub)) { $datesub = 0; }

	// If there is a parameter, and the id exists, retrieve data: were editing an entry
	if ( $entryID > 0 )
		{
		$result = $xoopsDB -> query( "SELECT categoryID, term, proc, definition, ref, url, uid, submit, datesub, html, smiley, xcodes, breaks, block, offline, notifypub, request FROM $ent_table WHERE entryID = '$entryID'" );
		list( $categoryID, $term, $proc, $definition, $ref, $url, $uid, $submit, $datesub, $html, $smiley, $xcodes, $breaks, $block, $offline, $notifypub, $request ) = $xoopsDB -> fetchrow( $result );

		if ( !$xoopsDB -> getRowsNum( $result ) )
			{
			redirect_header( "index.php", 1, constant("_AM_{$MYDIRNAME}_NOENTRYTOEDIT") );
			}

		$term = $myts -> htmlspecialchars($term);
		if ($proc)
			{
			list($temp,$proc) = explode(",",$proc);
			}
		$proc = $myts -> htmlSpecialChars($proc);
		$ref = $myts -> htmlSpecialChars($ref);
		$url = $myts -> htmlSpecialChars($url);

		$datesub = intval( $datesub );
		$block = intval( $block );
		$html = intval( $html );
		$smiley = intval( $smiley );
		$xcodes = intval( $xcodes );
		$breaks = intval( $breaks );
		$notifypub = intval( $notifypub );

		xoops_cp_header();
		adminMenu(2, constant("_AM_{$MYDIRNAME}_ENTRIES")."&nbsp;&raquo;&nbsp;".constant("_AM_{$MYDIRNAME}_MODIFY"));
		include('./mymenu.php');
		echo "<fieldset style='margin:1em 0em 0em 0em;border:1px solid #778;'><legend style='font-weight: bold; color: #900;'>" . constant("_AM_{$MYDIRNAME}_ENTRIES") . "</legend><br />\n";
		$sform = new XoopsThemeForm( constant("_AM_{$MYDIRNAME}_MODENTRY") . ": " .$myts -> htmlSpecialChars($term) , "op", xoops_getenv( 'PHP_SELF' ) );
		} 
	else // there's no parameter, so we're adding an entry
		{
		$result01 = $xoopsDB -> query( "SELECT COUNT(*) FROM $cat_table" );
		list( $totalcats ) = $xoopsDB -> fetchRow( $result01 );
		if ( $totalcats == 0 && $xoopsModuleConfig['multicats'] == 1 )
			{
			redirect_header( "index.php", 1, constant("_AM_{$MYDIRNAME}_NEEDONECOLUMN") );
			}
		xoops_cp_header();
		adminMenu(2, constant("_AM_{$MYDIRNAME}_ENTRIES")."&nbsp;&raquo;&nbsp;".constant("_AM_{$MYDIRNAME}_ADMINENTRYMNGMT"));
		include('./mymenu.php');
		echo "<fieldset style='margin:1em 0em 0em 0em;border:1px solid #778;'><legend style='font-weight: bold; color: #900;'>" . constant("_AM_{$MYDIRNAME}_ENTRIES") . "</legend><br />\n";
		$uid = $xoopsUser->getVar('uid');
		$sform = new XoopsThemeForm( constant("_AM_{$MYDIRNAME}_NEWENTRY"), "op", xoops_getenv( 'PHP_SELF' ) );
		$html = $smiley = $xcodes = $breaks = 1;
		}

	$sform -> setExtra( 'enctype="multipart/form-data"' );

	// Author selector
	ob_start();
	echo	xoops_getLinkedUnameFromId( intval($uid) );
	$sform -> addElement( new XoopsFormLabel( constant("_AM_{$MYDIRNAME}_AUTHOR"), ob_get_contents() ) );
	ob_end_clean();

	// Category selector
	if ($xoopsModuleConfig['multicats'] == 1)
		{
		$mytree = new XoopsTree( $cat_table, "categoryID" , "0" );

		ob_start();
//okino		$sform -> addElement( new XoopsFormHidden( 'categoryID', intval($categoryID) ) );
		$mytree -> makeMySelBox( "name", "weight", $categoryID );
		$sform -> addElement( new XoopsFormLabel( constant("_AM_{$MYDIRNAME}_CATNAME"), ob_get_contents() ) );
		ob_end_clean();
		}

	// Term, definition, reference and related URL
	$sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_ENTRYTERM"), 'term', 50, 80, $term), true );
	$sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_ENTRYPROC"), 'proc', 50, 80, $proc), true );

	if( !empty( $_GET['usespaw'] ) && $spaw_root )
		{
		// SPAW Config
		include_once $spaw_root."spaw_control.class.php";
		ob_start() ;
		$sw = new SPAW_Wysiwyg( 'definition', $definition, _LANGCODE, 'full', 'default', '100%', '400px' );
		$def_block = new XoopsFormLabel( constant("_AM_{$MYDIRNAME}_ENTRYDEF")."[<a href=\"".xoops_getenv( 'PHP_SELF')."?op=$op&amp;entryID=$entryID\" title=\"".constant("_AM_{$MYDIRNAME}_BB")."\">".constant("_AM_{$MYDIRNAME}_SPAWTOBB")."</a>]" , $sw->getHtml() ) ;
		ob_end_clean() ;
		}
	elseif( $spaw_root )
		{
		$def_block = new XoopsFormDhtmlTextArea( constant("_AM_{$MYDIRNAME}_ENTRYDEF")."[<a href=\"".xoops_getenv( 'PHP_SELF')."?op=$op&amp;entryID=$entryID&amp;usespaw=1\" title=\"".constant("_AM_{$MYDIRNAME}_SPAW")."\">".constant("_AM_{$MYDIRNAME}_BBTOSPAW")."</a>]", 'definition', $myts -> htmlSpecialChars($definition), 15, 60 );
		}
	else
		{
		$def_block = new XoopsFormDhtmlTextArea( constant("_AM_{$MYDIRNAME}_ENTRYDEF"), 'definition', $myts -> htmlSpecialChars($definition), 15, 60 );
		}
	if ($definition == constant("_AM_{$MYDIRNAME}_WRITEHERE"))
		{
		$def_block -> setExtra( 'onfocus="this.select()"' );
		}
	$sform -> addElement ( $def_block );

	if ($xoopsModuleConfig['allowedtypes'])
		{
		$butt_upfile = new XoopsFormButton( constant("_AM_{$MYDIRNAME}_UPFILES"), '', constant("_AM_{$MYDIRNAME}_UPLOADOPEN"), 'button' );
		$butt_upfile->setExtra('onclick="window.open (\'upload.php\', \'wbupload\', \'width=550,height=360,location=0,menubar=0,resizable=1,scrollbars=yes,status=1,toolbar=0\')"');
		$sform->addElement( $butt_upfile );
		}

	$sform -> addElement( new XoopsFormTextArea( constant("_AM_{$MYDIRNAME}_ENTRYREFERENCE"), 'ref', $ref, 5, 60 ), false );
	$sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_ENTRYURL"), 'url', 50, 80, $url ), false );

	// Code to take entry offline, for maintenance purposes
	$offline_radio = new XoopsFormRadioYN(constant("_AM_{$MYDIRNAME}_SWITCHOFFLINE"), 'offline', intval($offline), ' '.constant("_AM_{$MYDIRNAME}_YES").'', ' '.constant("_AM_{$MYDIRNAME}_NO").'');
	$sform -> addElement($offline_radio);

	// Code to put entry in block
//	$block_radio = new XoopsFormRadioYN( _AM_XWORDS_BLOCK, 'block', $block , ' ' . _AM_XWORDS_YES . '', ' ' . _AM_XWORDS_NO . '' );
//	$sform -> addElement( $block_radio );

	if ( $entryID > 0)
		{
		$renewdate_checkbox = new XoopsFormCheckBox( constant("_AM_{$MYDIRNAME}_ENTRYCREATED")."<br /><span style='font-size: xx-small; font-weight: normal;'>(".constant("_AM_{$MYDIRNAME}_RENEWDATE_DEFAULT").formatTimestamp($datesub).")</span>", 'renewdate', $renewdate );
		$renewdate_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_RENEWDATE")."<br />".getSetTimeForm($datesub) );
		}
	else
		{
		$renewdate_checkbox = new XoopsFormCheckBox( constant("_AM_{$MYDIRNAME}_ENTRYCREATED")."<br /><span style='font-size: xx-small; font-weight: normal;'>(".constant("_AM_{$MYDIRNAME}_RENEWDATE_DEFAULT").formatTimestamp(time()).")</span>", 'renewdate', $renewdate );
		$renewdate_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_SETNEWDATE")."<br />".getSetTimeForm(time()) );
		}
	$sform -> addElement( $renewdate_checkbox );

	// VARIOUS OPTIONS
	$options_tray = new XoopsFormElementTray(constant("_AM_{$MYDIRNAME}_OPTIONS"),'<br />');

	$html_checkbox = new XoopsFormCheckBox( '', 'html', intval($html) );
	$html_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_DOHTML") );
	$options_tray -> addElement( $html_checkbox );

	$smiley_checkbox = new XoopsFormCheckBox( '', 'smiley', intval($smiley) );
	$smiley_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_DOSMILEY") );
	$options_tray -> addElement( $smiley_checkbox );

	$xcodes_checkbox = new XoopsFormCheckBox( '', 'xcodes', intval($xcodes) );
	$xcodes_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_DOXCODE") );
	$options_tray -> addElement( $xcodes_checkbox );

	$breaks_checkbox = new XoopsFormCheckBox( '', 'breaks', intval($breaks) );
	$breaks_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_BREAKS") );
	$options_tray -> addElement( $breaks_checkbox );
	$sform -> addElement( $options_tray );

	$button_tray = new XoopsFormElementTray( '', '' );
	$hidden = new XoopsFormHidden( 'op', 'addentry' );
	$button_tray -> addElement( $hidden );

	$hidden_date = new XoopsFormHidden( 'datesub', $datesub );
	$button_tray -> addElement( $hidden_date );

	$hidden_id = new XoopsFormHidden( 'entryID', $entryID );
	$button_tray -> addElement( $hidden_id );

	$hidden_uid = new XoopsFormHidden( 'uid', $uid );
	$button_tray -> addElement( $hidden_uid );

	$hidden_block = new XoopsFormHidden( 'block', $block );
	$button_tray -> addElement( $hidden_block );

	if ( !$entryID)
		{
		$hidden_renewdate = new XoopsFormHidden( 'renewdate', 1 );
		$button_tray -> addElement( $hidden_renewdate );
		}

	//PREVIEW(ver0.31)
	$butt_preview = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_PREVIEWOPEN"), 'button' );
	$butt_preview->setExtra('onclick="document.op.action=\'../preview.php\';document.op.target=\'_blank\';document.op.submit();"');
	$button_tray->addElement( $butt_preview );

	if ( !$entryID ) // therez no entryID? Then its a new entry
		{
		$butt_create = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CREATE"), 'submit' );
		$butt_create->setExtra('onclick="document.op.action=\'./entry.php\';document.op.target=\'_self\';this.form.elements.op.value=\'addentry\'"');
		$button_tray->addElement( $butt_create );

		$butt_clear = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CLEAR"), 'reset' );
		$button_tray->addElement( $butt_clear );

		$butt_cancel = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CANCEL"), 'button' );
		$butt_cancel->setExtra('onclick="history.go(-1)"');
		$button_tray->addElement( $butt_cancel );
		} 
	else // else, were editing an existing entry
		{
		$butt_create = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_MODIFY"), 'submit' );
		$butt_create->setExtra('onclick="document.op.action=\'./entry.php\';document.op.target=\'_self\';this.form.elements.op.value=\'addentry\'"');
		$button_tray->addElement( $butt_create );

		$butt_cancel = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CANCEL"), 'button' );
		$butt_cancel->setExtra('onclick="history.go(-1)"');
		$button_tray->addElement( $butt_cancel );
		}

	$button_tray->addElement( $xoopsGTicket->getTicketXoopsForm( __LINE__ ) );//GIJ
	$sform -> addElement( $button_tray );
	$sform -> display();

	unset( $hidden );
	echo "</fieldset>\n";
	xoops_cp_footer();
	}