| 1 |
<?php |
<?php |
| 2 |
// $Id: sheetnode.module,v 1.4.2.7 2008/11/22 07:48:23 kratib Exp $ |
// $Id: sheetnode.module,v 1.4.2.8 2008/11/27 19:37:36 kratib Exp $ |
| 3 |
|
|
| 4 |
function sheetnode_node_info() { |
function sheetnode_node_info() { |
| 5 |
return array( |
return array( |
| 106 |
EOS; |
EOS; |
| 107 |
} |
} |
| 108 |
|
|
| 109 |
|
function _sheetnode_sanitize_js($value) { |
| 110 |
|
$chars = array( |
| 111 |
|
chr(0xE2).chr(0x80).chr(0xA8), // Got this from Google Docs |
| 112 |
|
); |
| 113 |
|
return str_replace($chars, '', $value); |
| 114 |
|
} |
| 115 |
|
|
| 116 |
function sheetnode_insert($node) { |
function sheetnode_insert($node) { |
| 117 |
if ($node->sheetsave) { |
if ($node->sheetsave) { |
| 118 |
_sheetnode_save($node->nid, $node->sheetsave); |
_sheetnode_save($node->nid, $node->sheetsave); |
| 157 |
|
|
| 158 |
function _sheetnode_save($nid, $value) { |
function _sheetnode_save($nid, $value) { |
| 159 |
db_query("DELETE FROM {sheetnode} WHERE nid=%d", $nid); |
db_query("DELETE FROM {sheetnode} WHERE nid=%d", $nid); |
| 160 |
db_query("INSERT INTO {sheetnode} (nid, value) VALUES (%d, '%s')", $nid, serialize($value)); |
db_query("INSERT INTO {sheetnode} (nid, value) VALUES (%d, '%s')", $nid, serialize(_sheetnode_sanitize_js($value))); |
| 161 |
} |
} |
| 162 |
|
|
| 163 |
// @see http://forums.codecharge.com/posts.php?post_id=75694 |
// @see http://forums.codecharge.com/posts.php?post_id=75694 |