[17307] | 1 | <?php |
---|
| 2 | if (!defined('GVIDEO_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
| 4 | /** |
---|
[17678] | 5 | * some stuff at the begining of picture.php |
---|
| 6 | */ |
---|
| 7 | function gvideo_prepare_picture($picture) |
---|
| 8 | { |
---|
| 9 | if ($picture['current']['is_gvideo']) |
---|
| 10 | { |
---|
| 11 | // remove default parser |
---|
| 12 | remove_event_handler('render_element_content', 'default_picture_content', EVENT_HANDLER_PRIORITY_NEUTRAL); |
---|
| 13 | |
---|
| 14 | // remove autosize |
---|
[20804] | 15 | global $pwg_loaded_plugins, $autosize_ctrl; |
---|
[17678] | 16 | |
---|
[20804] | 17 | if ( isset($pwg_loaded_plugins['Autosize']) and isset($autosize_ctrl) ) |
---|
[17678] | 18 | { |
---|
[20804] | 19 | remove_event_handler('render_element_content', array(&$autosize_ctrl, 'autosize_calcContent'), EVENT_HANDLER_PRIORITY_NEUTRAL-11, 2); |
---|
| 20 | remove_event_handler('render_element_content', array(&$autosize_ctrl, 'init_1'), EVENT_HANDLER_PRIORITY_NEUTRAL-9, 2); |
---|
| 21 | remove_event_handler('render_element_content', array(&$autosize_ctrl, 'init'), EVENT_HANDLER_PRIORITY_NEUTRAL-1, 2); |
---|
| 22 | remove_event_handler('render_element_content', array(&$autosize_ctrl, 'init2'), EVENT_HANDLER_PRIORITY_NEUTRAL+1, 2); |
---|
| 23 | remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_1')); |
---|
| 24 | remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_2')); |
---|
| 25 | remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_3')); |
---|
| 26 | remove_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL+21); |
---|
[17678] | 27 | } |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | return $picture; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | /** |
---|
[17307] | 34 | * replace content on picture page |
---|
| 35 | */ |
---|
| 36 | function gvideo_element_content($content, $element_info) |
---|
| 37 | { |
---|
[17488] | 38 | if (!$element_info['is_gvideo']) |
---|
| 39 | { |
---|
| 40 | return $content; |
---|
| 41 | } |
---|
| 42 | |
---|
[17307] | 43 | global $page, $picture, $template, $conf; |
---|
| 44 | |
---|
[19056] | 45 | if (is_string($conf['gvideo'])) |
---|
| 46 | { |
---|
| 47 | $conf['gvideo'] = unserialize($conf['gvideo']); |
---|
| 48 | } |
---|
[17488] | 49 | |
---|
[20804] | 50 | // remove some actions |
---|
| 51 | $template->assign('U_SLIDESHOW_START', null); |
---|
| 52 | $template->assign('U_METADATA', null); |
---|
| 53 | $template->append('current', array('U_DOWNLOAD' => null), true); |
---|
[17488] | 54 | |
---|
[17307] | 55 | $query = ' |
---|
| 56 | SELECT * |
---|
| 57 | FROM '.GVIDEO_TABLE.' |
---|
| 58 | WHERE picture_id = '.$element_info['id'].' |
---|
| 59 | ;'; |
---|
[17488] | 60 | $video = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[17307] | 61 | |
---|
| 62 | if (empty($video['width'])) |
---|
| 63 | { |
---|
| 64 | $video['width'] = $conf['gvideo']['width']; |
---|
| 65 | $video['height'] = $conf['gvideo']['height']; |
---|
| 66 | } |
---|
| 67 | if (empty($video['autoplay'])) |
---|
| 68 | { |
---|
| 69 | $video['autoplay'] = $conf['gvideo']['autoplay']; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | $video['config'] = $conf['gvideo']; |
---|
| 73 | if ($video['type'] == 'dailymotion') |
---|
| 74 | { |
---|
| 75 | $colors = array( |
---|
| 76 | 'F7FFFD' => 'foreground=%23F7FFFD&highlight=%23FFC300&background=%23171D1B', |
---|
| 77 | 'E02C72' => 'foreground=%23E02C72&highlight=%23BF4B78&background=%23260F18', |
---|
| 78 | '92ADE0' => 'foreground=%2392ADE0&highlight=%23A2ACBF&background=%23202226', |
---|
| 79 | 'E8D9AC' => 'foreground=%23E8D9AC&highlight=%23FFF6D9&background=%23493D27', |
---|
| 80 | 'C2E165' => 'foreground=%23C2E165&highlight=%23809443&background=%23232912', |
---|
| 81 | '052880' => 'foreground=%23FF0099&highlight=%23C9A1FF&background=%23052880', |
---|
| 82 | 'FF0000' => 'foreground=%23FF0000&highlight=%23FFFFFF&background=%23000000', |
---|
| 83 | '834596' => 'foreground=%23834596&highlight=%23CFCFCF&background=%23000000', |
---|
| 84 | ); |
---|
| 85 | $video['config']['dailymotion']['color'] = $colors[ $video['config']['dailymotion']['color'] ]; |
---|
| 86 | } |
---|
[17678] | 87 | |
---|
[17307] | 88 | $template->assign('GVIDEO', $video); |
---|
[17678] | 89 | |
---|
| 90 | global $user; |
---|
| 91 | if (strpos('stripped', $user['theme']) !== false) |
---|
| 92 | { |
---|
| 93 | $template->append('head_elements', '<style type="text/css">.hideTabs{display:none;}</style>'); |
---|
| 94 | } |
---|
[17307] | 95 | |
---|
[20804] | 96 | $template->set_filename('gvideo_content', realpath(GVIDEO_PATH . 'template/video_'.$video['type'].'.tpl')); |
---|
[17307] | 97 | return $template->parse('gvideo_content', true); |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | /** |
---|
| 101 | * clean table at element deletion |
---|
| 102 | */ |
---|
| 103 | function gvideo_delete_elements($ids) |
---|
| 104 | { |
---|
| 105 | $query = ' |
---|
| 106 | DELETE FROM '.GVIDEO_TABLE.' |
---|
| 107 | WHERE picture_id IN ('.implode(',', $ids).') |
---|
| 108 | ;'; |
---|
| 109 | pwg_query($query); |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | ?> |
---|