-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.inc.php
83 lines (62 loc) · 2.03 KB
/
main.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/*
Plugin Name: Embedded Videos
Version: auto
Description: Add videos from Dailymotion, Youtube, Vimeo, Wideo and Wat.
Plugin URI: auto
Author: Mistic
Author URI: http://www.strangeplanet.fr
Has Settings: true
*/
defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
if (basename(dirname(__FILE__)) != 'gvideo')
{
add_event_handler('init', 'gvideo_error');
function gvideo_error()
{
global $page;
$page['errors'][] = 'Embedded Videos folder name is incorrect, uninstall the plugin and rename it to "gvideo"';
}
return;
}
global $prefixeTable, $conf;
define('GVIDEO_PATH', PHPWG_PLUGINS_PATH . 'gvideo/');
define('GVIDEO_ADMIN', get_root_url() . 'admin.php?page=plugin-gvideo');
define('GVIDEO_TABLE', $prefixeTable.'image_video');
include_once(GVIDEO_PATH . 'include/events.inc.php');
$conf['gvideo'] = safe_unserialize($conf['gvideo']);
add_event_handler('picture_pictures_data', 'gvideo_prepare_picture');
add_event_handler('delete_elements', 'gvideo_delete_elements');
if (defined('IN_ADMIN'))
{
add_event_handler('tabsheet_before_select','gvideo_tab', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2);
add_event_handler('get_batch_manager_prefilters', 'gvideo_add_prefilter');
add_event_handler('perform_batch_manager_prefilters', 'gvideo_apply_prefilter', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
}
/**
* special tabs
*/
function gvideo_tab($sheets, $id)
{
if ($id != 'photo') return $sheets;
$query = '
SELECT *
FROM '.GVIDEO_TABLE.'
WHERE picture_id = '.$_GET['image_id'].'
;';
$result = pwg_query($query);
if (!pwg_db_num_rows($result)) return $sheets;
global $gvideo, $page;
load_language('plugin.lang', GVIDEO_PATH);
if ($page['tab'] == 'properties')
{
$page['infos'][] = l10n('This element is a video added with "Embedded Video"');
}
$gvideo = pwg_db_fetch_assoc($result);
$sheets['gvideo'] = array(
'caption' => l10n('Video properties'),
'url' => GVIDEO_ADMIN.'-photo&image_id='.$_GET['image_id'],
);
unset($sheets['coi'], $sheets['update']);
return $sheets;
}