MrNase |
01-23-2005 10:02 AM |
WYSIWYG - What is needed to make it work?
Hello,
I try to combine the WYSIWYG and vBGarage..
Here's what I already have but that doesn't work..
The editors shows up and everything but whatever I enter it doesn't get saved :(
It does work, however, if I choose vB's basic editor.
Can you help me out, please? :)
PHP Code:
/*======================================================================*\ || #################################################################### || || # vBGarage v3.1.1 # || || # ---------------------------------------------------------------- # || || # Copyright ?2000?2004 magnus. All Rights Reserved. # || || # https://vborg.vbsupport.ru/showthread.php?t=63681 # || || #################################################################### || \*======================================================================*/ // Updated by: noppid @ www.lakecs.com // This is not official or for distrubtion. // added length limit to text field // added striping of html and php code from user text input fields // strip tags code from php.net and vBulletin // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'vbgarage'); // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array( 'user', 'cpglobal', 'posting' ); // get special data templates from the datastore $specialtemplates = array( 'smiliecache', 'bbcodecache' ); // pre-cache templates used by all actions $globaltemplates = array( 'vbgarage_editgarage', 'vbgarage_editimagebits', 'vbgarage_imagebits', 'vbgarage_listbits', 'vbgarage_listgarage', 'vbgarage_popup', 'vbgarage_viewgarage' ); // pre-cache templates used by specific actions $actiontemplates = array(); // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); require_once('./includes/functions_bbcodeparse.php'); require_once('./includes/functions_user.php'); require_once('./includes/adminfunctions.php'); require_once('./includes/functions_editor.php'); require_once('./includes/functions_bigthree.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### if (!$vboptions[vbgenable] AND !can_administer()) { print_no_permission(); } if (empty($_REQUEST['do'])) { $_REQUEST['do'] = 'list'; } $textareacols = fetch_textarea_width(); // ############################################################################ // ############################### EDIT GARAGE ################################ // ############################################################################ if ($_REQUEST['do'] == 'editgarage') { if (can_administer() && $_REQUEST[id]) { $id = $_REQUEST[id]; } else { $id = $bbuserinfo['userid']; } $user = fetch_userinfo($id); if (!$bbuserinfo['userid']) { print_no_permission(); } if ($permissions['genericpermissions'] & CANVBGARAGE) { $result_data = $DB_site->query(" SELECT year,make,model,text FROM " . TABLE_PREFIX . "vbgarage_users WHERE userid = $id "); $count = 0; $data = $DB_site->fetch_Array($result_data); // (nop) $data['year'] = unhtmlspecialchars($data['year']); $data['make'] = unhtmlspecialchars($data['make']); $data['model'] = unhtmlspecialchars($data['model']); $data['text'] = unhtmlspecialchars($data['text']); // (nop) // start description construct_edit_toolbar($data['text'], 0,0,1,1); $result_image = $DB_site->query(" SELECT vbgarageid,name FROM " . TABLE_PREFIX . "vbgarage_images WHERE userid = $id "); while ($image = $DB_site->fetch_Array($result_image)) { $count++; eval('$editimagebits .= "' . fetch_template('vbgarage_editimagebits') . '";'); } $navbits = construct_navbits(array('' => 'Pagodengarage bearbeiten')); eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('vbgarage_editgarage') . '");'); } else { print_no_permission(); } } if ($_REQUEST['do'] == 'edit') { globalize($_POST, array('year', 'make', 'model')); // ### PREP INPUT (should eventually all come in array direct from form) ### if (isset($_POST['WYSIWYG_HTML'])) { require_once('./includes/functions_wysiwyg.php'); $newpost['message'] = convert_wysiwyg_html_to_bbcode($_POST['WYSIWYG_HTML'], 0); } else { $newpost['message'] = $_POST['message']; } if (can_administer() && $_REQUEST[id]) { $id = $_POST[id]; } else { $id = $bbuserinfo['userid']; } if (!$bbuserinfo['userid']) { print_no_permission(); } if ($permissions['genericpermissions'] & CANVBGARAGE) { if (empty($year) OR empty($make) OR empty($id)) { eval (print_standard_error('error_requiredfields')); } if (!empty($_FILES['src']['tmp_name'])) { $name = $_FILES['src']['name']; //(nop) not implemented in this version //$data = addslashes( gzcompress(fread(fopen($_FILES['src']['tmp_name'], "r"), filesize($_FILES['src']['tmp_name'])), 1) ); $data = addslashes( fread(fopen($_FILES['src']['tmp_name'], "r"), filesize($_FILES['src']['tmp_name'])) ); $type = $_FILES['src']['type']; // '" . $DB_site->escape_string($data) . "' $DB_site->query(" INSERT INTO " . TABLE_PREFIX . "vbgarage_images (userid, name, data, type) VALUES ($id, '" . addslashes($name) . "', '$data' , '" . addslashes($type) . "') "); } $result_user = $DB_site->query(" SELECT * FROM " . TABLE_PREFIX . "vbgarage_users WHERE userid = $id "); $user = $DB_site->fetch_Array($result_user); if (empty($user)) { $DB_site->query(" INSERT INTO " . TABLE_PREFIX . "vbgarage_users (userid, year, make, model, text, lastactivity) VALUES ($id, '" . addslashes($year) . "', '" . addslashes($make) . "', '" . addslashes($model) . "', $text, '" . time() . "') "); } else { $DB_site->query(" UPDATE " . TABLE_PREFIX . "vbgarage_users SET year = '" . addslashes($year) . "', make = '" . addslashes($make) . "', model = '" . addslashes($model) . "', text = '" . addslashes($newpost['message']) . "', lastactivity = '" . time() . "' WHERE userid = $id "); } $result_image = $DB_site->query(" SELECT vbgarageid,name FROM " . TABLE_PREFIX . "vbgarage_images WHERE userid = $id "); if (!empty($result_image)) { while ($image = $DB_site->fetch_Array($result_image)) { if ($_POST['delete'.$image['vbgarageid']]) { $DB_site->query(" DELETE FROM " . TABLE_PREFIX . "vbgarage_images WHERE vbgarageid = $image[vbgarageid] LIMIT 1 "); } } } Header("Location: $vboptions[bburl]/garage.php?do=editgarage&id=$id"); } else { print_no_permission(); } } if ($_REQUEST['do'] == 'delgarage') { globalize($_REQUEST, array('id' => INT)); if (!$bbuserinfo['userid'] OR $bbuserinfo['usergroupid']!=6) { print_no_permission(); } if (empty($id)) { eval (print_standard_error('error_requiredfields')); } $DB_site->query(" DELETE FROM " . TABLE_PREFIX . "vbgarage_users WHERE userid = $id "); $DB_site->query(" DELETE FROM " . TABLE_PREFIX . "vbgarage_images WHERE userid = $id "); $DB_site->query(" DELETE FROM " . TABLE_PREFIX . "vbgarage_comments WHERE vbgarageid = $id "); Header("Location: $vboptions[bburl]/garage.php?do=list"); } // ############################################################################ // ############################### VIEW GARAGE ################################ // ############################################################################ if ($_REQUEST['do'] == 'view') { globalize($_REQUEST, array('id' => INT)); $result_data = $DB_site->query(" SELECT * FROM " . TABLE_PREFIX . "vbgarage_users WHERE userid = $id LIMIT 1 "); $data = $DB_site->fetch_Array($result_data); // (nop) $data['year'] = unhtmlspecialchars($data['year']); $data['make'] = unhtmlspecialchars($data['make']); $data['model'] = unhtmlspecialchars($data['model']); $data['text'] = unhtmlspecialchars($data['text']); // (nop) $data['text'] = parse_bbcode($data['text'],0, 1); $result_image = $DB_site->query(" SELECT vbgarageid,name FROM " . TABLE_PREFIX . "vbgarage_images WHERE userid = $id "); $user = fetch_userinfo($id); while ($image = $DB_site->fetch_Array($result_image)) { eval('$imagebits .= "' . fetch_template('vbgarage_imagebits') . '";'); } $result_comment = $DB_site->query(" SELECT * FROM " . TABLE_PREFIX . "vbgarage_comments WHERE vbgarageid = $id "); while ($comment = $DB_site->fetch_Array($result_comment)) { // (nop) $comment['pagetext'] = parse_bbcode($comment['pagetext'],0, 1); $comment['dateline'] = vbdate($vboptions['dateformat'],$comment['dateline'],true); eval('$commentbits .= "' . fetch_template('vbgarage_commentbits') . '";'); } $navbits = construct_navbits(array('' => 'Pagodengarage')); eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('vbgarage_viewgarage') . '");'); } // ############################################################################ // ############################# LIST ALL GARAGES ############################# // ############################################################################ if ($_REQUEST['do'] == 'list') { globalize($_REQUEST, array('pagenumber' => INT, 'perpage' => INT)); $perpage = intval($perpage); if ($perpage == 0 or $perpage > 200) { $perpage = 25; } if (intval($pagenumber) == 0) { $pagenumber = 1; } $limitlower = ($pagenumber - 1) * $perpage + 1; $limitupper = ($pagenumber) * $perpage; $counter = 0; $garagecount = $DB_site->query_first(" SELECT COUNT(*) AS garages FROM " . TABLE_PREFIX . "vbgarage_users "); $numberpages = $garagecount['garages'] / $perpage; $numberpages = ceil($numberpages); if (!isset($pagenumber) or ($pagenumber < 1) or ($pagenumber > $numberpages)) $pagenumber = 1; $pos = ($pagenumber - 1) * $perpage; $result_list = $DB_site->query(" SELECT * FROM " . TABLE_PREFIX . "vbgarage_users ORDER BY userid ASC LIMIT $pos,$perpage "); $counter = 0; $count = 0; while ($list = $DB_site->fetch_Array($result_list) AND $counter++ < $perpage) { $count++; // (nop) $list['year'] = unhtmlspecialchars($list['year']); $list['make'] = unhtmlspecialchars($list['make']); $list['model'] = unhtmlspecialchars($list['model']); $list['text'] = unhtmlspecialchars($list['text']); // (nop) $list['lastactivity'] = vbdate($vboptions['dateformat'],$list['lastactivity'],true); $user = fetch_userinfo($list[userid]); eval('$listbits .= "' . fetch_template('vbgarage_listbits') . '";'); } $result_latest = $DB_site->query(" SELECT * FROM " . TABLE_PREFIX . "vbgarage_images ORDER BY vbgarageid DESC LIMIT 5 "); while ($latest = $DB_site->fetch_Array($result_latest)) { eval('$latestbits .= "' . fetch_template('vbgarage_latestbits') . '";'); } $pagenav = construct_page_nav($garagecount[garages],"garage.php?$session[sessionurl]do=$_REQUEST[do]&perpage=$perpage"); $navbits = construct_navbits(array('' => 'Pagodengarage')); eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('vbgarage_listgarage') . '");'); } // ############################################################################ // ############################# GARAGE COMMENTS ############################## // ############################################################################ if ($_REQUEST['do'] == 'addcomment') { globalize($_REQUEST, array('comment', 'id' => INT)); if (!$bbuserinfo['userid']) { print_no_permission(); } if (empty($id) OR empty($comment)) { eval (print_standard_error('error_requiredfields')); } // shorten comment field to 1000 characters (nop) $comment = substr($comment,0,1000); // strip code from input for all user vars (nop) while($comment != strip_tags($comment)) { $comment = strip_tags($comment); } $comment = htmlspecialchars_uni($comment); // end strip codes (nop) $DB_site->query(" INSERT INTO " . TABLE_PREFIX . "vbgarage_comments (vbgarageid, username, pagetext, dateline) VALUES ('$id', '" . addslashes($bbuserinfo[username]) . "', '" . addslashes($comment) . "', '" . time() . "') "); eval(print_standard_redirect('redirect_postthanks')); } if ($_REQUEST['do'] == 'delcomment') { globalize($_REQUEST, array('id' => INT)); if (!$bbuserinfo['userid'] OR $bbuserinfo['usergroupid']!=6) { print_no_permission(); } if (empty($id)) { eval (print_standard_error('error_requiredfields')); } $DB_site->query(" DELETE FROM " . TABLE_PREFIX . "vbgarage_comments WHERE id = $id LIMIT 1 "); eval(print_standard_redirect('redirect_deletethread')); } // ############################################################################ // ############################# IMAGE FUNCTIONS ############################## // ############################################################################ if ($_REQUEST['do'] == 'getimage') { globalize($_REQUEST, array('id' => INT)); $result_image = $DB_site->query(" SELECT data,type FROM ". TABLE_PREFIX ."vbgarage_images WHERE vbgarageid = $id LIMIT 1 "); while ($image = $DB_site->fetch_Array($result_image)) { Header ("Content-type: $type"); // (nop) not implemented in this version //echo gzuncompress ( $image['data'] ); echo $image['data']; $type = $image['type']; } } if ($_REQUEST['do'] == 'popup') { globalize($_REQUEST, array('image', 'id' => INT)); eval('print_output("' . fetch_template('vbgarage_popup') . '");'); } if ($_REQUEST['do'] == 'thumb') { globalize($_REQUEST, array('width', 'id' => INT)); if (empty($id) OR empty($width)) { eval (print_standard_error('error_requiredfields')); } $result_image = $DB_site->query(" SELECT data FROM " . TABLE_PREFIX ."vbgarage_images WHERE vbgarageid = $id LIMIT 1 "); $image = $DB_site->fetch_Array($result_image); // (nop) not implemented in this version //$image['data'] = gzuncompress ( $image['data'] ); $thumb['file'] = imagecreatefromstring($image['data']); $thumb['height'] = imagesy($thumb['file']) / imagesx($thumb['file']) * $width; $thumb['data'] = imagecreatetruecolor($width,$thumb['height']); imagecopyresampled($thumb['data'],$thumb['file'],0,0,0,0,$width,$thumb['height'],ImageSX($thumb['file']),ImageSY($thumb['file'])); imagejpeg($thumb['data']); imagedestroy ($thumb['file']); imagedestroy ($thumb['data']); } /*======================================================================*\ || #################################################################### || # CVS: $RCSfile: vbgarage.php,v $ - $Revision: 3.1.1 $ || #################################################################### \*======================================================================*/
|