Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!defined('IN_MYBB')){
- die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
- }
- function xtlatest_videos_info(){
- return array(
- 'name' => 'Latest XThreads YouTube Videos (edited)',
- 'description' => 'Latest vids.',
- 'website' => 'http://mybbhacks.zingaburga.com',
- 'author' => 'XThreads Mania',
- 'authorsite' => 'http://mybbhacks.zingaburga.com',
- 'version' => '1.0',
- 'compatibility' => '1*',
- 'guid' => ''
- );
- }
- function xtlatest_videos_activate(){
- global $db;
- $template = array(
- 'title' => 'xtlatest_videos',
- 'template' => $db->escape_string('{$xtlatest_videos_video}'),
- 'sid' => -1
- );
- $db->insert_query('templates', $template);
- $template = array(
- 'title' => 'xtlatest_videos_video',
- 'template' => $db->escape_string('<a class="filmoteka tipTip" style="background:url(http://img.youtube.com/vi/{$mnxtivid_video_id}/default.jpg) no-repeat center center;" href="{$mnxtivid_links}" title="{$mnxtivid_subject_text}"></a>'),
- 'sid' => -1
- );
- $db->insert_query('templates', $template);
- }
- function xtlatest_videos_deactivate(){
- global $db;
- $db->delete_query('templates', 'title IN("xtlatest_videos", "xtlatest_videos_video")');
- }
- $plugins->add_hook('global_start', 'xtlatest_videos_tcache');
- function xtlatest_videos_tcache(){
- global $templatelist;
- //global $current_page, $templatelist;
- //if($current_page == 'index.php'){
- if(isset($templatelist)){
- $templatelist .= ',xtlatest_videos,xtlatest_videos_video';
- }
- //}
- }
- $plugins->add_hook('global_start', 'xtlatest_videos_run', 'global_end');
- function xtlatest_videos_run(){
- global $db, $templates;
- $query = $db->query('
- SELECT t.tid, t.subject, td.ytvgalid
- FROM '.TABLE_PREFIX.'threads t
- LEFT JOIN '.TABLE_PREFIX.'threadfields_data td ON (td.tid=t.tid)
- WHERE t.fid=7 AND t.visible=1 AND t.closed NOT LIKE "moved|%"
- ORDER BY t.dateline DESC
- LIMIT 0,4
- ');
- if($db->num_rows($query)){
- global $theme, $xtlatest_videos;
- while($mnxtivid = $db->fetch_array($query)){
- $mnxtivid_links = get_thread_link($mnxtivid['tid']);
- $mnxtivid_subject_text = htmlspecialchars_uni($mnxtivid['subject']);
- if(preg_match('#(?:([a-zA-Z0-9_\-+]{8,16})$|http\://(?:[a-z]{1,4}\.)?youtube\.com/watch\?v=([a-zA-Z0-9_\-+]{8,16}))#', $mnxtivid['ytvgalid'], $matches)){
- $mnxtivid_video_id = $matches[1].$matches[2];
- eval('$xtlatest_videos_video .= "'.$templates->get('xtlatest_videos_video').'";');
- }
- }
- eval('$xtlatest_videos = "'.$templates->get('xtlatest_videos').'";');
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement