post-rant.php
177 lines
| 5.3 KiB
| text/x-php
|
XmlPhpLexer
| r1 | <?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'); | ||||
| r28 | $rant_image_ext = $dbConnection->fetchColumn('SELECT extension FROM media_t WHERE id = ?', array((int)$currentuser->imagetype)); | |||
| r1 | ||||
| ?> | ||||
| <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? | ||||
| r28 | $usual = $dbConnection->fetchColumn('SELECT side, COUNT(*) AS c FROM rant WHERE author = ? GROUP BY side ORDER BY c DESC LIMIT 1', array((int)$currentuser->id)); | |||
| r8 | ||||
| r28 | $sides = array('left'=>'Left', 'right'=>'Right'); | |||
| foreach( $sides as $k => $v ) { | ||||
| r1 | printf('<option value="%s" %s>%s</option>', htmlentities($k), ($usual == $k ? 'selected="selected"' : '' ), $v ); | |||
| } | ||||
| ?> | ||||
| </select></div> | ||||
| </fieldset> | ||||
| <fieldset id="authordiv" class="dbx-box"> | ||||
| r8 | <h3 class="dbx-handle">Author</h3> | |||
| r1 | <div class="dbx-content"><select name="rant_author"><?php | |||
| r28 | $contrib = $dbConnection->fetchAll('SELECT id, name FROM contributor'); | |||
| foreach( $contrib as $k => $v ) | ||||
| { | ||||
| r1 | 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> | ||||
| r8 | ||||
| r1 | <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> | ||||
| r8 | ||||
| r1 | <?php | |||
| /* | ||||
| include("include/fckeditor/fckeditor_php4.php"); | ||||
| $oFCKeditor = new FCKeditor('content'); | ||||
| $oFCKeditor->BasePath = 'include/fckeditor/'; | ||||
| $oFCKeditor->Value = ''; | ||||
| $oFCKeditor->Create(); | ||||
| */ | ||||
| ?> | ||||
| r8 | ||||
| r1 | </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> | ||||
| r8 | ||||
| r1 | </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> | ||||
| r38 | <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> | ||||
| r1 | <?php adminfooter() ?> | |||
