get_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG); if (empty($dbversion)) $dbversion=0; if (!DbSpice::table_created('commentspice')) { // twitternames cant be longer than 15 referring to API docs. 20 for safety. nvarchar because of unicode names $q = "create table {$serendipity['dbPrefix']}commentspice (" . "commentid int(10) not null, " . "twittername nvarchar(20), " . "primary key (commentid)" . ")"; $result = serendipity_db_schema_import($q); if ($result !== true) { return; } $obj->set_config(PLUGIN_EVENT_COMMENTSPICE_CNAME_DBCONFIG, 1); } } function saveCommentSpice($commentid, $twittername) { global $serendipity; if (empty($commentid) || empty($twittername) || !is_numeric($commentid)) return true; $sql = "INSERT INTO {$serendipity['dbPrefix']}commentspice (commentid, twittername) "; $sql .= " VALUES ($commentid, '$twittername')"; return serendipity_db_query($sql); } function loadCommentSpice($commentid) { global $serendipity; if (empty($commentid) || !is_numeric($commentid)) return false; $sql = "SELECT * FROM {$serendipity['dbPrefix']}commentspice WHERE commentid=$commentid"; $row = serendipity_db_query($sql, true); if (!is_array($row)) return false; return $row; } function deleteCommentSpice($commentid) { global $serendipity; if (empty($commentid) || !is_numeric($commentid)) return; $sql = "DELETE FROM {$serendipity['dbPrefix']}commentspice WHERE commentid=$commentid"; return serendipity_db_query($sql, true); } }