View Single Post
  #844  
Old 05-24-2004, 12:17 PM
flat6 flat6 is offline
 
Join Date: Apr 2004
Location: Toronto
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I'm going to finish coding it in about a month, right now only the admin part in the CP is done, so I'll come back then and update you guys and maybe put up some code for download.

To answer the wysiwyg editor question, it looks like a lot of code, but since it's just recycled vB3 code, it wasn't hard to implement, mainly just cut and paste, with a little fixing and customization.

The code:

PHP Code:
// ############################################################################
// ############################################################################
// ############################# THE CAR'S STORY ##############################
// ############################################################################
// ############################################################################

// ############################ start edit owner_history ##########################
if ($_REQUEST['do'] == 'edit_story')
{
    require_once(
'./includes/functions_newpost.php');
    
$htmlcodeon iif($vboptions['allowhtml'], $vbphrase['on'], $vbphrase['off']);
    
$bbcodeon iif($vboptions['allowbbcode'], $vbphrase['on'], $vbphrase['off']);
    
$imgcodeon iif($vboptions['allowbbimagecode'], $vbphrase['on'], $vbphrase['off']);
    
$smilieson iif($vboptions['allowsmilies'], $vbphrase['on'], $vbphrase['off']);

    
// only show posting code allowances in forum rules template
    
$show['codeonly'] = true;

    eval(
'$forumrules = "' fetch_template('forumrules') . '";');

    if (!isset(
$preview))
    {
        
$result $DB_site->query("
            SELECT story
            FROM f6_car_owned WHERE car_owned_id=
$car_owned_id
        "
);
        while (
$car mysql_fetch_array($result))
            {
            
$story $car[story];
            }
    }

    require_once(
'./includes/functions_editor.php');

    
// set message box width to usercp size
    
$stylevar['messagewidth'] = $stylevar['messagewidth_usercp'];
    
construct_edit_toolbar(htmlspecialchars_uni($story), 000);
    
    
// draw cp nav bar
    
construct_usercp_nav('garage');

    
$navbits[''] = $vbphrase['edit_garage'];
    
$templatename 'modify_story';
}


// ########################### start update owner_history #########################
if ($_POST['do'] == 'update_story')
{
    
globalize($_POST, array('WYSIWYG_HTML''message' => STR'preview'));


    
    if (isset(
$WYSIWYG_HTML))
    {
        require_once(
'./includes/functions_wysiwyg.php');
        
$story convert_wysiwyg_html_to_bbcode($WYSIWYG_HTML$vboptions['allowhtml']);
    }
    else
    {
        
$story trim($message);
    }

    if (isset(
$preview))
    {
        if (
is_array($errors))
        {
            
$errorlist '';
            foreach (
$errors AS $key => $errormessage)
            {
                eval(
'$errorlist .= "' fetch_template('newpost_errormessage') . '";');
            }
            
$show['errors'] = true;
        }

        require_once(
'./includes/functions_bbcodeparse.php');
        
$previewmessage parse_bbcode2($story$vboptions['allowhtml'], $vboptions['allowbbimagecode'], $vboptions['allowsmilies'], $vboptions['allowbbcode']);
        
// save a conditional by just overwriting the phrase
        
$vbphrase['submit_message'] = "Save Car's Story";
        eval(
'$preview = "' fetch_template('newpost_preview') . '";');
        
$_REQUEST['do'] = 'edit_story';
    }
    else
    {
        
$DB_site->query("
            UPDATE f6_car_owned
            SET story = '" 
addslashes($story) . "'
            WHERE car_owned_id = 
$car_owned_id
        "
);
        
        
$url "garage.php?$session[sessionurl]do=garage_home";
        eval(
print_standard_redirect('redirect_updatethanks'));
    }

And the template:

HTML Code:
<form action="garage.php" method="post" name="vbform"<if condition="!is_browser('webtv')"> onsubmit="return validatePost(this, 0, 0, 0);" onreset="vB_RESET(this);"</if>>

$preview

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">Edit Car's Story</td>
</tr>
<tr>
	<td class="panelsurround" align="center">
	<div class="panel">
		<div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]">
			
		<!-- message area -->
		<div class="smallfont">This is a story of how you got it, why you got it, what you're doing with it, and whatever else your creative mind wants to write about.<br /><br /></div>
		$messagearea
		<!-- / message area -->
		
		</div>
	</div>
	
	<div style="margin-top:$stylevar[cellpadding]px">
		<input type="hidden" name="s" value="$session[sessionhash]" />
		<input type="hidden" name="do" value="update_story" />
		<input type="submit" class="button" value="Save Car's Story" accesskey="s" tabindex="1" />
		<input type="submit" class="button" value="Preview Car's Story" name="preview" accesskey="p" tabindex="1" />	
	</div>
	</td>
</tr>
</table>

<br />

$forumrules

</form>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01244 seconds
  • Memory Usage 1,843KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete