CarbonCopy
Members-
Posts
90 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
CarbonCopy's Achievements
Member (2/5)
0
Reputation
-
TinyMCE not loading saved changes, possible php problem?
CarbonCopy replied to CarbonCopy's topic in PHP Coding Help
Thanks to Freenode, I was able to get this issue solved. // Disable caching function http_last_modified( $time = NULL ) { if ( $time === NULL ) $time = time(); $new_last_modified = gmdate( 'D, d M Y H:i:s' , $time ) . ' GMT'; if ( isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { $if_modified_since = preg_replace( '/;.*$/' , '' , $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); if ( $if_modified_since == $new_last_modified ) { header( 'HTTP/1.0 304 Not Modified' ); exit(0); } } header( "Last-Modified: $new_last_modified" ); } http_last_modified(); -
I have a TinyMCE setup to edit my website. However, when I submit my form, the changes are written to the database, I'm redirected back the editor page, and TinyMCE refuses to load the updated content. It's not so much a TinyMCE problem I think, since the text area is showing the wrong content as well. I have to Shift + Reload to see the new html, even regular refreshing won't work. I've disabled caching in the index.php page (Which loads everything else) using this code: header( 'Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0' ); header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // Date in the past header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); and my save page does this $page = mysql_real_escape_string( $_REQUEST['page'] ); $name = mysql_real_escape_string( htmlentities( $_POST['page_name'] ) ); $html = mysql_real_escape_string( $_POST['html'] ); $query1 = mysql_query( "SELECT * FROM `html` WHERE `name` = '$page' ORDER BY ABS(`revision`) DESC LIMIT 1" ); $data1 = mysql_fetch_assoc( $query1 ); $rev = $data1['revision']+1; $user = $_SESSION['id']; $time = time(); mysql_query( "INSERT INTO `html` ( `name`,`title`,`content`,`date_modified`,`modified_by`,`revision` ) VALUES ( '$page','$name','$html','$time','$user','$rev')" ); header( 'Location: index.php?act=redirect&to=index.php%3Fact%3Dedit%26type%3Dreg%26page%3D'.$page ); I tried using two header redirects which is what that last part is. It redirects to index which redirects again to the editor page. This is my TinyMCE code <script type="text/javascript" src="tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "../css/main.css", // Drop lists for link/image/media/template dialogs external_link_list_url : "admin/tiny_mce/lists/link_list.js", external_image_list_url : "admin/tiny_mce/lists/image_list.js", //media_external_list_url : "tiny_mce/lists/link_list.php", remove_script_host : false, relative_urls : false, document_base_url : "<?=$_CONFIG['site_path']?>", }); </script> and this is my editor $page = mysql_real_escape_string( $_REQUEST['page'] ); if ( isset( $_POST['revision'] ) ) { $rev = intval( $_POST['revision'] ); $query1 = mysql_query( "SELECT * FROM `html` WHERE `name` = '$page' AND `revision` = '$rev'" ); if ( mysql_num_rows( $query1 ) == 0 ) { $query1 = mysql_query( "SELECT * FROM `html` WHERE `name` = '$page' ORDER BY ABS(`revision`) DESC LIMIT 1" ); } } else { $query1 = mysql_query( "SELECT * FROM `html` WHERE `name` = '$page' ORDER BY ABS(`revision`) DESC LIMIT 1" ); } if ( mysql_num_rows( $query1 ) == 0 ) { include( 'view/edit/home.html' ); include( 'template/layout.php' ); exit(); } $query2 = mysql_query( "SELECT `revision` FROM `html` WHERE `name` = '$page' ORDER BY ABS(`revision`) DESC LIMIT 1" ); $data2 = mysql_fetch_assoc( $query2 ); $data1 = mysql_fetch_assoc( $query1 ); $html = htmlentities( $data1['content'] ); $rev = $data2['revision']+1; $date = $data1['date_modified']; $query3 = mysql_query( "SELECT `username` FROM `users` WHERE `id` = '{$data1['modified_by']}'" ); $data3 = mysql_fetch_assoc( $query3 ); if ( empty( $data3['username'] ) ) { $user = 'Unknown User'; } else { $user = $data3['username']; } $query3 = mysql_query( "SELECT `revision`,`date_modified` FROM `html` WHERE `name` = '$page' ORDER BY ABS(`revision`) DESC" ); $revisions = ''; while ( $row = mysql_fetch_assoc( $query3 ) ) { $dater = date( 'l, F jS @ g:i A' , $row['date_modified'] ); $revisions .= "<option value='{$row['revision']}'>Revision {$row['revision']} From $dater</option>\n"; } $sidebar = false; include( 'view/edit/regular_edit.html' ); include( 'template/layout.php' ); <textarea style="width:90%;height:450px;" name="html"> <?=$html?> </textarea> The editor will either load the newest content or the specified revision. I do NOT have this issue with a wordpress installation on the same server when using TinyMCE
-
I have a website that allows the user to play various videos. Each video is it's own object which has display toggled when you switch them. The problem is I need to pause the video when you switch to a new one so it doesn't keep playing. I've tried to use the JavaScript API but documentation is complete sh!t and I have no idea how to make it work. The website is at: http://kats-designs.com/media-portal/ JavaScript isn't my area of expertise, so any help would be appreciated.
-
http://www.google.com/search?hl=en&q=php+xml+to+array Use Google next time please. Many examples that work fine on the first page
-
I posted to soon, I need just error::$cms = &$this;
-
Well that fixed that problem, so thank you. Now I get an error for the class calling that method. [04-Nov-2009 21:47:04] PHP Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /www/.............../test.php on line 17 and test.php <?php error_reporting(E_ALL); ini_set('display_errors','on'); class cms { function init() { include('error.inc.php'); $this->error = new error(); $this->error::$cms = &$this; #$this->error::init(); echo "HEY";exit(); include('log.inc.php'); $this->logger = new logger(); $this->logger->cms = &$this; $this->logger->init('../logs/'); include('database.inc.php'); $this->database = new database(); $this->database->cms = &$this; $this->database->init('localhost','dev_cms','root','**********','mysql'); echo $this->database->get_setting('base_path'); } } $cms = new cms(); $cms->init(); ?>
-
I am designing an application which I want to have custom error reporting, and I am using a class. However, when using self:: I get this error: Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /www/.............../error.inc.php on line 38 And here is error.inc.php <?php /** * @author Brandon Wamboldt * @package northern-cms * @version 1.0.0 * @date November 1st, 2009 * * This file is the intelluctual property of Northern Lights Technology. Any * unauthorized use, modifications, or distribution of this code is prohibted. * * http://northernlightstechnology.ca/legal */ class error { /* * Object - Pointer to the root class */ public static $cms; /** * Required initialization class */ public static function init() { set_error_handler( array( "error" , "error_handler" ) ); } /** * @name show_fatal_error * @desc Changes the logging directory * @vars dir - String - The path to the new directory * @return Boolean - True if the logging directory was changed, false if there is a problem with it */ public static function error_handler( $errno , $errstr , $errfile , $errline ) { /** Based on debugging mode send output **/ if ( self::cms->database->connected ) { if ( self::cms->database->get_setting( 'debug_mode' ) == 1 ) { if ( $errno === E_USER_ERROR ) { self::show_fatal_error(); } } else if ( self::cms->database->get_setting( 'debug_mode' ) == 2 ) { if ( $errno === E_USER_ERROR ) { echo "<b>Northern CMS:</b> [$errno] $errstr<br />\n"; echo " Fatal error on line $errline in file $errfile"; echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; echo "Aborting...<br />\n"; self::show_fatal_error(); } } else if ( self::cms->database->get_setting( 'debug_mode' ) == 3 ) { if ( $errno === E_USER_ERROR ) { echo "<b>Northern CMS:</b> [$errno] $errstr<br />\n"; echo " Fatal error on line $errline in file $errfile"; echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; echo "Aborting...<br />\n"; self::show_fatal_error(); } else if ( $errno == E_USER_WARNING ) { echo "<b>Northern CMS:</b> [$errno] $errstr<br />\n"; } } else if ( self::cms->database->get_setting( 'debug_mode' ) == 4 ) { if ( $errno === E_USER_ERROR ) { echo "<b>Northern CMS:</b> [$errno] $errstr<br />\n"; echo " Fatal error on line $errline in file $errfile"; echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; echo "Aborting...<br />\n"; self::show_fatal_error(); } else if ( $errno == E_USER_WARNING ) { echo "<b>Northern CMS Warning:</b> [$errno] $errstr<br />\n"; } else if ( $errno == E_USER_NOTICE ) { echo "<b>Northern CMS Notice:</b> [$errno] $errstr<br />\n"; } } else { if ( $die ) { exit(); } } } else { if ( $die ) { self::show_fatal_error(); exit(); } } } /** * @name show_fatal_error * @desc Changes the logging directory * @vars dir - String - The path to the new directory * @return Boolean - True if the logging directory was changed, false if there is a problem with it */ public static function show_fatal_error() { echo '<h1 style="font-style:italic;">Oops, we\'ve encounted an error</h1>'; echo '<p style="font-weight:bold;font-size:12px;width:400px;">'; echo 'This program has encounted a fatal error and was unable to continue. Please refresh your page, or if the '; echo 'problem persists, contact the administrator of this website'; echo '</p>'; exit(); } } ?>
-
I have a table, and the relevant columns are id,url, and url-prefix. Two of my entries have these values {1,'/path/to/gallery',0} {2,'/path/to/designs',0} and 4 of my entries go like this {3,'gallery1',1} {3,'gallery2',1} {4,'designs1',2} {4,'designs2',2} If I have the url /path/to/designs/gallery1 I want to check to see if it is a valid entry or not. Is there any way to do this in 1 query?
-
And I've changed the colors on the sidebar. Any suggestions? Are the link colors to light?
-
I lowered everything except the search bar. What do you think?
-
I added some javascript which removes the text in the search box on focus.
-
and there is a media player on the right side with volume and controls. It uses XSPF player slim edition.
-
haha, yeah. I listen to techno occasionally, but I really didn't like the music on this site. The client's been using it for a while though, and it seems to work fine. I wasn't sure if it would, I did some really weird things with the wordpress code.
-
LOL. That is the one thing i disliked. At least you didn't have to spend hours listening to it while you developed the site. I tried to convince the client to let me have an option to disable music, but no luck.