this shit sucks. writing plugins r hard hur durr

This commit is contained in:
brent s. 2016-04-30 21:28:05 -04:00
parent d53e6a320a
commit 144d628081

View File

@ -18,8 +18,8 @@ $plugin['flags'] = PLUGIN_LIFECYCLE_NOTIFY;
//if (!defined('txpinterface')) //if (!defined('txpinterface'))
// @include_once('zem_tpl.php'); // @include_once('zem_tpl.php');


register_callback('bts_podcast_initdb','plugin_lifecycle.bts_podcast', 'enabled'); //register_callback('bts_podcast_initdb','plugin_lifecycle.bts_podcast', 'enabled');
register_callback('bts_podcast_gen_metainfo','article_saved'); //register_callback('bts_podcast_gen_metainfo','article_saved');


if (0) { if (0) {
?> ?>
@ -93,6 +93,11 @@ function bts_podcast_initdb () {
safe_query("CREATE TABLE IF NOT EXISTS bts_podcast (id int(11) NOT NULL AUTO_INCREMENT,url_title varchar(64) NOT NULL,filename varchar(64) NOT NULL,type char(3) NOT NULL,checksum char(64) NOT NULL,bytesize varchar(16) NOT NULL,created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,changed timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,PRIMARY KEY (id),UNIQUE KEY unique_index (url_title,type)) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8"); safe_query("CREATE TABLE IF NOT EXISTS bts_podcast (id int(11) NOT NULL AUTO_INCREMENT,url_title varchar(64) NOT NULL,filename varchar(64) NOT NULL,type char(3) NOT NULL,checksum char(64) NOT NULL,bytesize varchar(16) NOT NULL,created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,changed timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,PRIMARY KEY (id),UNIQUE KEY unique_index (url_title,type)) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8");
} }


function bts_podccast_filesize($atts) {
bytecount = filesize(bts_podcast_path($atts) . bts_podcast_filename($atts);
return $bytecount;
}

function bts_podcast_gen_metainfo ($input) { function bts_podcast_gen_metainfo ($input) {
$hash = hash_file('sha256',file_article_upload()); $hash = hash_file('sha256',file_article_upload());
// safe_query("INSERT INTO bts_podcast (url_title,filename,type,checksum,bytesize) VALUES ('" . $input['urltitle'] . "','" . $input['mediafile'] . "','" . $input['mediatype'] . "','" . $input['mediachksum'] . "','" . $input['mediabytes'] . "') ON DUPLICATE KEY UPDATE url_title = '" . $input['urltitle'] . "', filename = '" . $input['mediafile'] . "', type = '" . $input['mediatype'] . "', checksum = '" . $input['mediachksum'] . "', bytesize = '" . $input['mediabytes'] . "'"); // safe_query("INSERT INTO bts_podcast (url_title,filename,type,checksum,bytesize) VALUES ('" . $input['urltitle'] . "','" . $input['mediafile'] . "','" . $input['mediatype'] . "','" . $input['mediachksum'] . "','" . $input['mediabytes'] . "') ON DUPLICATE KEY UPDATE url_title = '" . $input['urltitle'] . "', filename = '" . $input['mediafile'] . "', type = '" . $input['mediatype'] . "', checksum = '" . $input['mediachksum'] . "', bytesize = '" . $input['mediabytes'] . "'");
@ -169,11 +174,10 @@ function bts_podcast_media_uri ($atts) {
} }


/* /*
function bts_podccast_filesize($atts) {
}
function bts_podcast_medialength($atts) { function bts_podcast_medialength($atts) {
} }
function bts_podcast_get_guid($atts) { function bts_podcast_add_guid($atts) {
} }
*/ */