Configure the new TinyMCE to have almost the same buttons as the old one.
Configure the new TinyMCE to have almost the same buttons as the old one.

File last commit:

d5660b942da0
3cf3f8fd35f8
Show More
post-rant.php
204 lines | 6.6 KiB | text/x-php | XmlPhpLexer
/ post-rant.php
<?php
/* This is a blank form for new rants to be started.
It does not read past rant information.
Some fields will be prefilled based on current author. */
require_once('include/admin.inc.php');
auth_redirect(); // Require logged in user to access this page.
adminhead('Write Rant');
adminmenu('post-rant.php');
$rant_image_ext = $mtdb->getOne( 'SELECT extension FROM media_t WHERE id=' . (int)$currentuser->imagetype );
?>
<!--
<script language="javascript" type="text/javascript" src="include/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,image,media,charmap,|,formatselect,forecolor,removeformat,|,pastetext,pasteword,|,outdent,indent,|,undo,redo,|,code,visualchars,|,fullscreen,preview",
theme_advanced_buttons2:"",
theme_advanced_buttons3 : "",
plugin_preview_width : "350",
plugin_preview_height : "700",
language:"en",
theme_advanced_toolbar_location:"top",
theme_advanced_toolbar_align:"left",
theme_advanced_statusbar_location:"bottom",
theme_advanced_resizing:"1",
theme_advanced_resize_horizontal:"",
paste_convert_middot_lists:"1",
paste_remove_spans:"1",
paste_remove_styles:"1",
gecko_spellcheck:"1",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
theme_advanced_blockformats : "p,h3,h4,h5,h6",
plugins:"safari,inlinepopups,autosave,paste,media,fullscreen,contextmenu,advimage,advlink,visualchars,preview"
});
</script>
-->
<h2>Create New Rant</h2>
<form enctype="multipart/form-data" action="edit-rant.php" method="post" name="post" id="post">
<?php nonce_field('new-rant'); ?>
<input type="hidden" name="rant_id" value="" />
<input type="hidden" name="action" value="new_rant" />
<div id="poststuff">
<div id="moremeta">
<div id="grabit" class="dbx-group">
<fieldset id="slugdiv" class="dbx-box">
<h3 class="dbx-handle">Side</h3>
<div class="dbx-content"><select name="rant_side">
<?php
// What side does this author usually post on?
$usual = $mtdb->getOne( 'SELECT side,count(*) c FROM rant WHERE author=' . (int)$currentuser->id . ' GROUP BY side ORDER BY c DESC limit 1' );
$sides = array('left'=>'Left','right'=>'Right');
foreach( $sides as $k=>$v ) {
printf('<option value="%s" %s>%s</option>', htmlentities($k), ($usual == $k ? 'selected="selected"' : '' ), $v );
}
?>
</select></div>
</fieldset>
<fieldset id="authordiv" class="dbx-box">
<h3 class="dbx-handle">Author</h3>
<div class="dbx-content"><select name="rant_author"><?php
$contrib = $mtdb->getAll('select id,name from contributor');
foreach( $contrib as $k=>$v ) {
printf('<option value="%s" %s>%s</option>', htmlentities($v->id), ( $currentuser->id == $v->id ? 'selected="selected"' : '' ), $v->name );
} ?>
</select></div>
</fieldset>
<fieldset id="pubdatediv" class="dbx-box">
<h3 class="dbx-handle">Post Date</h3>
<div class="dbx-content"> <input type="text" name="rant_date" value="<?php echo date('Y-m-d H:i:s'); ?>" /> </div>
</fieldset>
<fieldset id="statusdiv" class="dbx-box">
<h3 class="dbx-handle">Published Status</h3>
<div class="dbx-content">
<label><input type="radio" name="rant_status" value="draft" checked="checked"/>Draft</label>
<label><input type="radio" name="rant_status" value="published"/>Published</label>
</div>
</fieldset>
</div>
</div>
<fieldset id="titlediv">
<legend>Title</legend>
<div><input type="text" name="title" size="40" tabindex="1" value="" id="title" /></div>
</fieldset>
<fieldset id="linkdiv">
<legend>Link</legend>
<div><input type="text" name="link" size="40" tabindex="2" value="<?php echo htmlentities( $currentuser->default_link ); ?>" id="link" /></div>
</fieldset>
<fieldset id="postdivrich">
<legend>Post</legend>
<style type="text/css">
#postdivrich table, #postdivrich #quicktags {border-top: none;}
#quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;}
#edButtons {border-bottom: 1px solid #ccc;}
</style>
<div><textarea class="mceEditor" rows="13" cols="40" name="content" tabindex="3" id="content"></textarea></div>
<?php
/*
include("include/fckeditor/fckeditor_php4.php");
$oFCKeditor = new FCKeditor('content');
$oFCKeditor->BasePath = 'include/fckeditor/';
$oFCKeditor->Value = '';
$oFCKeditor->Create();
*/
?>
</fieldset>
<p class="submit">
<input name="save" type="submit" id="save" tabindex="3" value="Save and Continue Editing" style="font-weight: bold;" />
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="Publish" />
</p>
<div class="dbx-b-ox-wrapper">
<fieldset id="rant-image" class="dbx-box">
<h3 class="dbx-handle">Image</h3>
<div>
<table border="0" cellpadding="4">
<tr><td valign="top" width="40%">
<p><?php
// no image in place yet
$rantimage_filename = SITE_RANT.'/' . $currentuser->default_image;
if( file_exists( SITE_PATH_ABS.'/' . $rantimage_filename )) {
echo 'Currently using default rant image for this contributor. <a href="user-edit.php?edit='.$currentuser->id.'">Change default</a>.';
} else {
echo $rantimage_filename;
$rantimage_filename = false;
echo 'There is currently no image associated with this rant, <br/>and no default rant image associated with this contributor.
<br/><a href="user-edit.php?edit=' . $currentuser->id . '">Add a default rant image to your profile.</a>';
}
?>
</p>
<p>Upload a rant image:<br/>
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
<input name="ranterImage" type="file"/>
</p>
</td><td>
<?php if ( $rantimage_filename ): ?>
<p><img src="<?php echo SITE_HOST . '/' . SITE_PATH . '/' . $rantimage_filename; ?>" width="150" /></p>
<?php endif; ?>
</td></tr>
<tr><td>
<p>Rant image alt text:</p>
<input type="text" name="rant_imagetext" size="40" tabindex="2" value="" id="rant_imagetext" />
</td></tr>
<tr id="rant_attachments"><td>
<p>Attach files:</p>
<ol id="rant_attachment_list">
</ol>
<script src="include/rants.js" type="text/javascript"></script>
<a href="#rant_attachments" onclick="new_rant_attachment()">(add attachment)</a>
</td></tr>
</table>
</div>
</fieldset>
</div>
</div>
</form>
<script src="include/tinymce/tinymce.min.js"></script>
<script src="include/mce_config.js"></script>
<script type="text/javascript">
mce_config.selector = 'textarea';
tinymce.init(mce_config);
</script>
<?php adminfooter() ?>