}
// $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')) == "");
$use_pingback = get_settings('use_pingback');
Esempio n. 2
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")." » ".$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();
	}
Esempio n. 3
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;
 }
Esempio n. 4
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();
	}